| 1 |
|
| #include <xs.h> |
| 2 |
|
| #include <ios> |
| 3 |
|
| #include <future> |
| 4 |
|
| |
| 5 |
|
| using namespace xs; |
| 6 |
|
| |
| 7 |
|
| #if !defined(_WIN32) && !defined(__DragonFly__) && !defined(__NetBSD__) |
| 8 |
|
| #define _XSFW_SKIP_CHECK 1 |
| 9 |
|
| #endif |
| 10 |
|
| |
| 11 |
37 |
| void register_error_constants () { |
| 12 |
|
| struct ecdata { |
| 13 |
|
| panda::string_view long_name; |
| 14 |
|
| panda::string_view short_name; |
| 15 |
|
| std::errc value; |
| 16 |
|
| }; |
| 17 |
|
| |
| 18 |
37 |
▶ | Stash errc_stash("XS::STL::errc", GV_ADD); |
Branch: 1 branch
| Branch | True | False | Total |
| Stash errc_stash("XS::STL::errc", GV_ADD); |
37 |
0 |
37 |
|
| 19 |
37 |
| std::initializer_list<ecdata> list = { |
| 20 |
|
| {"address_family_not_supported", "EAFNOSUPPORT", std::errc::address_family_not_supported}, |
| 21 |
|
| {"address_in_use", "EADDRINUSE", std::errc::address_in_use}, |
| 22 |
|
| {"address_not_available", "EADDRNOTAVAIL", std::errc::address_not_available}, |
| 23 |
|
| {"already_connected", "EISCONN", std::errc::already_connected}, |
| 24 |
|
| {"argument_list_too_long", "E2BIG", std::errc::argument_list_too_long}, |
| 25 |
|
| {"argument_out_of_domain", "EDOM", std::errc::argument_out_of_domain}, |
| 26 |
|
| {"bad_address", "EFAULT", std::errc::bad_address}, |
| 27 |
|
| {"bad_file_descriptor", "EBADF", std::errc::bad_file_descriptor}, |
| 28 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EBADMSG) |
| 29 |
|
| {"bad_message", "EBADMSG", std::errc::bad_message}, |
| 30 |
|
| #endif |
| 31 |
|
| {"broken_pipe", "EPIPE", std::errc::broken_pipe}, |
| 32 |
|
| {"connection_aborted", "ECONNABORTED", std::errc::connection_aborted}, |
| 33 |
|
| {"connection_already_in_progress", "EALREADY", std::errc::connection_already_in_progress}, |
| 34 |
|
| {"connection_refused", "ECONNREFUSED", std::errc::connection_refused}, |
| 35 |
|
| {"connection_reset", "ECONNRESET", std::errc::connection_reset}, |
| 36 |
|
| {"cross_device_link", "EXDEV", std::errc::cross_device_link}, |
| 37 |
|
| {"destination_address_required", "EDESTADDRREQ", std::errc::destination_address_required}, |
| 38 |
|
| {"device_or_resource_busy", "EBUSY", std::errc::device_or_resource_busy}, |
| 39 |
|
| {"directory_not_empty", "ENOTEMPTY", std::errc::directory_not_empty}, |
| 40 |
|
| {"executable_format_error", "ENOEXEC", std::errc::executable_format_error}, |
| 41 |
|
| {"file_exists", "EEXIST", std::errc::file_exists}, |
| 42 |
|
| {"file_too_large", "EFBIG", std::errc::file_too_large}, |
| 43 |
|
| {"filename_too_long", "ENAMETOOLONG", std::errc::filename_too_long}, |
| 44 |
|
| {"function_not_supported", "ENOSYS", std::errc::function_not_supported}, |
| 45 |
|
| {"host_unreachable", "EHOSTUNREACH", std::errc::host_unreachable}, |
| 46 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EIDRM) |
| 47 |
|
| {"identifier_removed", "EIDRM", std::errc::identifier_removed}, |
| 48 |
|
| #endif |
| 49 |
|
| {"illegal_byte_sequence", "EILSEQ", std::errc::illegal_byte_sequence}, |
| 50 |
|
| {"inappropriate_io_control_operation", "ENOTTY", std::errc::inappropriate_io_control_operation}, |
| 51 |
|
| {"interrupted", "EINTR", std::errc::interrupted}, |
| 52 |
|
| {"invalid_argument", "EINVAL", std::errc::invalid_argument}, |
| 53 |
|
| {"invalid_seek", "ESPIPE", std::errc::invalid_seek}, |
| 54 |
|
| {"io_error", "EIO", std::errc::io_error}, |
| 55 |
|
| {"is_a_directory", "EISDIR", std::errc::is_a_directory}, |
| 56 |
|
| {"message_size", "EMSGSIZE", std::errc::message_size}, |
| 57 |
|
| {"network_down", "ENETDOWN", std::errc::network_down}, |
| 58 |
|
| {"network_reset", "ENETRESET", std::errc::network_reset}, |
| 59 |
|
| {"network_unreachable", "ENETUNREACH", std::errc::network_unreachable}, |
| 60 |
|
| {"no_buffer_space", "ENOBUFS", std::errc::no_buffer_space}, |
| 61 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ECHILD) |
| 62 |
|
| {"no_child_process", "ECHILD", std::errc::no_child_process}, |
| 63 |
|
| #endif |
| 64 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOLINK) |
| 65 |
|
| {"no_link", "ENOLINK", std::errc::no_link}, |
| 66 |
|
| #endif |
| 67 |
|
| {"no_lock_available", "ENOLCK", std::errc::no_lock_available}, |
| 68 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENODATA) |
| 69 |
|
| {"no_message_available", "ENODATA", std::errc::no_message_available}, |
| 70 |
|
| #endif |
| 71 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOMSG) |
| 72 |
|
| {"no_message", "ENOMSG", std::errc::no_message}, |
| 73 |
|
| #endif |
| 74 |
|
| {"no_protocol_option", "ENOPROTOOPT", std::errc::no_protocol_option}, |
| 75 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOSPC) |
| 76 |
|
| {"no_space_on_device", "ENOSPC", std::errc::no_space_on_device}, |
| 77 |
|
| #endif |
| 78 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOSR) |
| 79 |
|
| {"no_stream_resources", "ENOSR", std::errc::no_stream_resources}, |
| 80 |
|
| #endif |
| 81 |
|
| {"no_such_device_or_address", "ENXIO", std::errc::no_such_device_or_address}, |
| 82 |
|
| {"no_such_device", "ENODEV", std::errc::no_such_device}, |
| 83 |
|
| {"no_such_file_or_directory", "ENOENT", std::errc::no_such_file_or_directory}, |
| 84 |
|
| {"no_such_process", "ESRCH", std::errc::no_such_process}, |
| 85 |
|
| {"not_a_directory", "ENOTDIR", std::errc::not_a_directory}, |
| 86 |
|
| {"not_a_socket", "ENOTSOCK", std::errc::not_a_socket}, |
| 87 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOSTR) |
| 88 |
|
| {"not_a_stream", "ENOSTR", std::errc::not_a_stream}, |
| 89 |
|
| #endif |
| 90 |
|
| {"not_connected", "ENOTCONN", std::errc::not_connected}, |
| 91 |
|
| {"not_enough_memory", "ENOMEM", std::errc::not_enough_memory}, |
| 92 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOTSUP) |
| 93 |
|
| {"not_supported", "ENOTSUP", std::errc::not_supported}, |
| 94 |
|
| #endif |
| 95 |
|
| {"operation_canceled", "ECANCELED", std::errc::operation_canceled}, |
| 96 |
|
| {"operation_in_progress", "EINPROGRESS", std::errc::operation_in_progress}, |
| 97 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EPERM) |
| 98 |
|
| {"operation_not_permitted", "EPERM", std::errc::operation_not_permitted}, |
| 99 |
|
| #endif |
| 100 |
|
| {"operation_not_supported", "EOPNOTSUPP", std::errc::operation_not_supported}, |
| 101 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EWOULDBLOCK) |
| 102 |
|
| {"operation_would_block", "EWOULDBLOCK", std::errc::operation_would_block}, |
| 103 |
|
| #endif |
| 104 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EOWNERDEAD) |
| 105 |
|
| {"owner_dead", "EOWNERDEAD", std::errc::owner_dead}, |
| 106 |
|
| #endif |
| 107 |
|
| {"permission_denied", "EACCES", std::errc::permission_denied}, |
| 108 |
|
| {"protocol_error", "EPROTO", std::errc::protocol_error}, |
| 109 |
|
| {"protocol_not_supported", "EPROTONOSUPPORT", std::errc::protocol_not_supported}, |
| 110 |
|
| {"read_only_file_system", "EROFS", std::errc::read_only_file_system}, |
| 111 |
|
| {"resource_deadlock_would_occur", "EDEADLK", std::errc::resource_deadlock_would_occur}, |
| 112 |
|
| {"resource_unavailable_try_again", "EAGAIN", std::errc::resource_unavailable_try_again}, |
| 113 |
|
| {"result_out_of_range", "ERANGE", std::errc::result_out_of_range}, |
| 114 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ENOTRECOVERABLE) |
| 115 |
|
| {"state_not_recoverable", "ENOTRECOVERABLE", std::errc::state_not_recoverable}, |
| 116 |
|
| #endif |
| 117 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ETIME) |
| 118 |
|
| {"stream_timeout", "ETIME", std::errc::stream_timeout}, |
| 119 |
|
| #endif |
| 120 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ETXTBSY) |
| 121 |
|
| {"text_file_busy", "ETXTBSY", std::errc::text_file_busy}, |
| 122 |
|
| #endif |
| 123 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_ETIMEDOUT) || defined(__NetBSD__) |
| 124 |
|
| {"timed_out", "ETIMEDOUT", std::errc::timed_out}, |
| 125 |
|
| #endif |
| 126 |
|
| {"too_many_files_open_in_system", "ENFILE", std::errc::too_many_files_open_in_system}, |
| 127 |
|
| {"too_many_files_open", "EMFILE", std::errc::too_many_files_open}, |
| 128 |
|
| {"too_many_links", "EMLINK", std::errc::too_many_links}, |
| 129 |
|
| {"too_many_symbolic_link_levels", "ELOOP", std::errc::too_many_symbolic_link_levels}, |
| 130 |
|
| #if _XSFW_SKIP_CHECK || defined(_GLIBCXX_HAVE_EOVERFLOW) |
| 131 |
|
| {"value_too_large", "EOVERFLOW", std::errc::value_too_large}, |
| 132 |
|
| #endif |
| 133 |
|
| {"wrong_protocol_type", "EPROTOTYPE", std::errc::wrong_protocol_type}, |
| 134 |
37 |
| }; |
| 135 |
|
| |
| 136 |
2923 |
▶ | for (const auto& item : list) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (const auto& item : list) { |
2886 |
37 |
2923 |
|
| 137 |
2886 |
▶ | auto v = xs::out(make_error_code(item.value)); |
Branch: 1 branch
| Branch | True | False | Total |
| auto v = xs::out(make_error_code(item.value)); |
2886 |
0 |
2886 |
|
| 138 |
2886 |
▶ | errc_stash.add_const_sub(item.long_name, v); |
Branch: 1 branch
| Branch | True | False | Total |
| errc_stash.add_const_sub(item.long_name, v); |
2886 |
0 |
2886 |
|
| 139 |
2886 |
▶ | errc_stash.add_const_sub(item.short_name, v); |
Branch: 1 branch
| Branch | True | False | Total |
| errc_stash.add_const_sub(item.short_name, v); |
2886 |
0 |
2886 |
|
| 140 |
2886 |
| } |
| 141 |
|
| |
| 142 |
37 |
▶ | Stash future_errc_stash("XS::STL::future_errc", GV_ADD); |
Branch: 1 branch
| Branch | True | False | Total |
| Stash future_errc_stash("XS::STL::future_errc", GV_ADD); |
37 |
0 |
37 |
|
| 143 |
37 |
▶ | future_errc_stash.add_const_sub("broken_promise", Simple(int(std::future_errc::broken_promise))); |
Branch: 2 branches
| Branch | True | False | Total |
| future_errc_stash.add_const_sub("broken_promise", Simple(int(std::future_errc::broken_promise))); |
37 |
0 |
37 |
| future_errc_stash.add_const_sub("broken_promise", Simple(int(std::future_errc::broken_promise))); |
37 |
0 |
37 |
|
| 144 |
37 |
▶ | future_errc_stash.add_const_sub("future_already_retrieved", Simple(int(std::future_errc::future_already_retrieved))); |
Branch: 2 branches
| Branch | True | False | Total |
| future_errc_stash.add_const_sub("future_already_retrieved", Simple(int(std::future_errc::future_already_retrieved))); |
37 |
0 |
37 |
| future_errc_stash.add_const_sub("future_already_retrieved", Simple(int(std::future_errc::future_already_retrieved))); |
37 |
0 |
37 |
|
| 145 |
37 |
▶ | future_errc_stash.add_const_sub("promise_already_satisfied", Simple(int(std::future_errc::promise_already_satisfied))); |
Branch: 2 branches
| Branch | True | False | Total |
| future_errc_stash.add_const_sub("promise_already_satisfied", Simple(int(std::future_errc::promise_already_satisfied))); |
37 |
0 |
37 |
| future_errc_stash.add_const_sub("promise_already_satisfied", Simple(int(std::future_errc::promise_already_satisfied))); |
37 |
0 |
37 |
|
| 146 |
37 |
▶ | future_errc_stash.add_const_sub("no_state", Simple(int(std::future_errc::no_state))); |
Branch: 2 branches
| Branch | True | False | Total |
| future_errc_stash.add_const_sub("no_state", Simple(int(std::future_errc::no_state))); |
37 |
0 |
37 |
| future_errc_stash.add_const_sub("no_state", Simple(int(std::future_errc::no_state))); |
37 |
0 |
37 |
|
| 147 |
|
| |
| 148 |
37 |
▶ | Stash stl_stash("XS::STL", GV_ADD); |
Branch: 1 branch
| Branch | True | False | Total |
| Stash stl_stash("XS::STL", GV_ADD); |
37 |
0 |
37 |
|
| 149 |
37 |
▶ | stl_stash.add_const_sub("generic_category", xs::out<const std::error_category*>(&std::generic_category())); |
Branch: 2 branches
| Branch | True | False | Total |
| stl_stash.add_const_sub("generic_category", xs::out<const std::error_category*>(&std::generic_category())); |
37 |
0 |
37 |
| stl_stash.add_const_sub("generic_category", xs::out<const std::error_category*>(&std::generic_category())); |
37 |
0 |
37 |
|
| 150 |
37 |
▶ | stl_stash.add_const_sub("system_category", xs::out<const std::error_category*>(&std::system_category())); |
Branch: 2 branches
| Branch | True | False | Total |
| stl_stash.add_const_sub("system_category", xs::out<const std::error_category*>(&std::system_category())); |
37 |
0 |
37 |
| stl_stash.add_const_sub("system_category", xs::out<const std::error_category*>(&std::system_category())); |
37 |
0 |
37 |
|
| 151 |
37 |
▶ | stl_stash.add_const_sub("future_category", xs::out<const std::error_category*>(&std::future_category())); |
Branch: 2 branches
| Branch | True | False | Total |
| stl_stash.add_const_sub("future_category", xs::out<const std::error_category*>(&std::future_category())); |
37 |
0 |
37 |
| stl_stash.add_const_sub("future_category", xs::out<const std::error_category*>(&std::future_category())); |
37 |
0 |
37 |
|
| 152 |
37 |
| } |