| 1 |
#!/usr/bin/perl -w |
| 2 |
|
| 3 |
use strict; |
| 4 |
use File::Path; |
| 5 |
|
| 6 |
our $boost_dir = "boostified"; |
| 7 |
our $bad_lines = 0; |
| 8 |
|
| 9 |
sub print_line |
| 10 |
{ |
| 11 |
my ($output, $line, $from, $lineno) = @_; |
| 12 |
|
| 13 |
# Warn if the resulting line is >80 characters wide. |
| 14 |
if (length($line) > 80) |
| 15 |
{ |
| 16 |
if ($from =~ /\.[chi]pp$/) |
| 17 |
{ |
| 18 |
++$bad_lines; |
| 19 |
print("Warning: $from:$lineno: output >80 characters wide.\n"); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
# Write the output. |
| 24 |
print($output $line . "\n"); |
| 25 |
} |
| 26 |
|
| 27 |
sub source_contains_asio_thread_usage |
| 28 |
{ |
| 29 |
my ($from) = @_; |
| 30 |
|
| 31 |
# Open the input file. |
| 32 |
open(my $input, "<$from") or die("Can't open $from for reading"); |
| 33 |
|
| 34 |
# Check file for use of asio::thread. |
| 35 |
while (my $line = <$input>) |
| 36 |
{ |
| 37 |
chomp($line); |
| 38 |
if ($line =~ /asio::thread/) |
| 39 |
{ |
| 40 |
close($input); |
| 41 |
return 1; |
| 42 |
} |
| 43 |
elsif ($line =~ /^ *thread /) |
| 44 |
{ |
| 45 |
close($input); |
| 46 |
return 1; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
close($input); |
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
sub source_contains_asio_include |
| 55 |
{ |
| 56 |
my ($from) = @_; |
| 57 |
|
| 58 |
# Open the input file. |
| 59 |
open(my $input, "<$from") or die("Can't open $from for reading"); |
| 60 |
|
| 61 |
# Check file for inclusion of asio.hpp. |
| 62 |
while (my $line = <$input>) |
| 63 |
{ |
| 64 |
chomp($line); |
| 65 |
if ($line =~ /# *include [<"]asio\.hpp[>"]/) |
| 66 |
{ |
| 67 |
close($input); |
| 68 |
return 1; |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
close($input); |
| 73 |
return 0; |
| 74 |
} |
| 75 |
|
| 76 |
sub copy_source_file |
| 77 |
{ |
| 78 |
my ($from, $to) = @_; |
| 79 |
|
| 80 |
# Ensure the output directory exists. |
| 81 |
my $dir = $to; |
| 82 |
$dir =~ s/[^\/]*$//; |
| 83 |
mkpath($dir); |
| 84 |
|
| 85 |
# First determine whether the file makes any use of asio::thread. |
| 86 |
my $uses_asio_thread = source_contains_asio_thread_usage($from); |
| 87 |
|
| 88 |
my $includes_asio = source_contains_asio_include($from); |
| 89 |
|
| 90 |
my $is_asio_hpp = 0; |
| 91 |
$is_asio_hpp = 1 if ($from =~ /asio\.hpp/); |
| 92 |
|
| 93 |
my $needs_doc_link = 0; |
| 94 |
$needs_doc_link = 1 if ($is_asio_hpp); |
| 95 |
|
| 96 |
my $is_error_hpp = 0; |
| 97 |
$is_error_hpp = 1 if ($from =~ /asio\/error\.hpp/); |
| 98 |
|
| 99 |
my $is_qbk = 0; |
| 100 |
$is_qbk = 1 if ($from =~ /.qbk$/); |
| 101 |
|
| 102 |
my $is_xsl = 0; |
| 103 |
$is_xsl = 1 if ($from =~ /.xsl$/); |
| 104 |
|
| 105 |
my $is_quickref = 0; |
| 106 |
$is_quickref = 1 if ($from =~ /quickref.xml$/); |
| 107 |
|
| 108 |
my $is_test = 0; |
| 109 |
$is_test = 1 if ($from =~ /tests\/unit/); |
| 110 |
|
| 111 |
my $is_coroutine_related = 0; |
| 112 |
$is_coroutine_related = 1 if ($from =~ /await/ || $from =~ /partial_promise/ || $from =~ /co_composed/); |
| 113 |
|
| 114 |
my $is_hash_related = 0; |
| 115 |
$is_hash_related = 1 if ($from =~ /ip\/address/ || $from =~ /ip\/basic_endpoint/); |
| 116 |
|
| 117 |
# Open the files. |
| 118 |
open(my $input, "<$from") or die("Can't open $from for reading"); |
| 119 |
open(my $output, ">$to") or die("Can't open $to for writing"); |
| 120 |
|
| 121 |
# Copy the content. |
| 122 |
my $lineno = 1; |
| 123 |
while (my $line = <$input>) |
| 124 |
{ |
| 125 |
chomp($line); |
| 126 |
|
| 127 |
# Unconditional replacements. |
| 128 |
$line =~ s/[\\@]ref boost_bind/boost::bind()/g; |
| 129 |
if ($from =~ /.*\.txt$/) |
| 130 |
{ |
| 131 |
$line =~ s/[\\@]ref async_read/boost::asio::async_read()/g; |
| 132 |
$line =~ s/[\\@]ref async_write/boost::asio::async_write()/g; |
| 133 |
} |
| 134 |
if ($line =~ /asio_detail_posix_thread_function/) |
| 135 |
{ |
| 136 |
$line =~ s/asio_detail_posix_thread_function/boost_asio_detail_posix_thread_function/g; |
| 137 |
} |
| 138 |
if ($line =~ /asio_signal_handler/) |
| 139 |
{ |
| 140 |
$line =~ s/asio_signal_handler/boost_asio_signal_handler/g; |
| 141 |
} |
| 142 |
if ($line =~ /ASIO_/ && !($line =~ /BOOST_ASIO_/)) |
| 143 |
{ |
| 144 |
$line =~ s/ASIO_/BOOST_ASIO_/g; |
| 145 |
} |
| 146 |
|
| 147 |
# Extra replacements for quickbook, XSL and quickref.xml source only. |
| 148 |
if ($is_qbk || $is_xsl || $is_quickref) |
| 149 |
{ |
| 150 |
$line =~ s/asio\.examples/boost_asio.examples/g; |
| 151 |
$line =~ s/asio\.history/boost_asio.history/g; |
| 152 |
$line =~ s/asio\.index/boost_asio.index/g; |
| 153 |
$line =~ s/asio\.net_ts/boost_asio.net_ts/g; |
| 154 |
$line =~ s/asio\.std_executors/boost_asio.std_executors/g; |
| 155 |
$line =~ s/asio\.overview/boost_asio.overview/g; |
| 156 |
$line =~ s/asio\.reference/boost_asio.reference/g; |
| 157 |
$line =~ s/asio\.tutorial/boost_asio.tutorial/g; |
| 158 |
$line =~ s/asio\.using/boost_asio.using/g; |
| 159 |
$line =~ s/Asio/Boost.Asio/g; |
| 160 |
$line =~ s/changes made in each release/changes made in each Boost release/g; |
| 161 |
$line =~ s/\[\$/[\$boost_asio\//g; |
| 162 |
$line =~ s/\[@\.\.\/src\/examples/[\@boost_asio\/example/g; |
| 163 |
$line =~ s/asio\//boost\/asio\//g if $is_xsl; |
| 164 |
$line =~ s/include\/asio/boost\/asio/g; |
| 165 |
$line =~ s/\^asio/^boost\/asio/g; |
| 166 |
$line =~ s/namespaceasio/namespaceboost_1_1asio/g; |
| 167 |
$line =~ s/ \(\[\@examples\/diffs.*$//; |
| 168 |
$line =~ s/boost\/tools\/boostbook/tools\/boostbook/g; |
| 169 |
} |
| 170 |
|
| 171 |
# Conditional replacements. |
| 172 |
if ($line =~ /^( *)namespace asio \{/) |
| 173 |
{ |
| 174 |
if ($is_qbk) |
| 175 |
{ |
| 176 |
print_line($output, $1 . "namespace boost { namespace asio {", $from, $lineno); |
| 177 |
} |
| 178 |
else |
| 179 |
{ |
| 180 |
print_line($output, $1 . "namespace boost {", $from, $lineno); |
| 181 |
print_line($output, $line, $from, $lineno); |
| 182 |
} |
| 183 |
} |
| 184 |
elsif ($line =~ /^( *)} \/\/ namespace asio$/) |
| 185 |
{ |
| 186 |
if ($is_qbk) |
| 187 |
{ |
| 188 |
print_line($output, $1 . "} } // namespace boost::asio", $from, $lineno); |
| 189 |
} |
| 190 |
else |
| 191 |
{ |
| 192 |
print_line($output, $line, $from, $lineno); |
| 193 |
print_line($output, $1 . "} // namespace boost", $from, $lineno); |
| 194 |
} |
| 195 |
} |
| 196 |
elsif ($line =~ /^(# *include )[<"](asio\.hpp)[>"]$/) |
| 197 |
{ |
| 198 |
print_line($output, $1 . "<boost/" . $2 . ">", $from, $lineno); |
| 199 |
if ($uses_asio_thread) |
| 200 |
{ |
| 201 |
print_line($output, $1 . "<boost/thread/thread.hpp>", $from, $lineno) if (!$is_test); |
| 202 |
$uses_asio_thread = 0; |
| 203 |
} |
| 204 |
} |
| 205 |
elsif ($line =~ /^(# *include )[<"]boost\/.*[>"].*$/) |
| 206 |
{ |
| 207 |
if (!$includes_asio && $uses_asio_thread) |
| 208 |
{ |
| 209 |
print_line($output, $1 . "<boost/thread/thread.hpp>", $from, $lineno) if (!$is_test); |
| 210 |
$uses_asio_thread = 0; |
| 211 |
} |
| 212 |
print_line($output, $line, $from, $lineno); |
| 213 |
} |
| 214 |
elsif ($line =~ /^(# *include )[<"]asio\/thread\.hpp[>"]/) |
| 215 |
{ |
| 216 |
if ($is_test) |
| 217 |
{ |
| 218 |
print_line($output, $1 . "<boost/asio/detail/thread.hpp>", $from, $lineno); |
| 219 |
} |
| 220 |
else |
| 221 |
{ |
| 222 |
# Line is removed. |
| 223 |
} |
| 224 |
} |
| 225 |
elsif ($line =~ /(# *include )[<"]asio\/error_code\.hpp[>"]/) |
| 226 |
{ |
| 227 |
if ($is_asio_hpp) |
| 228 |
{ |
| 229 |
# Line is removed. |
| 230 |
} |
| 231 |
else |
| 232 |
{ |
| 233 |
print_line($output, $1 . "<boost/cerrno.hpp>", $from, $lineno) if ($is_error_hpp); |
| 234 |
print_line($output, $1 . "<boost/system/error_code.hpp>", $from, $lineno); |
| 235 |
} |
| 236 |
} |
| 237 |
elsif ($line =~ /# *include [<"]asio\/impl\/error_code\.[hi]pp[>"]/) |
| 238 |
{ |
| 239 |
# Line is removed. |
| 240 |
} |
| 241 |
elsif ($line =~ /(# *include )[<"]asio\/system_error\.hpp[>"]/) |
| 242 |
{ |
| 243 |
if ($is_asio_hpp) |
| 244 |
{ |
| 245 |
# Line is removed. |
| 246 |
} |
| 247 |
else |
| 248 |
{ |
| 249 |
print_line($output, $1 . "<boost/system/system_error.hpp>", $from, $lineno); |
| 250 |
} |
| 251 |
} |
| 252 |
elsif ($line =~ /(^.*# *include )[<"](asio\/[^>"]*)[>"](.*)$/) |
| 253 |
{ |
| 254 |
print_line($output, $1 . "<boost/" . $2 . ">" . $3, $from, $lineno); |
| 255 |
} |
| 256 |
elsif ($line =~ /#.*defined\(.*ASIO_HAS_STD_SYSTEM_ERROR\)$/) |
| 257 |
{ |
| 258 |
# Line is removed. |
| 259 |
} |
| 260 |
elsif ($line =~ /asio::thread\b/) |
| 261 |
{ |
| 262 |
if ($is_test) |
| 263 |
{ |
| 264 |
$line =~ s/asio::thread/asio::detail::thread/g; |
| 265 |
} |
| 266 |
else |
| 267 |
{ |
| 268 |
$line =~ s/asio::thread/boost::thread/g; |
| 269 |
} |
| 270 |
if (!($line =~ /boost::asio::/)) |
| 271 |
{ |
| 272 |
$line =~ s/asio::/boost::asio::/g; |
| 273 |
} |
| 274 |
print_line($output, $line, $from, $lineno); |
| 275 |
} |
| 276 |
elsif ($line =~ /^( *)thread( .*)$/ && !$is_qbk) |
| 277 |
{ |
| 278 |
if ($is_test) |
| 279 |
{ |
| 280 |
print_line($output, $1 . "boost::asio::detail::thread" . $2, $from, $lineno); |
| 281 |
} |
| 282 |
else |
| 283 |
{ |
| 284 |
print_line($output, $1 . "boost::thread" . $2, $from, $lineno); |
| 285 |
} |
| 286 |
} |
| 287 |
elsif ($line =~ /namespace std \{ *$/ && !$is_coroutine_related && !$is_hash_related) |
| 288 |
{ |
| 289 |
print_line($output, "namespace boost {", $from, $lineno); |
| 290 |
print_line($output, "namespace system {", $from, $lineno); |
| 291 |
} |
| 292 |
elsif ($line =~ /std::error_code/) |
| 293 |
{ |
| 294 |
$line =~ s/std::error_code/boost::system::error_code/g; |
| 295 |
$line =~ s/asio::/boost::asio::/g if !$is_xsl; |
| 296 |
print_line($output, $line, $from, $lineno); |
| 297 |
} |
| 298 |
elsif ($line =~ /std::system_error/) |
| 299 |
{ |
| 300 |
$line =~ s/std::system_error/boost::system::system_error/g; |
| 301 |
$line =~ s/asio::/boost::asio::/g if !$is_xsl; |
| 302 |
print_line($output, $line, $from, $lineno); |
| 303 |
} |
| 304 |
elsif ($line =~ /ec\.assign\(0, ec\.category\(\)\)/) |
| 305 |
{ |
| 306 |
$line =~ s/ec\.assign\(0, ec\.category\(\)\)/ec = boost::system::error_code()/g; |
| 307 |
print_line($output, $line, $from, $lineno); |
| 308 |
} |
| 309 |
elsif ($line =~ /^} \/\/ namespace std/ && !$is_coroutine_related && !$is_hash_related) |
| 310 |
{ |
| 311 |
print_line($output, "} // namespace system", $from, $lineno); |
| 312 |
print_line($output, "} // namespace boost", $from, $lineno); |
| 313 |
} |
| 314 |
elsif ($line =~ /asio::/ && !($line =~ /boost::asio::/)) |
| 315 |
{ |
| 316 |
$line =~ s/asio::error_code/boost::system::error_code/g; |
| 317 |
$line =~ s/asio::error_category/boost::system::error_category/g; |
| 318 |
$line =~ s/asio::system_category/boost::system::system_category/g; |
| 319 |
$line =~ s/asio::system_error/boost::system::system_error/g; |
| 320 |
$line =~ s/asio::/boost::asio::/g if !$is_xsl; |
| 321 |
print_line($output, $line, $from, $lineno); |
| 322 |
} |
| 323 |
elsif ($line =~ /using namespace asio/) |
| 324 |
{ |
| 325 |
$line =~ s/using namespace asio/using namespace boost::asio/g; |
| 326 |
print_line($output, $line, $from, $lineno); |
| 327 |
} |
| 328 |
elsif ($line =~ /asio_handler_alloc_helpers/) |
| 329 |
{ |
| 330 |
$line =~ s/asio_handler_alloc_helpers/boost_asio_handler_alloc_helpers/g; |
| 331 |
print_line($output, $line, $from, $lineno); |
| 332 |
} |
| 333 |
elsif ($line =~ /asio_handler_cont_helpers/) |
| 334 |
{ |
| 335 |
$line =~ s/asio_handler_cont_helpers/boost_asio_handler_cont_helpers/g; |
| 336 |
print_line($output, $line, $from, $lineno); |
| 337 |
} |
| 338 |
elsif ($line =~ /asio_handler_invoke_helpers/) |
| 339 |
{ |
| 340 |
$line =~ s/asio_handler_invoke_helpers/boost_asio_handler_invoke_helpers/g; |
| 341 |
print_line($output, $line, $from, $lineno); |
| 342 |
} |
| 343 |
elsif ($line =~ /asio_(prefer|query|require|require_concept)_fn/) |
| 344 |
{ |
| 345 |
$line =~ s/asio_(prefer|query|require|require_concept)_fn/boost_asio_$1_fn/g; |
| 346 |
print_line($output, $line, $from, $lineno); |
| 347 |
} |
| 348 |
elsif ($line =~ /asio_execution_/ && !($line =~ /_is_unspecialised/)) |
| 349 |
{ |
| 350 |
$line =~ s/asio_execution_/boost_asio_execution_/g; |
| 351 |
print_line($output, $line, $from, $lineno); |
| 352 |
} |
| 353 |
elsif ($line =~ /[\\@]ref boost_bind/) |
| 354 |
{ |
| 355 |
$line =~ s/[\\@]ref boost_bind/boost::bind()/g; |
| 356 |
print_line($output, $line, $from, $lineno); |
| 357 |
} |
| 358 |
elsif ($line =~ /( *)\[category template\]/) |
| 359 |
{ |
| 360 |
print_line($output, $1 . "[authors [Kohlhoff, Christopher]]", $from, $lineno); |
| 361 |
print_line($output, $line, $from, $lineno); |
| 362 |
} |
| 363 |
elsif ($line =~ /boostify: non-boost docs start here/) |
| 364 |
{ |
| 365 |
while ($line = <$input>) |
| 366 |
{ |
| 367 |
last if $line =~ /boostify: non-boost docs end here/; |
| 368 |
} |
| 369 |
} |
| 370 |
elsif ($line =~ /boostify: non-boost code starts here/) |
| 371 |
{ |
| 372 |
while ($line = <$input>) |
| 373 |
{ |
| 374 |
last if $line =~ /boostify: non-boost code ends here/; |
| 375 |
} |
| 376 |
} |
| 377 |
elsif ($line =~ /^$/ && $needs_doc_link) |
| 378 |
{ |
| 379 |
$needs_doc_link = 0; |
| 380 |
print_line($output, "// See www.boost.org/libs/asio for documentation.", $from, $lineno); |
| 381 |
print_line($output, "//", $from, $lineno); |
| 382 |
print_line($output, $line, $from, $lineno); |
| 383 |
} |
| 384 |
elsif ($is_quickref) |
| 385 |
{ |
| 386 |
if ($line =~ /asio\.reference\.error_code">/) |
| 387 |
{ |
| 388 |
# Line is removed. |
| 389 |
} |
| 390 |
elsif ($line =~ /asio\.reference\.system_error">/) |
| 391 |
{ |
| 392 |
# Line is removed. |
| 393 |
} |
| 394 |
elsif ($line =~ /asio\.reference\.thread">/) |
| 395 |
{ |
| 396 |
# Line is removed. |
| 397 |
} |
| 398 |
else |
| 399 |
{ |
| 400 |
print_line($output, $line, $from, $lineno); |
| 401 |
} |
| 402 |
} |
| 403 |
else |
| 404 |
{ |
| 405 |
print_line($output, $line, $from, $lineno); |
| 406 |
} |
| 407 |
++$lineno; |
| 408 |
} |
| 409 |
|
| 410 |
# Ok, we're done. |
| 411 |
close($input); |
| 412 |
close($output); |
| 413 |
} |
| 414 |
|
| 415 |
sub copy_include_files |
| 416 |
{ |
| 417 |
my @dirs = ( |
| 418 |
"include", |
| 419 |
"include/asio", |
| 420 |
"include/asio/detail", |
| 421 |
"include/asio/detail/impl", |
| 422 |
"include/asio/execution", |
| 423 |
"include/asio/execution/detail", |
| 424 |
"include/asio/execution/impl", |
| 425 |
"include/asio/experimental", |
| 426 |
"include/asio/experimental/detail", |
| 427 |
"include/asio/experimental/detail/impl", |
| 428 |
"include/asio/experimental/impl", |
| 429 |
"include/asio/generic", |
| 430 |
"include/asio/generic/detail", |
| 431 |
"include/asio/generic/detail/impl", |
| 432 |
"include/asio/impl", |
| 433 |
"include/asio/ip", |
| 434 |
"include/asio/ip/impl", |
| 435 |
"include/asio/ip/detail", |
| 436 |
"include/asio/ip/detail/impl", |
| 437 |
"include/asio/local", |
| 438 |
"include/asio/local/detail", |
| 439 |
"include/asio/local/detail/impl", |
| 440 |
"include/asio/posix", |
| 441 |
"include/asio/ssl", |
| 442 |
"include/asio/ssl/detail", |
| 443 |
"include/asio/ssl/detail/impl", |
| 444 |
"include/asio/ssl/impl", |
| 445 |
"include/asio/ssl/old", |
| 446 |
"include/asio/ssl/old/detail", |
| 447 |
"include/asio/traits", |
| 448 |
"include/asio/ts", |
| 449 |
"include/asio/windows"); |
| 450 |
|
| 451 |
foreach my $dir (@dirs) |
| 452 |
{ |
| 453 |
our $boost_dir; |
| 454 |
my @files = ( glob("$dir/*.hpp"), glob("$dir/*.ipp") ); |
| 455 |
foreach my $file (@files) |
| 456 |
{ |
| 457 |
if ($file ne "include/asio/thread.hpp" |
| 458 |
and $file ne "include/asio/error_code.hpp" |
| 459 |
and $file ne "include/asio/system_error.hpp" |
| 460 |
and $file ne "include/asio/impl/error_code.hpp" |
| 461 |
and $file ne "include/asio/impl/error_code.ipp") |
| 462 |
{ |
| 463 |
my $from = $file; |
| 464 |
my $to = $file; |
| 465 |
$to =~ s/^include\//$boost_dir\/libs\/asio\/include\/boost\//; |
| 466 |
copy_source_file($from, $to); |
| 467 |
} |
| 468 |
} |
| 469 |
} |
| 470 |
} |
| 471 |
|
| 472 |
sub create_lib_directory |
| 473 |
{ |
| 474 |
my @dirs = ( |
| 475 |
"doc", |
| 476 |
"example", |
| 477 |
"test"); |
| 478 |
|
| 479 |
our $boost_dir; |
| 480 |
foreach my $dir (@dirs) |
| 481 |
{ |
| 482 |
mkpath("$boost_dir/libs/asio/$dir"); |
| 483 |
} |
| 484 |
} |
| 485 |
|
| 486 |
sub copy_unit_tests |
| 487 |
{ |
| 488 |
my @dirs = ( |
| 489 |
"src/tests/unit", |
| 490 |
"src/tests/unit/archetypes", |
| 491 |
"src/tests/unit/execution", |
| 492 |
"src/tests/unit/experimental", |
| 493 |
"src/tests/unit/experimental/coro", |
| 494 |
"src/tests/unit/generic", |
| 495 |
"src/tests/unit/ip", |
| 496 |
"src/tests/unit/local", |
| 497 |
"src/tests/unit/posix", |
| 498 |
"src/tests/unit/ssl", |
| 499 |
"src/tests/unit/ts", |
| 500 |
"src/tests/unit/windows"); |
| 501 |
|
| 502 |
our $boost_dir; |
| 503 |
foreach my $dir (@dirs) |
| 504 |
{ |
| 505 |
my @files = ( glob("$dir/*.*pp"), glob("$dir/Jamfile*") ); |
| 506 |
foreach my $file (@files) |
| 507 |
{ |
| 508 |
if ($file ne "src/tests/unit/thread.cpp" |
| 509 |
and $file ne "src/tests/unit/error_handler.cpp" |
| 510 |
and $file ne "src/tests/unit/unit_test.cpp") |
| 511 |
{ |
| 512 |
my $from = $file; |
| 513 |
my $to = $file; |
| 514 |
$to =~ s/^src\/tests\/unit\//$boost_dir\/libs\/asio\/test\//; |
| 515 |
copy_source_file($from, $to); |
| 516 |
} |
| 517 |
} |
| 518 |
} |
| 519 |
} |
| 520 |
|
| 521 |
sub copy_latency_tests |
| 522 |
{ |
| 523 |
my @dirs = ( |
| 524 |
"src/tests/latency"); |
| 525 |
|
| 526 |
our $boost_dir; |
| 527 |
foreach my $dir (@dirs) |
| 528 |
{ |
| 529 |
my @files = ( glob("$dir/*.*pp"), glob("$dir/Jamfile*") ); |
| 530 |
foreach my $file (@files) |
| 531 |
{ |
| 532 |
my $from = $file; |
| 533 |
my $to = $file; |
| 534 |
$to =~ s/^src\/tests\/latency\//$boost_dir\/libs\/asio\/test\/latency\//; |
| 535 |
copy_source_file($from, $to); |
| 536 |
} |
| 537 |
} |
| 538 |
} |
| 539 |
|
| 540 |
sub copy_properties_tests |
| 541 |
{ |
| 542 |
my @dirs = ( |
| 543 |
"src/tests/properties/cpp03", |
| 544 |
"src/tests/properties/cpp11", |
| 545 |
"src/tests/properties/cpp14"); |
| 546 |
|
| 547 |
our $boost_dir; |
| 548 |
foreach my $dir (@dirs) |
| 549 |
{ |
| 550 |
my @files = ( glob("$dir/*.*pp"), glob("$dir/Jamfile*") ); |
| 551 |
foreach my $file (@files) |
| 552 |
{ |
| 553 |
my $from = $file; |
| 554 |
my $to = $file; |
| 555 |
$to =~ s/^src\/tests\/properties\//$boost_dir\/libs\/asio\/test\/properties\//; |
| 556 |
copy_source_file($from, $to); |
| 557 |
} |
| 558 |
} |
| 559 |
} |
| 560 |
|
| 561 |
sub copy_examples |
| 562 |
{ |
| 563 |
my @dirs = ( |
| 564 |
"src/examples/cpp11/allocation", |
| 565 |
"src/examples/cpp11/buffers", |
| 566 |
"src/examples/cpp11/chat", |
| 567 |
"src/examples/cpp11/deferred", |
| 568 |
"src/examples/cpp11/echo", |
| 569 |
"src/examples/cpp11/executors", |
| 570 |
"src/examples/cpp11/files", |
| 571 |
"src/examples/cpp11/fork", |
| 572 |
"src/examples/cpp11/futures", |
| 573 |
"src/examples/cpp11/handler_tracking", |
| 574 |
"src/examples/cpp11/http/client", |
| 575 |
"src/examples/cpp11/http/doc_root", |
| 576 |
"src/examples/cpp11/http/server", |
| 577 |
"src/examples/cpp11/http/server2", |
| 578 |
"src/examples/cpp11/http/server3", |
| 579 |
"src/examples/cpp11/http/server4", |
| 580 |
"src/examples/cpp11/icmp", |
| 581 |
"src/examples/cpp11/invocation", |
| 582 |
"src/examples/cpp11/iostreams", |
| 583 |
"src/examples/cpp11/local", |
| 584 |
"src/examples/cpp11/multicast", |
| 585 |
"src/examples/cpp11/nonblocking", |
| 586 |
"src/examples/cpp11/operations", |
| 587 |
"src/examples/cpp11/parallel_group", |
| 588 |
"src/examples/cpp11/porthopper", |
| 589 |
"src/examples/cpp11/serialization", |
| 590 |
"src/examples/cpp11/services", |
| 591 |
"src/examples/cpp11/socks4", |
| 592 |
"src/examples/cpp11/spawn", |
| 593 |
"src/examples/cpp11/ssl", |
| 594 |
"src/examples/cpp11/timeouts", |
| 595 |
"src/examples/cpp11/timers", |
| 596 |
"src/examples/cpp11/tutorial", |
| 597 |
"src/examples/cpp11/tutorial/daytime1", |
| 598 |
"src/examples/cpp11/tutorial/daytime2", |
| 599 |
"src/examples/cpp11/tutorial/daytime3", |
| 600 |
"src/examples/cpp11/tutorial/daytime4", |
| 601 |
"src/examples/cpp11/tutorial/daytime5", |
| 602 |
"src/examples/cpp11/tutorial/daytime6", |
| 603 |
"src/examples/cpp11/tutorial/daytime7", |
| 604 |
"src/examples/cpp11/tutorial/timer1", |
| 605 |
"src/examples/cpp11/tutorial/timer2", |
| 606 |
"src/examples/cpp11/tutorial/timer3", |
| 607 |
"src/examples/cpp11/tutorial/timer4", |
| 608 |
"src/examples/cpp11/tutorial/timer5", |
| 609 |
"src/examples/cpp11/type_erasure", |
| 610 |
"src/examples/cpp11/windows", |
| 611 |
"src/examples/cpp14/deferred", |
| 612 |
"src/examples/cpp14/echo", |
| 613 |
"src/examples/cpp14/executors", |
| 614 |
"src/examples/cpp14/iostreams", |
| 615 |
"src/examples/cpp14/operations", |
| 616 |
"src/examples/cpp14/parallel_group", |
| 617 |
"src/examples/cpp17/coroutines_ts", |
| 618 |
"src/examples/cpp20/channels", |
| 619 |
"src/examples/cpp20/coroutines", |
| 620 |
"src/examples/cpp20/invocation", |
| 621 |
"src/examples/cpp20/operations", |
| 622 |
"src/examples/cpp20/type_erasure"); |
| 623 |
|
| 624 |
our $boost_dir; |
| 625 |
foreach my $dir (@dirs) |
| 626 |
{ |
| 627 |
my @files = ( |
| 628 |
glob("$dir/*.*pp"), |
| 629 |
glob("$dir/*.html"), |
| 630 |
glob("$dir/Jamfile*"), |
| 631 |
glob("$dir/*.pem"), |
| 632 |
glob("$dir/README*"), |
| 633 |
glob("$dir/*.txt")); |
| 634 |
foreach my $file (@files) |
| 635 |
{ |
| 636 |
my $from = $file; |
| 637 |
my $to = $file; |
| 638 |
$to =~ s/^src\/examples\//$boost_dir\/libs\/asio\/example\//; |
| 639 |
copy_source_file($from, $to); |
| 640 |
} |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
sub copy_doc |
| 645 |
{ |
| 646 |
our $boost_dir; |
| 647 |
my @files = ( |
| 648 |
"src/doc/asio.qbk", |
| 649 |
"src/doc/examples.qbk", |
| 650 |
"src/doc/net_ts.qbk", |
| 651 |
"src/doc/overview.qbk", |
| 652 |
"src/doc/quickref.xml", |
| 653 |
"src/doc/reference.xsl", |
| 654 |
"src/doc/std_executors.qbk", |
| 655 |
"src/doc/tutorial.xsl", |
| 656 |
glob("src/doc/overview/*.qbk"), |
| 657 |
glob("src/doc/overview/model/*.qbk"), |
| 658 |
glob("src/doc/requirements/*.qbk")); |
| 659 |
foreach my $file (@files) |
| 660 |
{ |
| 661 |
my $from = $file; |
| 662 |
my $to = $file; |
| 663 |
$to =~ s/^src\/doc\//$boost_dir\/libs\/asio\/doc\//; |
| 664 |
copy_source_file($from, $to); |
| 665 |
} |
| 666 |
} |
| 667 |
|
| 668 |
sub copy_tools |
| 669 |
{ |
| 670 |
our $boost_dir; |
| 671 |
my @files = ( |
| 672 |
glob("src/tools/*.pl")); |
| 673 |
foreach my $file (@files) |
| 674 |
{ |
| 675 |
my $from = $file; |
| 676 |
my $to = $file; |
| 677 |
$to =~ s/^src\/tools\//$boost_dir\/libs\/asio\/tools\//; |
| 678 |
copy_source_file($from, $to); |
| 679 |
} |
| 680 |
} |
| 681 |
|
| 682 |
my $includes_only = 0; |
| 683 |
if (scalar(@ARGV) == 1 && $ARGV[0] eq "--includes-only") |
| 684 |
{ |
| 685 |
$includes_only = 1; |
| 686 |
} |
| 687 |
|
| 688 |
copy_include_files(); |
| 689 |
if (not $includes_only) |
| 690 |
{ |
| 691 |
create_lib_directory(); |
| 692 |
copy_unit_tests(); |
| 693 |
copy_latency_tests(); |
| 694 |
copy_properties_tests(); |
| 695 |
copy_examples(); |
| 696 |
copy_doc(); |
| 697 |
copy_tools(); |
| 698 |
} |
| 699 |
|
| 700 |
exit($bad_lines > 0 ? 1 : 0); |