Update of /cvsroot/boost/boost/boost/system
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29908

Modified Files:
      Tag: c++0x
        error_code.hpp system_error.hpp 
Log Message:
Move posix_errno into sub-namespace, expand test cases, test system_error

Index: error_code.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/system/error_code.hpp,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -d -r1.2.2.5 -r1.2.2.6
--- error_code.hpp      24 Jul 2007 15:26:07 -0000      1.2.2.5
+++ error_code.hpp      26 Jul 2007 20:22:49 -0000      1.2.2.6
@@ -21,7 +21,7 @@
 
 #include <boost/cerrno.hpp> // we don't like doing this, but it appears
                             // unavoidable to implement posix_errno.
-# ifdef BOOST_WINDOWS
+# ifdef BOOST_WINDOWS_API
 #   include <winerror.h>
 # endif
 
@@ -34,90 +34,95 @@
 
     class error_code;
 
-    enum posix_errno
+    namespace posix
     {
-      no_error = 0,
-      address_family_not_supported = EAFNOSUPPORT,
-      address_in_use = EADDRINUSE,
-      address_not_available = EADDRNOTAVAIL,
-      already_connected = EISCONN,
-      argument_list_too_long = E2BIG,
-      argument_out_of_domain = EDOM,
-      bad_address = EFAULT,
-      bad_file_descriptor = EBADF,
-      bad_message = EBADMSG,
-      broken_pipe = EPIPE,
-      connection_aborted = ECONNABORTED,
-      connection_already_in_progress = EALREADY,
-      connection_refused = ECONNREFUSED,
-      connection_reset = ECONNRESET,
-      cross_device_link = EXDEV,
-      destination_address_required = EDESTADDRREQ,
-      device_or_resource_busy = EBUSY,
-      directory_not_empty = ENOTEMPTY,
-      executable_format_error = ENOEXEC,
-      file_exists = EEXIST,
-      file_too_large = EFBIG,
-      filename_too_long = ENAMETOOLONG,
-      function_not_supported = ENOSYS,
-      host_unreachable = EHOSTUNREACH,
-      identifier_removed = EIDRM,
-      illegal_byte_sequence = EILSEQ,
-      inappropriate_io_control_operation = ENOTTY,
-      interrupted = EINTR,
-      invalid_argument = EINVAL,
-      invalid_seek = ESPIPE,
-      io_error = EIO,
-      is_a_directory = EISDIR,
-      message_size = EMSGSIZE,
-      network_down = ENETDOWN,
-      network_reset = ENETRESET,
-      network_unreachable = ENETUNREACH,
-      no_buffer_space = ENOBUFS,
-      no_child_process = ECHILD,
-      no_link = ENOLINK,
-      no_lock_available = ENOLCK,
-      no_message_available = ENODATA,
-      no_message = ENOMSG,
-      no_protocol_option = ENOPROTOOPT,
-      no_space_on_device = ENOSPC,
-      no_stream_resources = ENOSR,
-      no_such_device_or_address = ENXIO,
-      no_such_device = ENODEV,
-      no_such_file_or_directory = ENOENT,
-      no_such_process = ESRCH,
-      not_a_directory = ENOTDIR,
-      not_a_socket = ENOTSOCK,
-      not_a_stream = ENOSTR,
-      not_connected = ENOTCONN,
-      not_enough_memory = ENOMEM,
-      not_supported = ENOTSUP,
-      operation_canceled = ECANCELED,
-      operation_in_progress = EINPROGRESS,
-      operation_not_permitted = EPERM,
-      operation_not_supported = EOPNOTSUPP,
-      operation_would_block = EWOULDBLOCK,
-      owner_dead = EOWNERDEAD,
-      permission_denied = EACCES,
-      protocol_error = EPROTO,
-      protocol_not_supported = EPROTONOSUPPORT,
-      read_only_file_system = EROFS,
-      resource_deadlock_would_occur = EDEADLK,
-      resource_unavailable_try_again = EAGAIN,
-      result_out_of_range = ERANGE,
-      state_not_recoverable = ENOTRECOVERABLE,
-      stream_timeout = ETIME,
-      text_file_busy = ETXTBSY,
-      timed_out = ETIMEDOUT,
-      too_many_files_open_in_system = ENFILE,
-      too_many_files_open = EMFILE,
-      too_many_links = EMLINK,
-      too_many_synbolic_link_levels = ELOOP,
-      value_too_large = EOVERFLOW,
-      wrong_protocol_type = EPROTOTYPE,
 
-      no_posix_equivalent = -1 // TODO: is this a safe value?
-    };
+      enum posix_errno
+      {
+        no_error = 0,
+        address_family_not_supported = EAFNOSUPPORT,
+        address_in_use = EADDRINUSE,
+        address_not_available = EADDRNOTAVAIL,
+        already_connected = EISCONN,
+        argument_list_too_long = E2BIG,
+        argument_out_of_domain = EDOM,
+        bad_address = EFAULT,
+        bad_file_descriptor = EBADF,
+        bad_message = EBADMSG,
+        broken_pipe = EPIPE,
+        connection_aborted = ECONNABORTED,
+        connection_already_in_progress = EALREADY,
+        connection_refused = ECONNREFUSED,
+        connection_reset = ECONNRESET,
+        cross_device_link = EXDEV,
+        destination_address_required = EDESTADDRREQ,
+        device_or_resource_busy = EBUSY,
+        directory_not_empty = ENOTEMPTY,
+        executable_format_error = ENOEXEC,
+        file_exists = EEXIST,
+        file_too_large = EFBIG,
+        filename_too_long = ENAMETOOLONG,
+        function_not_supported = ENOSYS,
+        host_unreachable = EHOSTUNREACH,
+        identifier_removed = EIDRM,
+        illegal_byte_sequence = EILSEQ,
+        inappropriate_io_control_operation = ENOTTY,
+        interrupted = EINTR,
+        invalid_argument = EINVAL,
+        invalid_seek = ESPIPE,
+        io_error = EIO,
+        is_a_directory = EISDIR,
+        message_size = EMSGSIZE,
+        network_down = ENETDOWN,
+        network_reset = ENETRESET,
+        network_unreachable = ENETUNREACH,
+        no_buffer_space = ENOBUFS,
+        no_child_process = ECHILD,
+        no_link = ENOLINK,
+        no_lock_available = ENOLCK,
+        no_message_available = ENODATA,
+        no_message = ENOMSG,
+        no_protocol_option = ENOPROTOOPT,
+        no_space_on_device = ENOSPC,
+        no_stream_resources = ENOSR,
+        no_such_device_or_address = ENXIO,
+        no_such_device = ENODEV,
+        no_such_file_or_directory = ENOENT,
+        no_such_process = ESRCH,
+        not_a_directory = ENOTDIR,
+        not_a_socket = ENOTSOCK,
+        not_a_stream = ENOSTR,
+        not_connected = ENOTCONN,
+        not_enough_memory = ENOMEM,
+        not_supported = ENOTSUP,
+        operation_canceled = ECANCELED,
+        operation_in_progress = EINPROGRESS,
+        operation_not_permitted = EPERM,
+        operation_not_supported = EOPNOTSUPP,
+        operation_would_block = EWOULDBLOCK,
+        owner_dead = EOWNERDEAD,
+        permission_denied = EACCES,
+        protocol_error = EPROTO,
+        protocol_not_supported = EPROTONOSUPPORT,
+        read_only_file_system = EROFS,
+        resource_deadlock_would_occur = EDEADLK,
+        resource_unavailable_try_again = EAGAIN,
+        result_out_of_range = ERANGE,
+        state_not_recoverable = ENOTRECOVERABLE,
+        stream_timeout = ETIME,
+        text_file_busy = ETXTBSY,
+        timed_out = ETIMEDOUT,
+        too_many_files_open_in_system = ENFILE,
+        too_many_files_open = EMFILE,
+        too_many_links = EMLINK,
+        too_many_synbolic_link_levels = ELOOP,
+        value_too_large = EOVERFLOW,
+        wrong_protocol_type = EPROTOTYPE,
+
+        no_posix_equivalent = -1 // TODO: is this a safe value?
+      };
+
+    } // namespace posix
 
     //  class error_category  
------------------------------------------------//
 
@@ -126,7 +131,7 @@
     public:
       virtual ~error_category(){}
       virtual const std::string & name() const = 0;
-      virtual posix_errno posix( int ev) const = 0;
+      virtual posix::posix_errno posix( int ev) const = 0;
 
       bool operator==(const error_category & rhs) const { return this == &rhs; 
}
       bool operator!=(const error_category & rhs) const { return !(*this == 
rhs); }
@@ -182,7 +187,7 @@
       // observers:
       int                     value() const         { return m_val; }
       const error_category &  category() const      { return *m_cat; }
-      posix_errno             posix() const         { return 
m_cat->posix(value()); }        
+      posix::posix_errno      posix() const         { return 
m_cat->posix(value()); }        
 
       typedef void (*unspecified_bool_type)();
       static void unspecified_bool_true() {}
@@ -243,17 +248,42 @@
 
     //  implementation specific interfaces  
----------------------------------//
 
-#ifndef BOOST_WINDOWS
+#ifdef BOOST_POSIX_API
   // POSIX-based Operating System:
 
-  inline error_code make_error_code(posix_errno e)
+  inline error_code make_error_code(posix::posix_errno e)
     { return error_code(e,system_category); }
 
-  // TODO: Add code for system specific categories here.
+  namespace sys
+  {
+    enum other_error
+    {
+      // POSIX-like operating systems typically extend the POSIX errno.h 
macros.
+      // These names and values are based on Cygwin sys/errno.h.
+      // It isn't clear exactly which added errors we want to support, so for
+      // now we just provide a few to ensure the mechanism works.
+      // Users can always fall back on the macros.
+#   ifdef DEADLOCK
+      deadlock = DEADLOCK,
+#   endif
+#   ifdef ENONET
+      no_net = ENONET,
+#   endif
+#   ifdef ENOPKG
+      no_package = ENOPKG,
+#   endif
+#   ifdef ENOSHARE
+      no_share = ENOSHARE,
+#   endif
+    };
+  }
+
+  inline error_code make_error_code(sys::other_error e)
+    { return error_code(e,system_category); }
 
 #else
   // Windows:
-  namespace system
+  namespace sys
   {
     enum windows_error
     {
@@ -317,7 +347,7 @@
     };
   }
 
-  inline error_code make_error_code(system::windows_error e)
+  inline error_code make_error_code(sys::windows_error e)
     { return error_code(e,system_category); }
 
 #endif

Index: system_error.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/system/system_error.hpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- system_error.hpp    17 Jun 2007 15:52:10 -0000      1.1.2.1
+++ system_error.hpp    26 Jul 2007 20:22:49 -0000      1.1.2.2
@@ -48,11 +48,11 @@
         try
         {
           m_what = this->runtime_error::what();
-          if ( m_error_code )
-          {
-            if ( !m_what.empty() ) m_what += ": ";
-            m_what += m_error_code.message();
-          }
+          //if ( m_error_code )
+          //{
+          //  if ( !m_what.empty() ) m_what += ": ";
+          //  m_what += m_error_code.message();
+          //}
         }
         catch (...) { return runtime_error::what(); }
       }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to