XS-Framework

 view release on metacpan or  search on metacpan

regerror.cc  view on Meta::CPAN

#include <xs.h>
#include <ios>
#include <future>

using namespace xs;

#if !defined(_WIN32) && !defined(__DragonFly__) && !defined(__NetBSD__)
  #define _XSFW_SKIP_CHECK 1
#endif

void register_error_constants () {
    struct ecdata {
        panda::string_view long_name;
        panda::string_view short_name;
        std::errc          value;
    };
    
    Stash errc_stash("XS::STL::errc", GV_ADD);
    std::initializer_list<ecdata> list = {
        {"address_family_not_supported",        "EAFNOSUPPORT",     std::errc::address_family_not_supported},
        {"address_in_use",                      "EADDRINUSE",       std::errc::address_in_use},
        {"address_not_available",               "EADDRNOTAVAIL",    std::errc::address_not_available},
        {"already_connected",                   "EISCONN",          std::errc::already_connected},
        {"argument_list_too_long",              "E2BIG",            std::errc::argument_list_too_long},
        {"argument_out_of_domain",              "EDOM",             std::errc::argument_out_of_domain},
        {"bad_address",                         "EFAULT",           std::errc::bad_address},
        {"bad_file_descriptor",                 "EBADF",            std::errc::bad_file_descriptor},
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EBADMSG)
        {"bad_message",                         "EBADMSG",          std::errc::bad_message},
        #endif
        {"broken_pipe",                         "EPIPE",            std::errc::broken_pipe},
        {"connection_aborted",                  "ECONNABORTED",     std::errc::connection_aborted},
        {"connection_already_in_progress",      "EALREADY",         std::errc::connection_already_in_progress},
        {"connection_refused",                  "ECONNREFUSED",     std::errc::connection_refused},
        {"connection_reset",                    "ECONNRESET",       std::errc::connection_reset},
        {"cross_device_link",                   "EXDEV",            std::errc::cross_device_link},
        {"destination_address_required",        "EDESTADDRREQ",     std::errc::destination_address_required},
        {"device_or_resource_busy",             "EBUSY",            std::errc::device_or_resource_busy},
        {"directory_not_empty",                 "ENOTEMPTY",        std::errc::directory_not_empty},
        {"executable_format_error",             "ENOEXEC",          std::errc::executable_format_error},
        {"file_exists",                         "EEXIST",           std::errc::file_exists},
        {"file_too_large",                      "EFBIG",            std::errc::file_too_large},
        {"filename_too_long",                   "ENAMETOOLONG",     std::errc::filename_too_long},
        {"function_not_supported",              "ENOSYS",           std::errc::function_not_supported},
        {"host_unreachable",                    "EHOSTUNREACH",     std::errc::host_unreachable},
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EIDRM)
        {"identifier_removed",                  "EIDRM",            std::errc::identifier_removed},
        #endif
        {"illegal_byte_sequence",               "EILSEQ",           std::errc::illegal_byte_sequence},
        {"inappropriate_io_control_operation",  "ENOTTY",           std::errc::inappropriate_io_control_operation},
        {"interrupted",                         "EINTR",            std::errc::interrupted},
        {"invalid_argument",                    "EINVAL",           std::errc::invalid_argument},
        {"invalid_seek",                        "ESPIPE",           std::errc::invalid_seek},
        {"io_error",                            "EIO",              std::errc::io_error},
        {"is_a_directory",                      "EISDIR",           std::errc::is_a_directory},
        {"message_size",                        "EMSGSIZE",         std::errc::message_size},
        {"network_down",                        "ENETDOWN",         std::errc::network_down},
        {"network_reset",                       "ENETRESET",        std::errc::network_reset},
        {"network_unreachable",                 "ENETUNREACH",      std::errc::network_unreachable},
        {"no_buffer_space",                     "ENOBUFS",          std::errc::no_buffer_space},
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ECHILD)
        {"no_child_process",                    "ECHILD",           std::errc::no_child_process},
        #endif
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOLINK)
        {"no_link",                             "ENOLINK",          std::errc::no_link},
        #endif
        {"no_lock_available",                   "ENOLCK",           std::errc::no_lock_available},
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENODATA)
        {"no_message_available",                "ENODATA",          std::errc::no_message_available},
        #endif
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOMSG)
        {"no_message",                          "ENOMSG",           std::errc::no_message},
        #endif
        {"no_protocol_option",                  "ENOPROTOOPT",      std::errc::no_protocol_option},
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOSPC)
        {"no_space_on_device",                  "ENOSPC",           std::errc::no_space_on_device},
        #endif
        #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOSR)
        {"no_stream_resources",                 "ENOSR",            std::errc::no_stream_resources},



( run in 2.522 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )