Skip to content

Commit

Permalink
Migrate remaining c++03 examples to c++11.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskohlhoff committed Dec 6, 2023
1 parent 79e2ba7 commit 6ebe3c0
Show file tree
Hide file tree
Showing 214 changed files with 1,534 additions and 8,531 deletions.
70 changes: 30 additions & 40 deletions asio/boostify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ sub copy_source_file
$line =~ s/asio::/boost::asio::/g if !$is_xsl;
print_line($output, $line, $from, $lineno);
}
elsif ($line =~ /std::system_error/)
{
$line =~ s/std::system_error/boost::system::system_error/g;
$line =~ s/asio::/boost::asio::/g if !$is_xsl;
print_line($output, $line, $from, $lineno);
}
elsif ($line =~ /ec\.assign\(0, ec\.category\(\)\)/)
{
$line =~ s/ec\.assign\(0, ec\.category\(\)\)/ec = boost::system::error_code()/g;
Expand Down Expand Up @@ -555,69 +561,53 @@ sub copy_properties_tests
sub copy_examples
{
my @dirs = (
"src/examples/cpp03/allocation",
"src/examples/cpp03/buffers",
"src/examples/cpp03/chat",
"src/examples/cpp03/echo",
"src/examples/cpp03/fork",
"src/examples/cpp03/http/client",
"src/examples/cpp03/http/doc_root",
"src/examples/cpp03/http/server",
"src/examples/cpp03/http/server2",
"src/examples/cpp03/http/server3",
"src/examples/cpp03/http/server4",
"src/examples/cpp03/icmp",
"src/examples/cpp03/invocation",
"src/examples/cpp03/iostreams",
"src/examples/cpp03/local",
"src/examples/cpp03/multicast",
"src/examples/cpp03/nonblocking",
"src/examples/cpp03/porthopper",
"src/examples/cpp03/serialization",
"src/examples/cpp03/services",
"src/examples/cpp03/socks4",
"src/examples/cpp03/spawn",
"src/examples/cpp03/ssl",
"src/examples/cpp03/timeouts",
"src/examples/cpp03/timers",
"src/examples/cpp03/tutorial",
"src/examples/cpp03/tutorial/daytime1",
"src/examples/cpp03/tutorial/daytime2",
"src/examples/cpp03/tutorial/daytime3",
"src/examples/cpp03/tutorial/daytime4",
"src/examples/cpp03/tutorial/daytime5",
"src/examples/cpp03/tutorial/daytime6",
"src/examples/cpp03/tutorial/daytime7",
"src/examples/cpp03/tutorial/timer1",
"src/examples/cpp03/tutorial/timer2",
"src/examples/cpp03/tutorial/timer3",
"src/examples/cpp03/tutorial/timer4",
"src/examples/cpp03/tutorial/timer5",
"src/examples/cpp03/windows",
"src/examples/cpp11/allocation",
"src/examples/cpp11/buffers",
"src/examples/cpp11/chat",
"src/examples/cpp11/deferred",
"src/examples/cpp11/echo",
"src/examples/cpp11/executors",
"src/examples/cpp11/fork",
"src/examples/cpp11/files",
"src/examples/cpp11/fork",
"src/examples/cpp11/futures",
"src/examples/cpp11/handler_tracking",
"src/examples/cpp11/http/client",
"src/examples/cpp11/http/doc_root",
"src/examples/cpp11/http/server",
"src/examples/cpp11/http/server2",
"src/examples/cpp11/http/server3",
"src/examples/cpp11/http/server4",
"src/examples/cpp11/icmp",
"src/examples/cpp11/invocation",
"src/examples/cpp11/iostreams",
"src/examples/cpp11/local",
"src/examples/cpp11/multicast",
"src/examples/cpp11/nonblocking",
"src/examples/cpp11/operations",
"src/examples/cpp11/parallel_group",
"src/examples/cpp11/porthopper",
"src/examples/cpp11/serialization",
"src/examples/cpp11/services",
"src/examples/cpp11/socks4",
"src/examples/cpp11/spawn",
"src/examples/cpp11/ssl",
"src/examples/cpp11/timeouts",
"src/examples/cpp11/timers",
"src/examples/cpp11/tutorial",
"src/examples/cpp11/tutorial/daytime1",
"src/examples/cpp11/tutorial/daytime2",
"src/examples/cpp11/tutorial/daytime3",
"src/examples/cpp11/tutorial/daytime4",
"src/examples/cpp11/tutorial/daytime5",
"src/examples/cpp11/tutorial/daytime6",
"src/examples/cpp11/tutorial/daytime7",
"src/examples/cpp11/tutorial/timer1",
"src/examples/cpp11/tutorial/timer2",
"src/examples/cpp11/tutorial/timer3",
"src/examples/cpp11/tutorial/timer4",
"src/examples/cpp11/tutorial/timer5",
"src/examples/cpp11/type_erasure",
"src/examples/cpp11/windows",
"src/examples/cpp14/deferred",
"src/examples/cpp14/echo",
"src/examples/cpp14/executors",
Expand Down
1 change: 0 additions & 1 deletion asio/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ AC_OUTPUT([
src/Makefile
src/tests/Makefile
src/tests/properties/Makefile
src/examples/cpp03/Makefile
src/examples/cpp11/Makefile
src/examples/cpp14/Makefile
src/examples/cpp17/Makefile
Expand Down
22 changes: 0 additions & 22 deletions asio/release.pl
Original file line number Diff line number Diff line change
Expand Up @@ -201,27 +201,6 @@ sub build_asio_doc
system("cp -vR src/doc/html/* doc");
}

sub build_example_diffs
{
my @cpp11_files = `find src/examples/cpp11 -type f -name "*.*pp"`;
foreach my $cpp11_file (@cpp11_files)
{
chomp($cpp11_file);

my $cpp03_file = $cpp11_file;
$cpp03_file =~ s/\/cpp11\//\/cpp03\//;
my $output_diff = $cpp11_file;
$output_diff =~ s/src\/examples\/cpp11\///g;
my ($output_diff_name, $output_dir) = fileparse($output_diff);
my $output_html = $output_diff . ".html";

mkpath("doc/examples/diffs/$output_dir");
system("diff -U1000000 $cpp03_file $cpp11_file > doc/examples/diffs/$output_diff");
system("cd doc/examples/diffs && diff2html.py -i $output_diff -o $output_html");
unlink("doc/examples/diffs/$output_diff");
}
}

sub make_asio_packages
{
our $asio_name;
Expand Down Expand Up @@ -428,7 +407,6 @@ sub make_boost_asio_packages
if ($package_asio)
{
build_asio_doc();
build_example_diffs();
make_asio_packages();
}

Expand Down
6 changes: 0 additions & 6 deletions asio/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if !STANDALONE
EXAMPLES_CPP03 = examples/cpp03
endif

if HAVE_CXX11
EXAMPLES_CPP11 = examples/cpp11
endif
Expand All @@ -19,15 +15,13 @@ EXAMPLES_CPP20 = examples/cpp20
endif

SUBDIRS = \
$(EXAMPLES_CPP03) \
$(EXAMPLES_CPP11) \
$(EXAMPLES_CPP14) \
$(EXAMPLES_CPP17) \
$(EXAMPLES_CPP20) \
tests

DIST_SUBDIRS = \
examples/cpp03 \
examples/cpp11 \
examples/cpp14 \
examples/cpp17 \
Expand Down
154 changes: 77 additions & 77 deletions asio/src/Makefile.mgw
Original file line number Diff line number Diff line change
Expand Up @@ -162,54 +162,54 @@ UNIT_TEST_EXES = \
tests/unit/write.exe \
tests/unit/write_at.exe

CPP03_EXAMPLE_EXES = \
examples/cpp03/allocation/server.exe \
examples/cpp03/buffers/reference_counted.exe \
examples/cpp03/chat/chat_client.exe \
examples/cpp03/chat/chat_server.exe \
examples/cpp03/echo/async_tcp_echo_server.exe \
examples/cpp03/echo/async_udp_echo_server.exe \
examples/cpp03/echo/blocking_tcp_echo_client.exe \
examples/cpp03/echo/blocking_tcp_echo_server.exe \
examples/cpp03/echo/blocking_udp_echo_client.exe \
examples/cpp03/echo/blocking_udp_echo_server.exe \
examples/cpp03/http/client/async_client.exe \
examples/cpp03/http/client/sync_client.exe \
examples/cpp03/http/server/http_server.exe \
examples/cpp03/http/server2/http_server.exe \
examples/cpp03/http/server3/http_server.exe \
examples/cpp03/http/server4/http_server.exe \
examples/cpp03/icmp/ping.exe \
examples/cpp03/invocation/prioritised_handlers.exe \
examples/cpp03/iostreams/daytime_client.exe \
examples/cpp03/iostreams/daytime_server.exe \
examples/cpp03/iostreams/http_client.exe \
examples/cpp03/multicast/receiver.exe \
examples/cpp03/multicast/sender.exe \
examples/cpp03/nonblocking/third_party_lib.exe \
examples/cpp03/porthopper/client.exe \
examples/cpp03/porthopper/server.exe \
examples/cpp03/services/daytime_client.exe \
examples/cpp03/socks4/sync_client.exe \
examples/cpp03/timeouts/async_tcp_client.exe \
examples/cpp03/timeouts/blocking_tcp_client.exe \
examples/cpp03/timeouts/blocking_token_tcp_client.exe \
examples/cpp03/timeouts/blocking_udp_client.exe \
examples/cpp03/timeouts/server.exe \
examples/cpp03/timers/time_t_timer.exe \
examples/cpp03/tutorial/timer1/timer.exe \
examples/cpp03/tutorial/timer2/timer.exe \
examples/cpp03/tutorial/timer3/timer.exe \
examples/cpp03/tutorial/timer4/timer.exe \
examples/cpp03/tutorial/timer5/timer.exe \
examples/cpp03/tutorial/daytime1/client.exe \
examples/cpp03/tutorial/daytime2/server.exe \
examples/cpp03/tutorial/daytime3/server.exe \
examples/cpp03/tutorial/daytime4/client.exe \
examples/cpp03/tutorial/daytime5/server.exe \
examples/cpp03/tutorial/daytime6/server.exe \
examples/cpp03/tutorial/daytime7/server.exe \
examples/cpp03/windows/transmit_file.exe
CPP11_EXAMPLE_EXES = \
examples/cpp11/allocation/server.exe \
examples/cpp11/buffers/reference_counted.exe \
examples/cpp11/chat/chat_client.exe \
examples/cpp11/chat/chat_server.exe \
examples/cpp11/echo/async_tcp_echo_server.exe \
examples/cpp11/echo/async_udp_echo_server.exe \
examples/cpp11/echo/blocking_tcp_echo_client.exe \
examples/cpp11/echo/blocking_tcp_echo_server.exe \
examples/cpp11/echo/blocking_udp_echo_client.exe \
examples/cpp11/echo/blocking_udp_echo_server.exe \
examples/cpp11/http/client/async_client.exe \
examples/cpp11/http/client/sync_client.exe \
examples/cpp11/http/server/http_server.exe \
examples/cpp11/http/server2/http_server.exe \
examples/cpp11/http/server3/http_server.exe \
examples/cpp11/http/server4/http_server.exe \
examples/cpp11/icmp/ping.exe \
examples/cpp11/invocation/prioritised_handlers.exe \
examples/cpp11/iostreams/daytime_client.exe \
examples/cpp11/iostreams/daytime_server.exe \
examples/cpp11/iostreams/http_client.exe \
examples/cpp11/multicast/receiver.exe \
examples/cpp11/multicast/sender.exe \
examples/cpp11/nonblocking/third_party_lib.exe \
examples/cpp11/porthopper/client.exe \
examples/cpp11/porthopper/server.exe \
examples/cpp11/services/daytime_client.exe \
examples/cpp11/socks4/sync_client.exe \
examples/cpp11/timeouts/async_tcp_client.exe \
examples/cpp11/timeouts/blocking_tcp_client.exe \
examples/cpp11/timeouts/blocking_token_tcp_client.exe \
examples/cpp11/timeouts/blocking_udp_client.exe \
examples/cpp11/timeouts/server.exe \
examples/cpp11/timers/time_t_timer.exe \
examples/cpp11/tutorial/timer1/timer.exe \
examples/cpp11/tutorial/timer2/timer.exe \
examples/cpp11/tutorial/timer3/timer.exe \
examples/cpp11/tutorial/timer4/timer.exe \
examples/cpp11/tutorial/timer5/timer.exe \
examples/cpp11/tutorial/daytime1/client.exe \
examples/cpp11/tutorial/daytime2/server.exe \
examples/cpp11/tutorial/daytime3/server.exe \
examples/cpp11/tutorial/daytime4/client.exe \
examples/cpp11/tutorial/daytime5/server.exe \
examples/cpp11/tutorial/daytime6/server.exe \
examples/cpp11/tutorial/daytime7/server.exe \
examples/cpp11/windows/transmit_file.exe

ifdef STANDALONE
all: \
Expand Down Expand Up @@ -249,41 +249,41 @@ $(UNIT_TEST_EXES): %.exe: %.o
$(PERFORMANCE_TEST_EXES) $(EXAMPLE_EXES): %.exe: %.o
g++ -o$@ $(LDFLAGS) $< $(LIBS)

examples/cpp03/http/server/http_server.exe: \
examples/cpp03/http/server/connection.o \
examples/cpp03/http/server/connection_manager.o \
examples/cpp03/http/server/main.o \
examples/cpp03/http/server/mime_types.o \
examples/cpp03/http/server/reply.o \
examples/cpp03/http/server/request_handler.o \
examples/cpp03/http/server/request_parser.o \
examples/cpp03/http/server/server.o
examples/cpp11/http/server/http_server.exe: \
examples/cpp11/http/server/connection.o \
examples/cpp11/http/server/connection_manager.o \
examples/cpp11/http/server/main.o \
examples/cpp11/http/server/mime_types.o \
examples/cpp11/http/server/reply.o \
examples/cpp11/http/server/request_handler.o \
examples/cpp11/http/server/request_parser.o \
examples/cpp11/http/server/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)

examples/cpp03/http/server2/http_server.exe: \
examples/cpp03/http/server2/connection.o \
examples/cpp03/http/server2/io_context_pool.o \
examples/cpp03/http/server2/main.o \
examples/cpp03/http/server2/mime_types.o \
examples/cpp03/http/server2/reply.o \
examples/cpp03/http/server2/request_handler.o \
examples/cpp03/http/server2/request_parser.o \
examples/cpp03/http/server2/server.o
examples/cpp11/http/server2/http_server.exe: \
examples/cpp11/http/server2/connection.o \
examples/cpp11/http/server2/io_context_pool.o \
examples/cpp11/http/server2/main.o \
examples/cpp11/http/server2/mime_types.o \
examples/cpp11/http/server2/reply.o \
examples/cpp11/http/server2/request_handler.o \
examples/cpp11/http/server2/request_parser.o \
examples/cpp11/http/server2/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)

examples/cpp03/http/server3/http_server.exe: \
examples/cpp03/http/server3/connection.o \
examples/cpp03/http/server3/main.o \
examples/cpp03/http/server3/mime_types.o \
examples/cpp03/http/server3/reply.o \
examples/cpp03/http/server3/request_handler.o \
examples/cpp03/http/server3/request_parser.o \
examples/cpp03/http/server3/server.o
examples/cpp11/http/server3/http_server.exe: \
examples/cpp11/http/server3/connection.o \
examples/cpp11/http/server3/main.o \
examples/cpp11/http/server3/mime_types.o \
examples/cpp11/http/server3/reply.o \
examples/cpp11/http/server3/request_handler.o \
examples/cpp11/http/server3/request_parser.o \
examples/cpp11/http/server3/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)

examples/cpp03/services/daytime_client.exe: \
examples/cpp03/services/daytime_client.o \
examples/cpp03/services/logger_service.o
examples/cpp11/services/daytime_client.exe: \
examples/cpp11/services/daytime_client.o \
examples/cpp11/services/logger_service.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)

.cpp.o:
Expand Down
Loading

0 comments on commit 6ebe3c0

Please sign in to comment.