|
Boost-Commit : |
From: lists.drrngrvy_at_[hidden]
Date: 2008-03-31 16:06:41
Author: drrngrvy
Date: 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
New Revision: 43974
URL: http://svn.boost.org/trac/boost/changeset/43974
Log:
Modifying jamfiles to make compiling examples easier.
Added:
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/Jamfile.v2 (contents, props changed)
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/
- copied from r43960, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/
Text files modified:
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 | 47 ++++++++++++++++++++++++---------------
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/Jamfile.v2 | 15 +++++++++---
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/amortization/Jamfile.v2 | 14 ++++++++++-
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/Jamfile.v2 | 12 ++++++---
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/main.cpp | 4 +-
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/Jamfile.v2 | 3 -
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 | 41 ++++++++++++++--------------------
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/Jamfile.v2 | 8 +-----
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/Jamfile.v2 | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/Jamfile.v2 | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/Jamfile.v2 | 12 +++++----
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp | 48 ++++++++++++++++++++++++++++-----------
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/Jamfile.v2 | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/Jamfile.v2 | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/Jamfile.v2 | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server4/Jamfile.v2 | 2
16 files changed, 129 insertions(+), 87 deletions(-)
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,32 +4,43 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-project boost.cgi.examples
- : requirements
+project boost/cgi/example
+: requirements
<library>/boost/system/
<library>/boost/thread/
;
-# Install all of the acgi examples
-install acgi
+# Build all of the cgi examples
+build-project cgi ;
+# Build all of the acgi examples
+build-project acgi ;
+# Build all of the fcgi examples
+build-project fcgi ;
+
+install cgi-install
+ : # sources
+ cgi//install
+ :
+ <location>$(cgi-bin)
+ ;
+
+install acgi-install
: # sources
acgi//install
:
<location>$(cgi-bin)
;
-explicit acgi ;
+install fcgi-install
+ :
+ fcgi//install
+ :
+ <location>$(fcgi-bin)
+ ;
+
+explicit cgi-install ;
+explicit acgi-install ;
+explicit fcgi-install ;
+
+explicit install ;
-#install examples
-# : # the sources
-# ecgi
-# acgi
-# #reply
-# : <location>/var/www/cgi-bin
-# ;
-
-#install scgi
-# : # the sources
-# scgi
-# : <location>/var/www/scgi-bin
-# ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,18 +4,25 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-project boost.cgi.examples.acgi ;
+project boost/cgi/example/acgi ;
-# Install all acgi examples to the user-provided variable "cgi-bin"
+# By default, just build the examples
+build-project hello_world ;
+build-project echo ;
+build-project cookie_game ;
+build-project amortization ;
+
+# If the user explicitly passes "install" on the command line, build the
+# CGI examples and copy them to $(cgi-bin)
install install
:
hello_world
echo
cookie_game
- login
+ amortization
:
<location>$(cgi-bin)
;
-# Only install example if you use `bjam install' or equivalent
explicit install ;
+
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/amortization/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/amortization/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/amortization/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -5,7 +5,7 @@
# at http://www.boost.org/LICENSE_1_0.txt)
# A symbolic name for this project.
-project boost.cgi.examples.acgi.amortization ;
+project boost/cgi/example/acgi/amortization ;
import os ;
@@ -30,7 +30,7 @@
;
# Our install rule (builds binaries and copies them to <location>)
-install install
+install install-app
:
acgi_amort
acgi_amort.tpl
@@ -48,5 +48,15 @@
<location>$(htdocs)
;
+explicit install-app ;
+explicit install-extra ;
+
+install install
+ :
+ install-app
+ install-extra
+ ;
+
# Only install example if you use `bjam install' or equivalent
explicit install ;
+
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,17 +4,21 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-exe acgi_form_test
- : main.cpp
+project boost/cgi/example/acgi/echo ;
+
+exe acgi_echo
+ :
+ main.cpp
/boost/regex/
/boost/thread/
;
# Our install rule (builds binaries and copies them to <location>)
install install
- : acgi_form_test
:
- <location>$(cgi-bin)
+ acgi_echo
+ :
+ <location>$(cgi-bin)
;
# Only install example if you use `bjam install' or equivalent
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/echo/main.cpp 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -23,12 +23,12 @@
// This function writes the title and map contents to the ostream in an
// HTML-encoded format (to make them easier on the eye).
-template<typename OStream, Ttypename MapT>
+template<typename OStreamT, typename MapT>
void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
{
os<< "<h3>" << title << "</h3>";
if (m.empty()) os<< "NONE<br />";
- for (typename MapT::iterator i = m.begin(); i != m.end(); ++i)
+ for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
{
os<< "<b>" << i->first << "</b> = <i>" << i->second << "</i><br />";
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,8 +4,7 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-project boost.cgi.examples.acgi.hello_world
- ;
+project boost/cgi/example/acgi/hello_world ;
exe acgi_hello_world : main.cpp /boost/regex/ ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,35 +4,28 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-import os ;
-
project boost/cgi/example/cgi
- : build-dir ../../../../bin.v2
;
-local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
-
+# By default, just build the examples
+build-project hello_world ;
+build-project echo ;
+#install stage
+# :
+# hello_world
+# echo
+# :
+# <location>$(bin-dir)
+# ;
-exe ecgi
+# If the user explicitly passes "install" on the command line, build the
+# CGI examples and copy them to $(cgi-bin)
+install install
:
- main.cpp
+ hello_world
+ echo
:
- <include>$(BOOST_ROOT)
- <include>../../../../
- <library>../../util/system//boost_system
- #<library>l:/usr/local/lib/libboost_system.a
- <define>BOOST_ALL_NO_LIB=1
- <define>_CRT_SECURE_NO_DEPRECATE=1
- <define>_SCL_SECURE_NO_WARNINGS
- <define>_CRT_SECURE_NO_WARNINGS
- <toolset>gcc:<linkflags>-lpthread
+ <location>$(cgi-bin)
;
-# uncomment this if you want to test the example on your machine
-#install _
-# : ecgi
-# : # this is where the compiled executable will be copied
-# # set this to your server's /cgi-bin/
-# <location>/var/www/cgi-bin
-# ;
-
+explicit install ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,18 +4,14 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
+project boost/cgi/example/cgi/echo ;
+
exe cgi_echo
: main.cpp
/boost/thread/
/boost/regex/
;
-local LOCATION = $(cgi-bin) ;
-if ! $(LOCATION)
-{
- LOCATION = . ;
-}
-
# Our install rule (builds binaries and copies them to <location>)
install install
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,7 +4,7 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-project boost.cgi.examples.cgi.hello_world ;
+project boost/cgi/example/cgi/hello_world ;
exe cgi_hello_world : main.cpp /boost/regex/ ;
Added: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007, 2008 Darren Garvey
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy
+# at http://www.boost.org/LICENSE_1_0.txt)
+
+project boost/cgi/example/fcgi ;
+
+# By default, just build the examples
+build-project hello_world ;
+build-project echo ;
+build-project server1 ;
+build-project server2 ;
+build-project server3 ;
+
+# If the user explicitly passes "install" on the command line, build the
+# FastCGI examples and copy them to $(fcgi-bin)
+install install
+ :
+ hello_world
+ echo
+ server1
+ server2
+ server3
+ :
+ <location>$(fcgi-bin)
+ ;
+
+explicit install ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
-project cgi.examples.fcgi.echo ;
+project boost/cgi/example/fcgi/echo ;
exe fcgi_echo : main.cpp ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/Jamfile.v2
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -4,16 +4,18 @@
# (See accompanying file LICENSE_1_0.txt or copy
# at http://www.boost.org/LICENSE_1_0.txt)
-project boost.cgi.examples.acgi.hello_world
- ;
+project boost/cgi/example/fcgi/hello_world ;
-exe acgi_hello_world : main.cpp /boost/regex/ ;
+exe fcgi_hello_world : main.cpp /boost/regex/ ;
# Our install rule (builds binaries and copies them to <location>)
install install
- : acgi_hello_world
- : <location>$(cgi-bin)
+ :
+ fcgi_hello_world
+ :
+ <location>$(fcgi-bin)
;
# Only install example if you use `bjam install' or equivalent
explicit install ;
+
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -7,30 +7,50 @@
//
////////////////////////////////////////////////////////////////
//
-//[acgi_hello_world
+//[fcgi_hello_world
//
-// The simplest CGI program, outputs only "Hello there, universe."
+// The simplest FastCGI program, outputs only "Hello there, universe."
//
-#include <boost/cgi/acgi.hpp>
-#include <boost/cgi/return.hpp>
+#include <boost/cgi/fcgi.hpp>
using namespace std;
-using namespace boost::acgi;
+using namespace boost::fcgi;
int main()
{
+try
+{
service s; // This becomes useful with async operations.
- request req(s); // Our request (POST data won't be parsed yet).
- response resp; // A response object to make our lives easier.
-
- // This is a minimal response. The content_type(...) may go before or after
- // the response text.
- resp<< content_type("text/html")
- << "Hello there, universe.";
+ acceptor a(s); // This is used to accept requests from the server.
+ request req(s); // Our request.
- // Leave this function, after sending the response and closing the request.
- return_(resp, req, 0); // Note the underscore: returns "0" to the OS.
+ for (int i(50); i != 0; --i) // Handle 50 requests then exit.
+ {
+ a.accept(req);
+ response resp; // A response object to make our lives easier.
+
+ // This is a minimal response. The content_type(...) may go before or after
+ // the response text.
+ resp<< content_type("text/plain")
+ << "Hello there, universe.";
+
+ resp.send(req.client()); // Send the response.
+ req.close(resp.status()); // Close the request (we can reuse this object now).
+ }
+ return 0;
+}
+catch(boost::system::system_error& err)
+{
+ std::cerr<< "System error " << err.code() << ": "
+ << err.what() << std::endl;
+ return 1;
+}
+catch(...)
+{
+ std::cerr<< "Unknown error!" << std::endl;
+ return 2;
+}
}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
-project cgi.examples.fcgi.sync_server ;
+project boost/cgi/example/fcgi/server1 ;
exe fcgi_server1 : main.cpp ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
-project cgi.examples.fcgi.server2 ;
+project boost/cgi/example/fcgi/server2 ;
exe fcgi_server2 : main.cpp ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
-project cgi.examples.fcgi.server3 ;
+project boost/cgi/example/fcgi/server3 ;
exe fcgi_server3 : main.cpp ;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server4/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server4/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server4/Jamfile.v2 2008-03-31 16:06:39 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
-project cgi.examples.fcgi.server4 ;
+project boost/cgi/example/fcgi/server4 ;
exe fcgi_server4 : main.cpp ;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk