$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r66044 - in sandbox/chrono/libs/system: . build src test
From: vicente.botet_at_[hidden]
Date: 2010-10-17 15:44:24
Author: viboes
Date: 2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
New Revision: 66044
URL: http://svn.boost.org/trac/boost/changeset/66044
Log:
Chrono: Implementation of header only Boost.System
Added:
   sandbox/chrono/libs/system/
   sandbox/chrono/libs/system/build/
   sandbox/chrono/libs/system/build/Jamfile.v2   (contents, props changed)
   sandbox/chrono/libs/system/src/
   sandbox/chrono/libs/system/src/error_code.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/
   sandbox/chrono/libs/system/test/Jamfile.v2   (contents, props changed)
   sandbox/chrono/libs/system/test/dynamic_link_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/error_code_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/error_code_user_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/header_only_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/initialization_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/system_error_test.cpp   (contents, props changed)
   sandbox/chrono/libs/system/test/throw_test.cpp   (contents, props changed)
Added: sandbox/chrono/libs/system/build/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/build/Jamfile.v2	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,27 @@
+# Boost System Library Build Jamfile
+
+# (C) Copyright Beman Dawes 2002, 2006
+
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or www.boost.org/LICENSE_1_0.txt)
+
+# See library home page at http://www.boost.org/libs/system
+
+project boost/system
+    : source-location ../src
+    : usage-requirements  # pass these requirement to dependents (i.e. users)
+      <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
+      <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
+      <define>BOOST_USE_WINDOWS_H
+    ;
+
+SOURCES = error_code ;
+
+lib boost_system
+   : $(SOURCES).cpp
+   : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
+     <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
+     <define>BOOST_USE_WINDOWS_H
+   ;
+
+boost-install boost_system ;
\ No newline at end of file
Added: sandbox/chrono/libs/system/src/error_code.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/src/error_code.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,432 @@
+//  error_code support implementation file  ----------------------------------//
+
+//  Copyright Beman Dawes 2002, 2006
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//----------------------------------------------------------------------------//
+#if 1
+#define BOOST_SYSTEM_SOURCE 
+#include <boost/system/detail/inlined/error_code.hpp>
+
+#else
+#include <boost/config/warning_disable.hpp>
+
+// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_SYSTEM_SOURCE 
+
+#include <boost/system/config.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/cerrno.hpp>
+#include <vector>
+#include <cstdlib>
+#include <cassert>
+
+using namespace boost::system;
+using namespace boost::system::errc;
+
+#include <cstring> // for strerror/strerror_r
+
+# if defined( BOOST_WINDOWS_API )
+#   include <windows.h>
+#   include "local_free_on_destruction.hpp"
+#   ifndef ERROR_INCORRECT_SIZE
+#     define ERROR_INCORRECT_SIZE ERROR_BAD_ARGUMENTS
+#   endif
+# endif
+
+//----------------------------------------------------------------------------//
+
+namespace
+{
+  //  standard error categories  ---------------------------------------------//
+
+  class generic_error_category : public error_category
+  {
+  public:
+    generic_error_category(){}
+    const char *   name() const;
+    std::string    message( int ev ) const;
+  };
+
+  class system_error_category : public error_category
+  {
+  public:
+    system_error_category(){}
+    const char *        name() const;
+    std::string         message( int ev ) const;
+    error_condition     default_error_condition( int ev ) const;
+  };
+
+  //  generic_error_category implementation  ---------------------------------//
+
+  const char * generic_error_category::name() const
+  {
+    return "generic";
+  }
+
+  std::string generic_error_category::message( int ev ) const
+  {
+    static std::string unknown_err( "Unknown error" );
+  // strerror_r is preferred because it is always thread safe,
+  // however, we fallback to strerror in certain cases because:
+  //   -- Windows doesn't provide strerror_r.
+  //   -- HP and Sundo provide strerror_r on newer systems, but there is
+  //      no way to tell if is available at runtime and in any case their
+  //      versions of strerror are thread safe anyhow.
+  //   -- Linux only sometimes provides strerror_r.
+  //   -- Tru64 provides strerror_r only when compiled -pthread.
+  //   -- VMS doesn't provide strerror_r, but on this platform, strerror is
+  //      thread safe.
+  # if defined(BOOST_SYSTEM_WINDOWS_API) || defined(__hpux) || defined(__sun)\
+     || (defined(__linux) && (!defined(__USE_XOPEN2K) || defined(BOOST_SYSTEM_USE_STRERROR)))\
+     || (defined(__osf__) && !defined(_REENTRANT))\
+     || (defined(__vms))\
+     || (defined(__QNXNTO__))
+      const char * c_str = std::strerror( ev );
+      return  c_str
+        ? std::string( c_str )
+        : unknown_err;
+  # else  // use strerror_r
+      char buf[64];
+      char * bp = buf;
+      std::size_t sz = sizeof(buf);
+  #  if defined(__CYGWIN__) || defined(__USE_GNU)
+      // Oddball version of strerror_r
+      const char * c_str = strerror_r( ev, bp, sz );
+      return  c_str
+        ? std::string( c_str )
+        : unknown_err;
+  #  else
+      // POSIX version of strerror_r
+      int result;
+      for (;;)
+      {
+        // strerror_r returns 0 on success, otherwise ERANGE if buffer too small,
+        // invalid_argument if ev not a valid error number
+  #  if defined (__sgi)
+        const char * c_str = strerror( ev );
+        result = 0;
+      return  c_str
+        ? std::string( c_str )
+        : unknown_err;
+  #  else
+        result = strerror_r( ev, bp, sz );
+  #  endif
+        if (result == 0 )
+          break;
+        else
+        {
+  #  if defined(__linux)
+          // Linux strerror_r returns -1 on error, with error number in errno
+          result = errno;
+  #  endif
+          if ( result !=  ERANGE ) break;
+          if ( sz > sizeof(buf) ) std::free( bp );
+          sz *= 2;
+          if ( (bp = static_cast<char*>(std::malloc( sz ))) == 0 )
+            return std::string( "ENOMEM" );
+        }
+      }
+      std::string msg;
+      try
+      {
+        msg = ( ( result == invalid_argument ) ? "Unknown error" : bp );
+      }
+
+#   ifndef BOOST_NO_EXCEPTIONS
+      // See ticket #2098
+      catch(...)
+      {
+        // just eat the exception
+      }
+#   endif
+
+      if ( sz > sizeof(buf) ) std::free( bp );
+      sz = 0;
+      return msg;
+  #  endif   // else POSIX version of strerror_r
+  # endif  // else use strerror_r
+  }
+  //  system_error_category implementation  --------------------------------// 
+
+  const char * system_error_category::name() const
+  {
+    return "system";
+  }
+
+  error_condition system_error_category::default_error_condition( int ev ) const
+  {
+    switch ( ev )
+    {
+    case 0: return make_error_condition( success );
+# if defined(BOOST_POSIX_API)
+    // POSIX-like O/S -> posix_errno decode table  ---------------------------//
+    case E2BIG: return make_error_condition( argument_list_too_long );
+    case EACCES: return make_error_condition( permission_denied );
+    case EADDRINUSE: return make_error_condition( address_in_use );
+    case EADDRNOTAVAIL: return make_error_condition( address_not_available );
+    case EAFNOSUPPORT: return make_error_condition( address_family_not_supported );
+    case EAGAIN: return make_error_condition( resource_unavailable_try_again );
+#   if EALREADY != EBUSY  //  EALREADY and EBUSY are the same on QNX Neutrino
+    case EALREADY: return make_error_condition( connection_already_in_progress );
+#   endif
+    case EBADF: return make_error_condition( bad_file_descriptor );
+    case EBADMSG: return make_error_condition( bad_message );
+    case EBUSY: return make_error_condition( device_or_resource_busy );
+    case ECANCELED: return make_error_condition( operation_canceled );
+    case ECHILD: return make_error_condition( no_child_process );
+    case ECONNABORTED: return make_error_condition( connection_aborted );
+    case ECONNREFUSED: return make_error_condition( connection_refused );
+    case ECONNRESET: return make_error_condition( connection_reset );
+    case EDEADLK: return make_error_condition( resource_deadlock_would_occur );
+    case EDESTADDRREQ: return make_error_condition( destination_address_required );
+    case EDOM: return make_error_condition( argument_out_of_domain );
+    case EEXIST: return make_error_condition( file_exists );
+    case EFAULT: return make_error_condition( bad_address );
+    case EFBIG: return make_error_condition( file_too_large );
+    case EHOSTUNREACH: return make_error_condition( host_unreachable );
+    case EIDRM: return make_error_condition( identifier_removed );
+    case EILSEQ: return make_error_condition( illegal_byte_sequence );
+    case EINPROGRESS: return make_error_condition( operation_in_progress );
+    case EINTR: return make_error_condition( interrupted );
+    case EINVAL: return make_error_condition( invalid_argument );
+    case EIO: return make_error_condition( io_error );
+    case EISCONN: return make_error_condition( already_connected );
+    case EISDIR: return make_error_condition( is_a_directory );
+    case ELOOP: return make_error_condition( too_many_symbolic_link_levels );
+    case EMFILE: return make_error_condition( too_many_files_open );
+    case EMLINK: return make_error_condition( too_many_links );
+    case EMSGSIZE: return make_error_condition( message_size );
+    case ENAMETOOLONG: return make_error_condition( filename_too_long );
+    case ENETDOWN: return make_error_condition( network_down );
+    case ENETRESET: return make_error_condition( network_reset );
+    case ENETUNREACH: return make_error_condition( network_unreachable );
+    case ENFILE: return make_error_condition( too_many_files_open_in_system );
+    case ENOBUFS: return make_error_condition( no_buffer_space );
+    case ENODATA: return make_error_condition( no_message_available );
+    case ENODEV: return make_error_condition( no_such_device );
+    case ENOENT: return make_error_condition( no_such_file_or_directory );
+    case ENOEXEC: return make_error_condition( executable_format_error );
+    case ENOLCK: return make_error_condition( no_lock_available );
+    case ENOLINK: return make_error_condition( no_link );
+    case ENOMEM: return make_error_condition( not_enough_memory );
+    case ENOMSG: return make_error_condition( no_message );
+    case ENOPROTOOPT: return make_error_condition( no_protocol_option );
+    case ENOSPC: return make_error_condition( no_space_on_device );
+    case ENOSR: return make_error_condition( no_stream_resources );
+    case ENOSTR: return make_error_condition( not_a_stream );
+    case ENOSYS: return make_error_condition( function_not_supported );
+    case ENOTCONN: return make_error_condition( not_connected );
+    case ENOTDIR: return make_error_condition( not_a_directory );
+  # if ENOTEMPTY != EEXIST // AIX treats ENOTEMPTY and EEXIST as the same value
+    case ENOTEMPTY: return make_error_condition( directory_not_empty );
+  # endif // ENOTEMPTY != EEXIST
+  # if ENOTRECOVERABLE != ECONNRESET // the same on some Broadcom chips 
+    case ENOTRECOVERABLE: return make_error_condition( state_not_recoverable ); 
+  # endif // ENOTRECOVERABLE != ECONNRESET 
+    case ENOTSOCK: return make_error_condition( not_a_socket );
+    case ENOTSUP: return make_error_condition( not_supported );
+    case ENOTTY: return make_error_condition( inappropriate_io_control_operation );
+    case ENXIO: return make_error_condition( no_such_device_or_address );
+  # if EOPNOTSUPP != ENOTSUP
+    case EOPNOTSUPP: return make_error_condition( operation_not_supported );
+  # endif // EOPNOTSUPP != ENOTSUP
+    case EOVERFLOW: return make_error_condition( value_too_large );
+  # if EOWNERDEAD != ECONNABORTED // the same on some Broadcom chips 
+    case EOWNERDEAD: return make_error_condition( owner_dead ); 
+  # endif // EOWNERDEAD != ECONNABORTED 
+    case EPERM: return make_error_condition( operation_not_permitted );
+    case EPIPE: return make_error_condition( broken_pipe );
+    case EPROTO: return make_error_condition( protocol_error );
+    case EPROTONOSUPPORT: return make_error_condition( protocol_not_supported );
+    case EPROTOTYPE: return make_error_condition( wrong_protocol_type );
+    case ERANGE: return make_error_condition( result_out_of_range );
+    case EROFS: return make_error_condition( read_only_file_system );
+    case ESPIPE: return make_error_condition( invalid_seek );
+    case ESRCH: return make_error_condition( no_such_process );
+    case ETIME: return make_error_condition( stream_timeout );
+    case ETIMEDOUT: return make_error_condition( timed_out );
+    case ETXTBSY: return make_error_condition( text_file_busy );
+  # if EAGAIN != EWOULDBLOCK
+    case EWOULDBLOCK: return make_error_condition( operation_would_block );
+  # endif // EAGAIN != EWOULDBLOCK
+    case EXDEV: return make_error_condition( cross_device_link );
+  #else
+    // Windows system -> posix_errno decode table  ---------------------------//
+    // see WinError.h comments for descriptions of errors
+    case ERROR_ACCESS_DENIED: return make_error_condition( permission_denied );
+    case ERROR_ALREADY_EXISTS: return make_error_condition( file_exists );
+    case ERROR_BAD_UNIT: return make_error_condition( no_such_device );
+    case ERROR_BUFFER_OVERFLOW: return make_error_condition( filename_too_long );
+    case ERROR_BUSY: return make_error_condition( device_or_resource_busy );
+    case ERROR_BUSY_DRIVE: return make_error_condition( device_or_resource_busy );
+    case ERROR_CANNOT_MAKE: return make_error_condition( permission_denied );
+    case ERROR_CANTOPEN: return make_error_condition( io_error );
+    case ERROR_CANTREAD: return make_error_condition( io_error );
+    case ERROR_CANTWRITE: return make_error_condition( io_error );
+    case ERROR_CURRENT_DIRECTORY: return make_error_condition( permission_denied );
+    case ERROR_DEV_NOT_EXIST: return make_error_condition( no_such_device );
+    case ERROR_DEVICE_IN_USE: return make_error_condition( device_or_resource_busy );
+    case ERROR_DIR_NOT_EMPTY: return make_error_condition( directory_not_empty );
+    case ERROR_DIRECTORY: return make_error_condition( invalid_argument ); // WinError.h: "The directory name is invalid"
+    case ERROR_DISK_FULL: return make_error_condition( no_space_on_device );
+    case ERROR_FILE_EXISTS: return make_error_condition( file_exists );
+    case ERROR_FILE_NOT_FOUND: return make_error_condition( no_such_file_or_directory );
+    case ERROR_HANDLE_DISK_FULL: return make_error_condition( no_space_on_device );
+    case ERROR_INVALID_ACCESS: return make_error_condition( permission_denied );
+    case ERROR_INVALID_DRIVE: return make_error_condition( no_such_device );
+    case ERROR_INVALID_FUNCTION: return make_error_condition( function_not_supported );
+    case ERROR_INVALID_HANDLE: return make_error_condition( invalid_argument );
+    case ERROR_INVALID_NAME: return make_error_condition( invalid_argument );
+    case ERROR_LOCK_VIOLATION: return make_error_condition( no_lock_available );
+    case ERROR_LOCKED: return make_error_condition( no_lock_available );
+    case ERROR_NEGATIVE_SEEK: return make_error_condition( invalid_argument );
+    case ERROR_NOACCESS: return make_error_condition( permission_denied );
+    case ERROR_NOT_ENOUGH_MEMORY: return make_error_condition( not_enough_memory );
+    case ERROR_NOT_READY: return make_error_condition( resource_unavailable_try_again );
+    case ERROR_NOT_SAME_DEVICE: return make_error_condition( cross_device_link );
+    case ERROR_OPEN_FAILED: return make_error_condition( io_error );
+    case ERROR_OPEN_FILES: return make_error_condition( device_or_resource_busy );
+    case ERROR_OPERATION_ABORTED: return make_error_condition( operation_canceled );
+    case ERROR_OUTOFMEMORY: return make_error_condition( not_enough_memory );
+    case ERROR_PATH_NOT_FOUND: return make_error_condition( no_such_file_or_directory );
+    case ERROR_READ_FAULT: return make_error_condition( io_error );
+    case ERROR_RETRY: return make_error_condition( resource_unavailable_try_again );
+    case ERROR_SEEK: return make_error_condition( io_error );
+    case ERROR_SHARING_VIOLATION: return make_error_condition( permission_denied );
+    case ERROR_TOO_MANY_OPEN_FILES: return make_error_condition( too_many_files_open );
+    case ERROR_WRITE_FAULT: return make_error_condition( io_error );
+    case ERROR_WRITE_PROTECT: return make_error_condition( permission_denied );
+    case WSAEACCES: return make_error_condition( permission_denied );
+    case WSAEADDRINUSE: return make_error_condition( address_in_use );
+    case WSAEADDRNOTAVAIL: return make_error_condition( address_not_available );
+    case WSAEAFNOSUPPORT: return make_error_condition( address_family_not_supported );
+    case WSAEALREADY: return make_error_condition( connection_already_in_progress );
+    case WSAEBADF: return make_error_condition( bad_file_descriptor );
+    case WSAECONNABORTED: return make_error_condition( connection_aborted );
+    case WSAECONNREFUSED: return make_error_condition( connection_refused );
+    case WSAECONNRESET: return make_error_condition( connection_reset );
+    case WSAEDESTADDRREQ: return make_error_condition( destination_address_required );
+    case WSAEFAULT: return make_error_condition( bad_address );
+    case WSAEHOSTUNREACH: return make_error_condition( host_unreachable );
+    case WSAEINPROGRESS: return make_error_condition( operation_in_progress );
+    case WSAEINTR: return make_error_condition( interrupted );
+    case WSAEINVAL: return make_error_condition( invalid_argument );
+    case WSAEISCONN: return make_error_condition( already_connected );
+    case WSAEMFILE: return make_error_condition( too_many_files_open );
+    case WSAEMSGSIZE: return make_error_condition( message_size );
+    case WSAENAMETOOLONG: return make_error_condition( filename_too_long );
+    case WSAENETDOWN: return make_error_condition( network_down );
+    case WSAENETRESET: return make_error_condition( network_reset );
+    case WSAENETUNREACH: return make_error_condition( network_unreachable );
+    case WSAENOBUFS: return make_error_condition( no_buffer_space );
+    case WSAENOPROTOOPT: return make_error_condition( no_protocol_option );
+    case WSAENOTCONN: return make_error_condition( not_connected );
+    case WSAENOTSOCK: return make_error_condition( not_a_socket );
+    case WSAEOPNOTSUPP: return make_error_condition( operation_not_supported );
+    case WSAEPROTONOSUPPORT: return make_error_condition( protocol_not_supported );
+    case WSAEPROTOTYPE: return make_error_condition( wrong_protocol_type );
+    case WSAETIMEDOUT: return make_error_condition( timed_out );
+    case WSAEWOULDBLOCK: return make_error_condition( operation_would_block );
+  #endif
+    default: return error_condition( ev, system_category() );
+    }
+  }
+
+# if !defined( BOOST_WINDOWS_API )
+
+  std::string system_error_category::message( int ev ) const
+  {
+    return generic_category().message( ev );
+  }
+# else
+
+  std::string system_error_category::message( int ev ) const
+  {
+# ifndef BOOST_NO_ANSI_APIS  
+    LPVOID lpMsgBuf = 0;
+    DWORD retval = ::FormatMessageA( 
+        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+        FORMAT_MESSAGE_FROM_SYSTEM | 
+        FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL,
+        ev,
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+        (LPSTR) &lpMsgBuf,
+        0,
+        NULL 
+    );
+    detail::local_free_on_destruction lfod(lpMsgBuf);
+    if (retval == 0)
+        return std::string("Unknown error");
+        
+    std::string str( static_cast<LPCSTR>(lpMsgBuf) );
+# else  // WinCE workaround
+    LPVOID lpMsgBuf = 0;
+    DWORD retval = ::FormatMessageW( 
+        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+        FORMAT_MESSAGE_FROM_SYSTEM | 
+        FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL,
+        ev,
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+        (LPWSTR) &lpMsgBuf,
+        0,
+        NULL 
+    );
+    detail::local_free_on_destruction lfod(lpMsgBuf);
+    if (retval == 0)
+        return std::string("Unknown error");
+    
+    int num_chars = (wcslen( static_cast<LPCWSTR>(lpMsgBuf) ) + 1) * 2;
+    LPSTR narrow_buffer = (LPSTR)_alloca( num_chars );
+    if (::WideCharToMultiByte(CP_ACP, 0, static_cast<LPCWSTR>(lpMsgBuf), -1, narrow_buffer, num_chars, NULL, NULL) == 0)
+        return std::string("Unknown error");
+
+    std::string str( narrow_buffer );
+# endif
+    while ( str.size()
+      && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') )
+        str.erase( str.size()-1 );
+    if ( str.size() && str[str.size()-1] == '.' ) 
+      { str.erase( str.size()-1 ); }
+    return str;
+  }
+# endif
+
+} // unnamed namespace
+
+namespace boost
+{
+  namespace system
+  {
+
+# ifndef BOOST_SYSTEM_NO_DEPRECATED
+    BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
+                                         //  note that it doesn't matter if this
+                                         //  isn't initialized before use since
+                                         //  the only use is to take its
+                                         //  address for comparison purposes
+# endif
+
+    BOOST_SYSTEM_DECL const error_category & system_category()
+    {
+      static const system_error_category  system_category_const;
+      return system_category_const;
+    }
+
+    BOOST_SYSTEM_DECL const error_category & generic_category()
+    {
+      static const generic_error_category generic_category_const;
+      return generic_category_const;
+    }
+
+  } // namespace system
+} // namespace boost
+
+#endif
\ No newline at end of file
Added: sandbox/chrono/libs/system/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/Jamfile.v2	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,53 @@
+# Boost System Library test Jamfile
+
+# Copyright Beman Dawes 2003, 2006
+
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt
+
+# See library home page at http://www.boost.org/libs/system
+
+project
+    : requirements
+      <library>/boost/system//boost_system
+      <toolset>msvc:<asynch-exceptions>on
+    ;
+    
+   lib throw_test
+     : throw_test.cpp
+     : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
+     ;
+   
+
+   test-suite "system"
+       : [ run error_code_test.cpp
+           : # command line
+           : # input files
+           : # requirements
+                   <link>static
+         ]
+         [ run error_code_test.cpp
+           :  :  : <link>shared : error_code_test_shared
+         ]
+         [ run error_code_user_test.cpp
+           :  :  : <link>static
+         ]
+         [ run error_code_user_test.cpp
+           :  :  : <link>shared : error_code_user_test_shared
+         ]
+         [ run system_error_test.cpp
+           :  :  : <link>static
+         ]
+         [ run system_error_test.cpp
+            :  :  : <link>shared : system_error_test_shared
+         ]
+         [ run dynamic_link_test.cpp throw_test
+           :  :  : <link>shared : throw_test_shared
+         ]
+         [ run initialization_test.cpp
+            :  :  : <link>shared : initialization_test_shared
+         ]
+         [ run header_only_test.cpp
+           :  :  : <link>static
+         ]
+         ;
Added: sandbox/chrono/libs/system/test/dynamic_link_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/dynamic_link_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,55 @@
+//  dynamic_link_test.cpp  -------------------------------------------------------------//
+
+//  Copyright Beman Dawes 2010
+
+//  Distributed under the Boost Software License, Version 1.0.
+//  See www.boost.org/LICENSE_1_0.txt
+
+//  Library home page is www.boost.org/libs/system
+
+//--------------------------------------------------------------------------------------// 
+
+//  Dynamic link libraries (DLL's), also know as dynamic shared objects (DSO's),
+//  can cause symbol visability problems unless carefully configured. One of the
+//  manifestations, particularly with GCC, is that a system_error exception thrown from
+//  a DLL or DSO is not caught.
+//
+//  The purpose of this program is to test for that error.
+
+//--------------------------------------------------------------------------------------// 
+
+#include <boost/system/system_error.hpp>
+
+#include <iostream>
+
+namespace boost
+{
+  namespace system
+  {
+    BOOST_SYSTEM_DECL void throw_test();
+  }
+}
+
+int main()
+{
+  try
+  {
+    boost::system::throw_test();
+  }
+  catch (const boost::system::system_error& ex)
+  {
+    std::cout << "  caught boost::system::system_error as expected\n";
+    std::cout << "  what() reports " << ex.what() << '\n';
+    return 0;
+  }
+
+  catch (const std::runtime_error& ex)
+  {
+    std::cout << "  error: caught std::runtime_error instead of boost::system::system_error\n";
+    std::cout << "  what() reports " << ex.what() << '\n';
+    return 1;
+  }
+
+  std::cout << "  error: failed to catch boost::system::system_error\n";
+  return 1;
+}
\ No newline at end of file
Added: sandbox/chrono/libs/system/test/error_code_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/error_code_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,279 @@
+//  error_code_test.cpp  -----------------------------------------------------//
+
+//  Copyright Beman Dawes 2006
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//----------------------------------------------------------------------------//
+
+//  test without deprecated features
+#define BOOST_SYSTEM_NO_DEPRECATED
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/cygwin_error.hpp>
+#include <boost/system/linux_error.hpp>
+#include <boost/system/windows_error.hpp>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <cstring>
+#include <functional>
+#include <boost/cerrno.hpp>
+
+//  Although using directives are not the best programming practice, testing
+//  with a boost::system using directive increases use scenario coverage.
+using namespace boost::system;
+
+# if defined( BOOST_WINDOWS_API )
+#   include "winerror.h"
+#   define BOOST_ACCESS_ERROR_MACRO ERROR_ACCESS_DENIED
+# elif defined( BOOST_POSIX_API )
+#   define BOOST_ACCESS_ERROR_MACRO EACCES
+# else
+#   error "Only supported for POSIX and Windows"
+# endif
+
+namespace
+{
+  void check_ostream( error_code ec, const char * expected )
+  {
+    std::stringstream ss;
+    std::string s;
+
+    ss << ec;
+    ss >> s;
+    BOOST_TEST( s == expected );
+  }
+}
+
+//  main  ------------------------------------------------------------------------------//
+
+// TODO: add hash_value tests
+
+int main( int, char ** )
+{
+
+  std::cout << "Conversion use cases...\n";
+  error_condition x1( errc::file_exists );
+  //error_code x2( errc::file_exists ); // should fail to compile
+  make_error_code(errc::file_exists);
+  make_error_condition(errc::file_exists);
+
+  std::cout << "General tests...\n";
+  // unit tests:
+
+  BOOST_TEST( generic_category() == generic_category() );
+  BOOST_TEST( system_category() == system_category() );
+  BOOST_TEST( generic_category() != system_category() );
+  BOOST_TEST( system_category() != generic_category() );
+
+  if ( std::less<const error_category*>()( &generic_category(), &system_category() ) )
+  {
+    BOOST_TEST( generic_category() < system_category() );
+    BOOST_TEST( !(system_category() < generic_category()) );
+  }
+  else
+  {
+    BOOST_TEST( system_category() < generic_category() );
+    BOOST_TEST( !(generic_category() < system_category()) );
+  }
+
+
+  error_code ec;
+  error_condition econd;
+  BOOST_TEST( !ec );
+  BOOST_TEST( ec.value() == 0 );
+  econd = ec.default_error_condition();
+  BOOST_TEST( econd.value() == 0 );
+  BOOST_TEST( econd.category() == generic_category() );
+  BOOST_TEST( ec == errc::success );
+  BOOST_TEST( ec.category() == system_category() );
+  BOOST_TEST( std::strcmp( ec.category().name(), "system") == 0 );
+  BOOST_TEST( !(ec < error_code( 0, system_category() )) );
+  BOOST_TEST( !(error_code( 0, system_category() ) < ec) );
+  BOOST_TEST( ec < error_code( 1, system_category() ) );
+  BOOST_TEST( !(error_code( 1, system_category() ) < ec) );
+
+  error_code ec_0_system( 0, system_category() );
+  BOOST_TEST( !ec_0_system );
+  BOOST_TEST( ec_0_system.value() == 0 );
+  econd = ec_0_system.default_error_condition();
+  BOOST_TEST( econd.value() == 0 );
+  BOOST_TEST( econd.category() == generic_category() );
+  BOOST_TEST( ec_0_system == errc::success );
+  BOOST_TEST( ec_0_system.category() == system_category() );
+  BOOST_TEST( std::strcmp( ec_0_system.category().name(), "system") == 0 );
+  check_ostream( ec_0_system, "system:0" );
+
+  BOOST_TEST( ec_0_system == ec );
+
+  error_code ec_1_system( 1, system_category() );
+  BOOST_TEST( ec_1_system );
+  BOOST_TEST( ec_1_system.value() == 1 );
+  BOOST_TEST( ec_1_system.value() != 0 );
+  BOOST_TEST( ec != ec_1_system );
+  BOOST_TEST( ec_0_system != ec_1_system );
+  check_ostream( ec_1_system, "system:1" );
+
+  ec = error_code( BOOST_ACCESS_ERROR_MACRO, system_category() );
+  BOOST_TEST( ec );
+  BOOST_TEST( ec.value() == BOOST_ACCESS_ERROR_MACRO );
+  econd = ec.default_error_condition();
+  BOOST_TEST( econd.value() == static_cast<int>(errc::permission_denied) );
+  BOOST_TEST( econd.category() == generic_category() );
+  BOOST_TEST( econd == error_condition( errc::permission_denied, generic_category() ) );
+  BOOST_TEST( econd == errc::permission_denied );
+  BOOST_TEST( errc::permission_denied == econd );
+  BOOST_TEST( ec == errc::permission_denied );
+  BOOST_TEST( ec.category() == system_category() );
+  BOOST_TEST( std::strcmp( ec.category().name(), "system") == 0 );
+
+  // test the explicit make_error_code conversion for errc
+  ec = make_error_code( errc::bad_message );
+  BOOST_TEST( ec );
+  BOOST_TEST( ec == errc::bad_message );
+  BOOST_TEST( errc::bad_message == ec );
+  BOOST_TEST( ec != errc::permission_denied );
+  BOOST_TEST( errc::permission_denied != ec );
+  BOOST_TEST( ec.category() == generic_category() );
+
+  //// test the deprecated predefined error_category synonyms
+  //BOOST_TEST( &system_category() == &native_ecat );
+  //BOOST_TEST( &generic_category() == &errno_ecat );
+  //BOOST_TEST( system_category() == native_ecat );
+  //BOOST_TEST( generic_category() == errno_ecat );
+
+  // test error_code and error_condition message();
+  // see Boost.Filesystem operations_test for code specific message() tests
+  ec = error_code( -1, system_category() );
+  std::cout << "error_code message for -1 is \"" << ec.message() << "\"\n";
+  std::cout << "error_code message for 0 is \"" << ec_0_system.message() << "\"\n";
+#if defined(BOOST_WINDOWS_API)
+  // Borland appends newline, so just check text
+  BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
+  BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" );
+#elif  defined(linux) || defined(__linux) || defined(__linux__)
+  // Linux appends value to message as unsigned, so it varies with # of bits
+  BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
+#elif defined(__hpux)
+  BOOST_TEST( ec.message() == "" );
+#elif defined(__osf__)
+  BOOST_TEST( ec.message() == "Error -1 occurred." );
+#elif defined(__vms)
+  BOOST_TEST( ec.message() == "error -1" );
+#endif
+
+  ec = error_code( BOOST_ACCESS_ERROR_MACRO, system_category() );
+  BOOST_TEST( ec.message() != "" );
+  BOOST_TEST( ec.message().substr( 0, 13) != "Unknown error" );
+
+  econd = error_condition( -1, generic_category() );
+  error_condition econd_ok;
+  std::cout << "error_condition message for -1 is \"" << econd.message() << "\"\n";
+  std::cout << "error_condition message for 0 is \"" << econd_ok.message() << "\"\n";
+#if defined(BOOST_WINDOWS_API)
+  // Borland appends newline, so just check text
+  BOOST_TEST( econd.message().substr(0,13) == "Unknown error" );
+  BOOST_TEST( econd_ok.message().substr(0,8) == "No error" );
+#elif  defined(linux) || defined(__linux) || defined(__linux__)
+  // Linux appends value to message as unsigned, so it varies with # of bits
+  BOOST_TEST( econd.message().substr(0,13) == "Unknown error" );
+#elif defined(__hpux)
+  BOOST_TEST( econd.message() == "" );
+#elif defined(__osf__)
+  BOOST_TEST( econd.message() == "Error -1 occurred." );
+#elif defined(__vms)
+  BOOST_TEST( econd.message() == "error -1" );
+#endif
+
+  econd = error_condition( BOOST_ACCESS_ERROR_MACRO, generic_category() );
+  BOOST_TEST( econd.message() != "" );
+  BOOST_TEST( econd.message().substr( 0, 13) != "Unknown error" );
+
+#ifdef BOOST_WINDOWS_API
+  std::cout << "Windows tests...\n";
+  // these tests probe the Windows errc decoder
+  //   test the first entry in the decoder table:
+  ec = error_code( ERROR_ACCESS_DENIED, system_category() );
+  BOOST_TEST( ec.value() == ERROR_ACCESS_DENIED );
+  BOOST_TEST( ec == errc::permission_denied );
+  BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+  //   test the second entry in the decoder table:
+  ec = error_code( ERROR_ALREADY_EXISTS, system_category() );
+  BOOST_TEST( ec.value() == ERROR_ALREADY_EXISTS );
+  BOOST_TEST( ec == errc::file_exists );
+  BOOST_TEST( ec.default_error_condition().value() == errc::file_exists );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+  //   test the third entry in the decoder table:
+  ec = error_code( ERROR_BAD_UNIT, system_category() );
+  BOOST_TEST( ec.value() == ERROR_BAD_UNIT );
+  BOOST_TEST( ec == errc::no_such_device );
+  BOOST_TEST( ec.default_error_condition().value() == errc::no_such_device );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+  //   test the last non-Winsock entry in the decoder table:
+  ec = error_code( ERROR_WRITE_PROTECT, system_category() );
+  BOOST_TEST( ec.value() == ERROR_WRITE_PROTECT );
+  BOOST_TEST( ec == errc::permission_denied );
+  BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+  //   test the last Winsock entry in the decoder table:
+  ec = error_code( WSAEWOULDBLOCK, system_category() );
+  BOOST_TEST( ec.value() == WSAEWOULDBLOCK );
+  BOOST_TEST( ec == errc::operation_would_block );
+  BOOST_TEST( ec.default_error_condition().value() == errc::operation_would_block );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+  //   test not-in-table condition:
+  ec = error_code( 1234567890, system_category() );
+  BOOST_TEST( ec.value() == 1234567890 );
+  BOOST_TEST( ec.default_error_condition().value() == 1234567890 );
+  BOOST_TEST( ec.default_error_condition().category() == system_category() );
+
+#else // POSIX
+
+  std::cout << "POSIX tests...\n";
+  ec = error_code( EACCES, system_category() );
+  BOOST_TEST( ec == error_code( errc::permission_denied, system_category() ) );
+  BOOST_TEST( error_code( errc::permission_denied, system_category() ) == ec );
+  BOOST_TEST( ec == errc::permission_denied );
+  BOOST_TEST( errc::permission_denied == ec );
+  BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+  BOOST_TEST( ec.default_error_condition().category() == generic_category() );
+
+# ifdef __CYGWIN__
+
+  std::cout << "Cygwin tests...\n";
+  ec = cygwin_error::no_package;
+  BOOST_TEST( ec == cygwin_error::no_package );
+  BOOST_TEST( ec == error_code( ENOPKG, system_category() ) );
+  BOOST_TEST( ec == error_code( cygwin_error::no_package, system_category() ) );
+  BOOST_TEST( ec.default_error_condition().category() == system_category() );
+
+# elif defined(linux) || defined(__linux) || defined(__linux__)
+
+  std::cout << "Linux tests...\n";
+  ec = linux_error::dot_dot_error;
+  BOOST_TEST( ec == linux_error::dot_dot_error );
+  BOOST_TEST( ec == error_code( EDOTDOT, system_category() ) );
+  BOOST_TEST( ec == error_code( linux_error::dot_dot_error, system_category() ) );
+  BOOST_TEST( ec.default_error_condition().category() == system_category() );
+
+# endif
+
+#endif
+  
+  return ::boost::report_errors();
+}
+
+
Added: sandbox/chrono/libs/system/test/error_code_user_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/error_code_user_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,404 @@
+//  error_code_user_test.cpp  ------------------------------------------------//
+
+//  Copyright Beman Dawes 2006
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//  ------------------------------------------------------------------------  //
+
+//  This program demonstrates creation and use of new categories of error
+//  codes. Several scenarios are demonstrated and tested.
+
+//  Motivation was a Boost posting by Christopher Kohlhoff on June 28, 2006.
+
+#define BOOST_SYSTEM_NO_DEPRECATED
+
+#include <boost/system/error_code.hpp>
+#include <boost/cerrno.hpp>
+#include <string>
+#include <cstdio>
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_POSIX_API
+# include <sys/stat.h>
+#else
+# include <windows.h>
+#endif
+
+//  ------------------------------------------------------------------------  //
+
+//  Library 1: User function passes through an error code from the
+//  operating system. 
+
+
+boost::system::error_code my_mkdir( const std::string & path )
+{
+  return boost::system::error_code(
+#   ifdef BOOST_POSIX_API
+      ::mkdir( path.c_str(), S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH ) == 0 ? 0 : errno,
+#   else
+      ::CreateDirectoryA( path.c_str(), 0 ) != 0 ? 0 : ::GetLastError(),
+#   endif
+      boost::system::system_category() );
+}
+
+//  ------------------------------------------------------------------------  //
+
+//  Library 2: User function passes through errno from the C-runtime. 
+
+#include <cstdio>
+
+boost::system::error_code my_remove( const std::string & path )
+{
+  return boost::system::error_code(
+    std::remove( path.c_str() ) == 0 ? 0 : errno,
+    boost::system::generic_category() ); // OK for both Windows and POSIX
+                                     // Alternatively, could use generic_category()
+                                     // on Windows and system_category() on
+                                     // POSIX-based systems.
+}
+
+//  ------------------------------------------------------------------------  //
+
+//  Library 3: Library uses enum to identify library specific errors.
+
+//  This particular example is for a library within the parent namespace. For
+//  an example of a library not within the parent namespace, see library 4.
+
+//  header lib3.hpp:
+
+namespace boost
+{
+  namespace lib3
+  {
+    // lib3 has its own error_category:
+    const boost::system::error_category & get_lib3_error_category();
+    const boost::system::error_category & lib3_error_category = get_lib3_error_category();
+    
+    enum error
+    {
+      boo_boo=123,
+      big_boo_boo
+    };
+  }
+
+  namespace system
+  {
+    template<> struct is_error_code_enum<boost::lib3::error>
+      { static const bool value = true; };
+  }
+
+  namespace lib3
+  {
+    inline boost::system::error_code make_error_code(error e)
+      { return boost::system::error_code(e,lib3_error_category); }
+  }
+
+}
+
+//  implementation file lib3.cpp:
+
+//  #include <lib3.hpp>
+
+namespace boost
+{
+  namespace lib3
+  {
+    class lib3_error_category_imp : public boost::system::error_category
+    {
+    public:
+      lib3_error_category_imp() : boost::system::error_category() { }
+
+      const char * name() const
+      {
+        return "lib3";
+      }
+
+      boost::system::error_condition default_error_condition( int ev ) const
+      {
+        return ev == boo_boo
+          ? boost::system::error_condition( boost::system::errc::io_error,
+              boost::system::generic_category() )
+          : boost::system::error_condition( ev,
+              boost::lib3::lib3_error_category );
+      }
+      
+      std::string message( int ev ) const
+      {
+        if ( ev == boo_boo ) return std::string("boo boo");
+        if ( ev == big_boo_boo ) return std::string("big boo boo");
+        return std::string("unknown error");
+      }
+
+    };
+
+    const boost::system::error_category & get_lib3_error_category()
+    {
+      static const lib3_error_category_imp l3ecat;
+      return l3ecat;
+    }
+  }
+}
+
+//  ------------------------------------------------------------------------  //
+
+//  Library 4: Library uses const error_code's to identify library specific
+//  errors. 
+
+//  This particular example is for a library not within the parent namespace.
+//  For an example of a library within the parent namespace, see library 3.
+
+//  header lib4.hpp:
+
+namespace lib4
+{
+  // lib4 has its own error_category:
+  const boost::system::error_category & get_lib4_error_category();
+  const boost::system::error_category & lib4_error_category = get_lib4_error_category();
+  
+  extern const boost::system::error_code boo_boo;
+  extern const boost::system::error_code big_boo_boo;
+}
+
+//  implementation file lib4.cpp:
+
+//  #include <lib4.hpp>
+
+namespace lib4
+{
+  class lib4_error_category_imp : public boost::system::error_category
+  {
+  public:
+    lib4_error_category_imp() : boost::system::error_category() { }
+
+    const char * name() const
+    {
+      return "lib4";
+    }
+
+    boost::system::error_condition default_error_condition( int ev ) const
+    {
+      return ev == boo_boo.value()
+        ? boost::system::error_condition( boost::system::errc::io_error,
+            boost::system::generic_category() )
+        : boost::system::error_condition( ev, lib4::lib4_error_category );
+    }
+    
+    std::string message( int ev ) const
+    {
+      if ( ev == boo_boo.value() ) return std::string("boo boo");
+      if ( ev == big_boo_boo.value() ) return std::string("big boo boo");
+      return std::string("unknown error");
+    }
+  };
+
+  const boost::system::error_category & get_lib4_error_category()
+  {
+    static const lib4_error_category_imp l4ecat;
+    return l4ecat;
+  }
+
+  const boost::system::error_code boo_boo( 456, lib4_error_category );
+  const boost::system::error_code big_boo_boo( 789, lib4_error_category );
+
+}
+
+//  ------------------------------------------------------------------------  //
+
+// Chris Kolhoff's Test3, modified to work with error_code.hpp
+
+// Test3
+// =====
+// Define error classes to check for success, permission_denied and
+// out_of_memory, but add additional mappings for a user-defined error category.
+//
+
+//namespace test3 {
+
+//  enum user_err
+//  {
+//    user_success = 0,
+//    user_permission_denied,
+//    user_out_of_memory
+//  };
+//
+//  class user_error_category_imp : public boost::system::error_category
+//  {
+//  public:
+//    const std::string & name() const
+//    {
+//      static std::string s( "test3" );
+//      return s;
+//    }
+//
+//    boost::system::error_code portable_error_code( int ev ) const
+//    {
+//      switch (ev)
+//      {
+//        case user_success:
+//          return boost::system::error_code(boost::system::errc::success, boost::system::generic_category());
+//        case user_permission_denied:
+//          return boost::system::error_code(boost::system::errc::permission_denied, boost::system::generic_category());
+//        case user_out_of_memory:
+//          return boost::system::error_code(boost::system::errc::not_enough_memory, boost::system::generic_category());
+//        default:
+//          break;
+//      }
+//      return boost::system::error_code(boost::system::errc::no_posix_equivalent, boost::system::generic_category());
+//    }
+//    
+//  };
+//
+//  const user_error_category_imp user_error_category_const;
+//
+//  const boost::system::error_category & user_error_category
+//    = user_error_category_const;
+//
+//  template<> inline boost::system::error_code make_error_code(user_err e)
+//  {
+//    return boost::system::error_code(e, user_error_category);
+//  }
+//
+//  // test code
+//
+//  void check_success(const boost::system::error_code& ec, bool expect)
+//  {
+//    BOOST_TEST( (ec == boost::system::errc::success) == expect );
+//    if (ec == boost::system::errc::success)
+//      std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
+//    else
+//      std::cout << "no...  " << (expect ? "fail" : "ok") << '\n';
+//  }
+//
+//  void check_permission_denied(const boost::system::error_code& ec, bool expect)
+//  {
+//    BOOST_TEST( (ec == boost::system::errc::permission_denied) == expect );
+//    if (ec ==  boost::system::errc::permission_denied)
+//      std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
+//    else
+//      std::cout << "no...  " << (expect ? "fail" : "ok") << '\n';
+//  }
+//
+//  void check_out_of_memory(const boost::system::error_code& ec, bool expect)
+//  {
+//    BOOST_TEST( (ec == boost::system::errc::not_enough_memory) == expect );
+//    if (ec ==  boost::system::errc::not_enough_memory)
+//      std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
+//    else
+//      std::cout << "no...  " << (expect ? "fail" : "ok") << '\n';
+//  }
+//
+//  void run()
+//  {
+//    printf("Test3\n");
+//    printf("=====\n");
+//    boost::system::error_code ec;
+//    check_success(ec, true);
+//    check_success(boost::system::errc::success, true);
+//    check_success(boost::system::errc::permission_denied, false);
+//    check_success(boost::system::errc::not_enough_memory, false);
+//    check_success(user_success, true);
+//    check_success(user_permission_denied, false);
+//    check_success(user_out_of_memory, false);
+//    check_permission_denied(ec, false);
+//    check_permission_denied(boost::system::errc::success, false);
+//    check_permission_denied(boost::system::errc::permission_denied, true);
+//    check_permission_denied(boost::system::errc::not_enough_memory, false);
+//    check_permission_denied(user_success, false);
+//    check_permission_denied(user_permission_denied, true);
+//    check_permission_denied(user_out_of_memory, false);
+//    check_out_of_memory(ec, false);
+//    check_out_of_memory(boost::system::errc::success, false);
+//    check_out_of_memory(boost::system::errc::permission_denied, false);
+//    check_out_of_memory(boost::system::errc::not_enough_memory, true);
+//    check_out_of_memory(user_success, false);
+//    check_out_of_memory(user_permission_denied, false);
+//    check_out_of_memory(user_out_of_memory, true);
+//
+//# ifdef BOOST_WINDOWS_API
+//    check_success(boost::system::windows::success, true);
+//    check_success(boost::system::windows::access_denied, false);
+//    check_success(boost::system::windows::not_enough_memory, false);
+//    check_permission_denied(boost::system::windows::success, false);
+//    check_permission_denied(boost::system::windows::access_denied, true);
+//    check_permission_denied(boost::system::windows::not_enough_memory, false);
+//    check_out_of_memory(boost::system::windows::success, false);
+//    check_out_of_memory(boost::system::windows::access_denied, false);
+//    check_out_of_memory(boost::system::windows::not_enough_memory, true);
+//# endif
+//
+//    printf("\n");
+//  }
+//
+//} // namespace test3
+
+
+
+//  ------------------------------------------------------------------------  //
+
+int main( int, char *[] )
+{
+  boost::system::error_code ec;
+
+  // Library 1 tests:
+  
+  ec = my_mkdir( "/no-such-file-or-directory/will-not-succeed" );
+  std::cout << "ec.value() is " << ec.value() << '\n';
+
+  BOOST_TEST( ec );
+  BOOST_TEST( ec == boost::system::errc::no_such_file_or_directory );
+  BOOST_TEST( ec.category() == boost::system::system_category() );
+
+  // Library 2 tests:
+
+  ec = my_remove( "/no-such-file-or-directory" );
+  std::cout << "ec.value() is " << ec.value() << '\n';
+
+  BOOST_TEST( ec );
+  BOOST_TEST( ec == boost::system::errc::no_such_file_or_directory );
+  BOOST_TEST( ec.category() == boost::system::generic_category() );
+
+  // Library 3 tests:
+
+  ec = boost::lib3::boo_boo;
+  std::cout << "ec.value() is " << ec.value() << '\n';
+
+  BOOST_TEST( ec );
+  BOOST_TEST( ec == boost::lib3::boo_boo );
+  BOOST_TEST( ec.value() == boost::lib3::boo_boo );
+  BOOST_TEST( ec.category() == boost::lib3::lib3_error_category );
+
+  BOOST_TEST( ec == boost::system::errc::io_error );
+
+  boost::system::error_code ec3( boost::lib3::boo_boo+100,
+    boost::lib3::lib3_error_category );
+  BOOST_TEST( ec3.category() == boost::lib3::lib3_error_category );
+  BOOST_TEST( ec3.default_error_condition().category()
+    == boost::lib3::lib3_error_category );
+
+  // Library 4 tests:
+
+  ec = lib4::boo_boo;
+  std::cout << "ec.value() is " << ec.value() << '\n';
+
+  BOOST_TEST( ec );
+  BOOST_TEST( ec == lib4::boo_boo );
+  BOOST_TEST( ec.value() == lib4::boo_boo.value() );
+  BOOST_TEST( ec.category() == lib4::lib4_error_category );
+
+  BOOST_TEST( ec == boost::system::errc::io_error );
+
+  boost::system::error_code ec4( lib4::boo_boo.value()+100,
+    lib4::lib4_error_category );
+  BOOST_TEST( ec4.default_error_condition().category()
+    == lib4::lib4_error_category );
+
+  // Test 3
+
+  //test3::run();
+
+  return ::boost::report_errors();
+}
Added: sandbox/chrono/libs/system/test/header_only_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/header_only_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,23 @@
+//  error_code_test.cpp  -----------------------------------------------------//
+
+//  Copyright Beman Dawes 2007
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//----------------------------------------------------------------------------// 
+
+#include <boost/config/warning_disable.hpp>
+
+#define BOOST_ERROR_CODE_HEADER_ONLY
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/system/error_code.hpp>
+
+int main( int, char*[] )
+{
+  boost::system::error_code ec( 0, boost::system::system_category() );
+  return ::boost::report_errors();
+}
Added: sandbox/chrono/libs/system/test/initialization_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/initialization_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,28 @@
+//  initialization_test.cpp  -------------------------------------------------//
+
+//  Copyright Christoper Kohlhoff 2007
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//  This test verifiies that the error_category vtable does not suffer from
+//  order-of-initialization problems.
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/system/error_code.hpp>
+
+struct foo
+{
+  foo()
+  {
+    boost::system::error_code ec;
+    ec == boost::system::posix::permission_denied;
+  }
+} f;
+
+int main( int, char ** )
+{
+  return ::boost::report_errors();
+}
Added: sandbox/chrono/libs/system/test/system_error_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/system_error_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,109 @@
+//  system_error_test.cpp  ---------------------------------------------------//
+
+//  Copyright Beman Dawes 2006
+
+//  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)
+
+//  See library home page at http://www.boost.org/libs/system
+
+//----------------------------------------------------------------------------// 
+
+//  test without deprecated features
+#define BOOST_SYSTEM_NO_DEPRECATED
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/system/system_error.hpp>
+#include <iostream>
+#include <string>
+
+#ifdef BOOST_WINDOWS_API
+#include <windows.h>
+#endif
+
+using boost::system::system_error;
+using boost::system::error_code;
+using boost::system::system_category;
+using std::string;
+
+#define TEST(x,v,w) test(#x,x,v,w)
+
+namespace
+{
+  void test( const char * desc, const system_error & ex,
+    int v, const char * str )
+  {
+    std::cout << "test " << desc << "\n what() returns \"" << ex.what() << "\"\n";
+    BOOST_TEST( ex.code().value() == v );
+    BOOST_TEST( ex.code().category() == system_category() );
+# ifdef BOOST_WINDOWS_API
+    LANGID language_id;
+#   if !defined(__MINGW32__) && !defined(__CYGWIN__)
+      language_id = ::GetUserDefaultUILanguage();
+#   else
+      language_id = 0x0409; // Assume US English
+#   endif
+    // std::cout << "GetUserDefaultUILanguage() returns " << language_id << '\n';
+    if ( language_id == 0x0409 )  // English (United States)
+    {
+      BOOST_TEST( std::string( ex.what() ) == str );
+      if ( std::string( ex.what() ) != str )
+        std::cout << "expected \"" << str << "\", but what() returned \""
+          << ex.what() << "\"\n";
+    }
+# endif
+  }
+
+  const boost::uint_least32_t uvalue = 2u;
+}
+
+int main( int, char *[] )
+{
+  // all constructors, in the same order as they appear in the header:
+
+  system_error c1_0( error_code(0, system_category()) ); 
+  system_error c1_1( error_code(1, system_category()) );
+  system_error c1_2u( error_code(uvalue, system_category()) );
+
+  system_error c2_0( error_code(0, system_category()), string("c2_0") ); 
+  system_error c2_1( error_code(1, system_category()), string("c2_1") );
+
+  system_error c3_0( error_code(0, system_category()), "c3_0" ); 
+  system_error c3_1( error_code(1, system_category()), "c3_1" );
+
+  system_error c4_0( 0, system_category() ); 
+  system_error c4_1( 1, system_category() );
+  system_error c4_2u( uvalue, system_category() );
+
+  system_error c5_0( 0, system_category(), string("c5_0") ); 
+  system_error c5_1( 1, system_category(), string("c5_1") );
+
+  system_error c6_0( 0, system_category(), "c6_0" ); 
+  system_error c6_1( 1, system_category(), "c6_1" );
+
+  TEST( c1_0, 0, "The operation completed successfully" );
+  TEST( c1_1, 1, "Incorrect function" );
+  TEST( c1_2u, 2, "The system cannot find the file specified" );
+
+  TEST( c2_0, 0, "c2_0: The operation completed successfully" );
+  TEST( c2_1, 1, "c2_1: Incorrect function" );
+
+  TEST( c3_0, 0, "c3_0: The operation completed successfully" );
+  TEST( c3_1, 1, "c3_1: Incorrect function" );
+
+  TEST( c4_0, 0, "The operation completed successfully" );
+  TEST( c4_1, 1, "Incorrect function" );
+  TEST( c4_2u, 2, "The system cannot find the file specified" );
+
+  TEST( c5_0, 0, "c5_0: The operation completed successfully" );
+  TEST( c5_1, 1, "c5_1: Incorrect function" );
+
+  TEST( c6_0, 0, "c6_0: The operation completed successfully" );
+  TEST( c6_1, 1, "c6_1: Incorrect function" );
+
+  return ::boost::report_errors();
+}
+
+
Added: sandbox/chrono/libs/system/test/throw_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/system/test/throw_test.cpp	2010-10-17 15:44:20 EDT (Sun, 17 Oct 2010)
@@ -0,0 +1,31 @@
+//  throw_test.cpp  --------------------------------------------------------===========-//
+
+//  Copyright Beman Dawes 2010
+
+//  Distributed under the Boost Software License, Version 1.0.
+//  See www.boost.org/LICENSE_1_0.txt
+
+//  Library home page is www.boost.org/libs/system
+
+//--------------------------------------------------------------------------------------// 
+
+//  See dynamic_link_test.cpp comments for use case.
+
+//--------------------------------------------------------------------------------------// 
+
+// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_SYSTEM_SOURCE 
+
+#include <boost/system/system_error.hpp>
+
+namespace boost
+{
+  namespace system
+  {
+    BOOST_SYSTEM_DECL void throw_test()
+    {
+      throw system_error(9999, system_category(), "boo boo");
+    }
+  }
+}