diff --git a/include/fast_io_core_impl/concepts/type.h b/include/fast_io_core_impl/concepts/type.h index 77f6ad81f..cbca254a0 100644 --- a/include/fast_io_core_impl/concepts/type.h +++ b/include/fast_io_core_impl/concepts/type.h @@ -141,4 +141,11 @@ struct io_cookie_t inline constexpr io_cookie_t io_cookie{}; +struct io_null_t +{ + explicit inline constexpr io_null_t() noexcept = default; +}; + +inline constexpr io_null_t io_null{}; + } // namespace fast_io diff --git a/include/fast_io_core_impl/integers/impl.h b/include/fast_io_core_impl/integers/impl.h index e1c2ab4dc..13b8075b3 100644 --- a/include/fast_io_core_impl/integers/impl.h +++ b/include/fast_io_core_impl/integers/impl.h @@ -1640,7 +1640,7 @@ inline constexpr auto nullptr_print_optimization_call_impl() noexcept constexpr ::std::size_t sz{nullptr_print_optimization_call_size_cache}; ::fast_io::freestanding::array arr{}; - auto res{print_reserve_integral_define( + [[maybe_unused]] auto res{print_reserve_integral_define( arr.data(), ::std::size_t{})}; return arr; } diff --git a/include/fast_io_core_impl/operations/print_freestanding.h b/include/fast_io_core_impl/operations/print_freestanding.h index 92633ef6e..20df211ad 100644 --- a/include/fast_io_core_impl/operations/print_freestanding.h +++ b/include/fast_io_core_impl/operations/print_freestanding.h @@ -15,6 +15,7 @@ struct contiguous_scatter_result ::std::size_t position{}; ::std::size_t neededscatters{}; ::std::size_t neededspace{}; + ::std::size_t null{}; bool lastisreserve{}; bool hasscatters{}; bool hasreserve{}; @@ -85,6 +86,19 @@ inline constexpr contiguous_scatter_result find_continuous_scatters_n() ret.neededscatters = ::fast_io::details::intrinsics::add_or_overflow_die_chain(ret.neededscatters, scatszres.scatters_size); } + else if constexpr (::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) + { + if constexpr (sizeof...(Args) != 0) + { + ret = find_continuous_scatters_n(); + } + ++ret.position; + ret.null = ::fast_io::details::intrinsics::add_or_overflow_die_chain(ret.null, + static_cast<::std::size_t>(1)); + } + else if constexpr (::fast_io::printable) + { + } return ret; } @@ -92,6 +106,7 @@ struct scatter_rsv_result { ::std::size_t position{}; ::std::size_t neededspace{}; + ::std::size_t null{}; }; template @@ -102,29 +117,41 @@ inline constexpr scatter_rsv_result find_continuous_scatters_reserve_n() constexpr ::std::size_t sz{print_reserve_size(::fast_io::io_reserve_type)}; if constexpr (sizeof...(Args) == 0) { - return {1, sz}; + return {1, sz, 0}; } else { auto res{find_continuous_scatters_reserve_n()}; - return {res.position + 1, ::fast_io::details::intrinsics::add_or_overflow_die_chain(res.neededspace, sz)}; + return {res.position + 1, ::fast_io::details::intrinsics::add_or_overflow_die_chain(res.neededspace, sz), res.null}; } } else if constexpr (::fast_io::scatter_printable && findscatter) { if constexpr (sizeof...(Args) == 0) { - return {1, 0}; + return {1, 0, 0}; + } + else + { + auto res{find_continuous_scatters_reserve_n()}; + return {res.position + 1, res.neededspace, res.null}; + } + } + else if constexpr (::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) + { + if constexpr (sizeof...(Args) == 0) + { + return {1, 0, ::fast_io::details::intrinsics::add_or_overflow_die_chain(static_cast<::std::size_t>(0), static_cast<::std::size_t>(1))}; } else { auto res{find_continuous_scatters_reserve_n()}; - return {res.position + 1, 0}; + return {res.position + 1, res.neededspace, ::fast_io::details::intrinsics::add_or_overflow_die_chain(res.null, static_cast<::std::size_t>(1))}; } } else { - return {0, 0}; + return {0, 0, 0}; } } @@ -253,26 +280,28 @@ inline constexpr void print_control_single(output outstm, T t) write(outstm,scatter.base,scatter.base+scatter.len); } #endif + basic_io_scatter_t scatter_res{print_scatter_define(::fast_io::io_reserve_type, t)}; + if constexpr (line) { if constexpr (::fast_io::operations::decay::defines::has_any_of_write_or_seek_pwrite_bytes_operations< output>) { ::fast_io::io_scatter_t scatters[2]{ - {t.base, t.len * sizeof(char_type)}, + {scatter_res.base, scatter_res.len * sizeof(char_type)}, {__builtin_addressof(char_literal_v), sizeof(char_type)}}; ::fast_io::operations::decay::scatter_write_all_bytes_decay(outstm, scatters, 2); } else { ::fast_io::basic_io_scatter_t scatters[2]{ - t, {__builtin_addressof(char_literal_v), 1}}; + scatter_res, {__builtin_addressof(char_literal_v), 1}}; ::fast_io::operations::decay::scatter_write_all_decay(outstm, scatters, 2); } } else { - ::fast_io::operations::decay::write_all_decay(outstm, t.base, t.base + t.len); + ::fast_io::operations::decay::write_all_decay(outstm, scatter_res.base, scatter_res.base + scatter_res.len); } } else if constexpr (reserve_printable) @@ -612,6 +641,9 @@ inline constexpr void print_control_single(output outstm, T t) ::fast_io::operations::decay::char_put_decay(outstm, lfch); } } + else if constexpr (::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) + { + } else { constexpr bool no{printable}; @@ -691,14 +723,28 @@ inline constexpr char_type *print_n_reserve(char_type *ptr, T t, Args... args) } else { - ptr = print_reserve_define(::fast_io::io_reserve_type>, ptr, t); - if constexpr (sizeof...(Args) == 0 || n < 2) + if constexpr (::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) { - return ptr; + if constexpr (sizeof...(Args) == 0 || n < 2) + { + return ptr; + } + else + { + return print_n_reserve(ptr, args...); + } } else { - return print_n_reserve(ptr, args...); + ptr = print_reserve_define(::fast_io::io_reserve_type>, ptr, t); + if constexpr (sizeof...(Args) == 0 || n < 2) + { + return ptr; + } + else + { + return print_n_reserve(ptr, args...); + } } } } @@ -721,7 +767,14 @@ inline constexpr void print_n_scatters(basic_io_scatter_t *pscatter { if constexpr (n != 0) { - if constexpr (::std::same_as<::std::remove_cvref_t, basic_io_scatter_t>) + if constexpr (::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) + { + if constexpr (1 < n) + { + return print_n_scatters(pscatters, args...); + } + } + else if constexpr (::std::same_as<::std::remove_cvref_t, basic_io_scatter_t>) { if constexpr (::std::same_as) { @@ -1007,6 +1060,19 @@ inline constexpr auto print_n_scatters_reserve(basic_io_scatter_t * return pit; } } + else if constexpr (::std::same_as) + { + if constexpr (n == 1 && needprintlf) + { + *pscatters = ::fast_io::details::decay::line_scatter_common; + ++pscatters; + } + if constexpr (1 < n) + { + return ::fast_io::details::decay::print_n_scatters_reserve(pscatters, + ptr, args...); + } + } } return pscatters; } @@ -1050,7 +1116,7 @@ inline constexpr void print_controls_impl(outputstmtype optstm, T t, Args... arg ::fast_io::details::decay::print_n_scatters(scatters, t, args...); if constexpr (needprintlf) { - scatters[n] = ::fast_io::details::decay::line_scatter_common< + scatters[scatterscount - 1] = ::fast_io::details::decay::line_scatter_common< char_type, ::std::conditional_t<::std::same_as, void, char_type>>; } if constexpr (::fast_io::operations::decay::defines::has_any_of_write_or_seek_pwrite_bytes_operations< @@ -1063,6 +1129,10 @@ inline constexpr void print_controls_impl(outputstmtype optstm, T t, Args... arg ::fast_io::operations::decay::scatter_write_all_decay(optstm, scatters, scatterscount); } } + if constexpr (res.position != n) + { + print_controls_impl(optstm, args...); + } } else { @@ -1191,7 +1261,7 @@ inline constexpr void print_controls_buffer_impl(outputstmtype optstm, T t, Args static_assert(scatters_result.position != SIZE_MAX); } constexpr bool needprintlf{n == scatters_result.position && line}; - constexpr ::std::size_t scatterscount{scatters_result.position + static_cast<::std::size_t>(needprintlf)}; + constexpr ::std::size_t scatterscount{scatters_result.position - scatters_result.null + static_cast<::std::size_t>(needprintlf)}; scatter_type scatters[scatterscount]; ::fast_io::details::decay::print_n_scatters(scatters, t, args...); if constexpr (::fast_io::operations::decay::defines::has_any_of_write_or_seek_pwrite_bytes_operations< @@ -1353,7 +1423,7 @@ concept print_freestanding_params_okay = ((::fast_io::printable || ::fast_io::reserve_printable || ::fast_io::dynamic_reserve_printable || ::fast_io::scatter_printable || ::fast_io::reserve_scatters_printable || ::fast_io::context_printable || - ::fast_io::transcode_imaginary_printable) && + ::fast_io::transcode_imaginary_printable || ::std::same_as<::std::remove_cvref_t, ::fast_io::io_null_t>) && ...); template diff --git a/include/fast_io_core_impl/operations/transcodeimpl/transcoder.h b/include/fast_io_core_impl/operations/transcodeimpl/transcoder.h index 7f9142739..b9d672275 100644 --- a/include/fast_io_core_impl/operations/transcodeimpl/transcoder.h +++ b/include/fast_io_core_impl/operations/transcodeimpl/transcoder.h @@ -13,10 +13,12 @@ struct basic_transcoder_t using transcoder_value_type = T; using manip_tag = ::fast_io::manip_tag_t; ::fast_io::basic_io_scatter_t reference; +#ifndef __INTELLISENSE__ #if __has_cpp_attribute(msvc::no_unique_address) [[msvc::no_unique_address]] #else [[no_unique_address]] +#endif #endif transcoder_value_type transcoder; }; diff --git a/include/fast_io_driver/install_path/argv0_null.h b/include/fast_io_driver/install_path/argv0_null.h index 9475f6723..8cca36f28 100644 --- a/include/fast_io_driver/install_path/argv0_null.h +++ b/include/fast_io_driver/install_path/argv0_null.h @@ -6,7 +6,7 @@ namespace fast_io::details [[__gnu__::__cold__]] #endif [[noreturn]] -inline ::fast_io::install_path get_module_install_path_from_argv0(char const *argv0) +inline ::fast_io::install_path get_module_install_path_from_argv0([[maybe_unused]] char const *argv0) { throw_win32_error(0); } diff --git a/include/fast_io_dsal/impl/array.h b/include/fast_io_dsal/impl/array.h index b493b785e..7465a08d8 100644 --- a/include/fast_io_dsal/impl/array.h +++ b/include/fast_io_dsal/impl/array.h @@ -20,10 +20,12 @@ class array using const_iterator = const_pointer; using reverse_iterator = ::std::reverse_iterator; using const_reverse_iterator = ::std::reverse_iterator; +#ifndef __INTELLISENSE__ #if __has_cpp_attribute(no_unique_address) [[no_unique_address]] #elif __has_cpp_attribute(msvc::no_unique_address) [[msvc::no_unique_address]] +#endif #endif value_type element[N]; diff --git a/include/fast_io_dsal/impl/tuple.h b/include/fast_io_dsal/impl/tuple.h index ff073d38d..9df36edd1 100644 --- a/include/fast_io_dsal/impl/tuple.h +++ b/include/fast_io_dsal/impl/tuple.h @@ -51,10 +51,12 @@ using pack_indexing_t_ = typename pack_indexing_::type; template <::std::size_t I, typename T> struct tuple_element_impl_ { +#ifndef __INTELLISENSE__ #if __has_cpp_attribute(msvc::no_unique_address) [[msvc::no_unique_address]] #elif __has_cpp_attribute(no_unique_address) [[no_unique_address]] +#endif #endif T val_; }; @@ -90,6 +92,14 @@ struct tuple<> template tuple(Args &&...) -> tuple; +template <::std::size_t I, typename... Args> +FAST_IO_GNU_ALWAYS_INLINE +[[nodiscard]] +constexpr auto&& get(::fast_io::containers::tuple &self) noexcept +{ + return static_cast<::fast_io::containers::details::tuple_element_impl_> &>(self).val_; +} + template <::std::size_t I, typename... Args> FAST_IO_GNU_ALWAYS_INLINE [[nodiscard]] @@ -98,6 +108,15 @@ constexpr auto&& get(::fast_io::containers::tuple const &self) noexcept return static_cast<::fast_io::containers::details::tuple_element_impl_> const &>(self).val_; } +template <::std::size_t I, typename... Args> +FAST_IO_GNU_ALWAYS_INLINE +[[nodiscard]] +constexpr auto&& get(::fast_io::containers::tuple &&self) noexcept +{ + return ::std::move( + static_cast<::fast_io::containers::details::tuple_element_impl_> &&>(self).val_); +} + template <::std::size_t I, typename... Args> FAST_IO_GNU_ALWAYS_INLINE [[nodiscard]] diff --git a/include/fast_io_dsal/impl/vector.h b/include/fast_io_dsal/impl/vector.h index 5687a37d3..f0b66dd05 100644 --- a/include/fast_io_dsal/impl/vector.h +++ b/include/fast_io_dsal/impl/vector.h @@ -228,7 +228,7 @@ class vector FAST_IO_TRIVIALLY_RELOCATABLE_IF_ELIGIBLE using difference_type = ::std::ptrdiff_t; ::fast_io::containers::details::vector_internal imp; - inline explicit constexpr vector() noexcept = default; + inline constexpr vector() noexcept = default; private: inline constexpr void destroy() noexcept diff --git a/include/fast_io_freestanding_impl/cond.h b/include/fast_io_freestanding_impl/cond.h index 09c6b15bb..52ff3a8e6 100644 --- a/include/fast_io_freestanding_impl/cond.h +++ b/include/fast_io_freestanding_impl/cond.h @@ -71,6 +71,27 @@ inline constexpr auto cond(bool pred, T1 &&t1, T2 &&t2) noexcept } } +template +inline constexpr auto cond(bool pred, T1 &&t1) noexcept +{ + using t1aliastype = + ::std::conditional_t<::fast_io::details::alias_return_lvalue_ref, + ::std::conditional_t<::fast_io::details::cond_value_transferable, + ::std::remove_cvref_t, ::std::remove_cvref_t const &>, + ::std::remove_cvref_t(t1)))>>; + + constexpr bool type_match{::std::same_as}; + if constexpr (type_match) + { + return ::fast_io::io_null; + } + else + { + return condition{::fast_io::io_print_alias(::std::forward(t1)), + ::fast_io::io_null, pred}; + } +} + } // namespace manipulators namespace details @@ -137,6 +158,88 @@ print_scatter_define(io_reserve_type_t + requires(reserve_printable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>) noexcept +{ + constexpr ::std::size_t s1{print_reserve_size(io_reserve_type)}; + return s1; +} + +template <::std::integral char_type, typename T1> + requires(scatter_printable && details::cond_value_transferable) +inline constexpr basic_io_scatter_t +print_scatter_define(io_reserve_type_t>, + ::fast_io::manipulators::condition c) +{ + if (c.pred) + { + return {print_scatter_define(io_reserve_type, c.t1)}; + } + else + { + return basic_io_scatter_t{}; + } +} + +template <::std::integral char_type, typename T1> + requires(scatter_printable && !details::cond_value_transferable) +inline constexpr basic_io_scatter_t +print_scatter_define(io_reserve_type_t>, + ::fast_io::manipulators::condition const &c) +{ + if (c.pred) + { + return {print_scatter_define(io_reserve_type, c.t1)}; + } + else + { + return basic_io_scatter_t{}; + } +} + +template <::std::integral char_type, typename T2> + requires(reserve_printable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>) noexcept +{ + constexpr ::std::size_t s2{print_reserve_size(io_reserve_type)}; + return s2; +} + +template <::std::integral char_type, typename T2> + requires(scatter_printable && details::cond_value_transferable) +inline constexpr basic_io_scatter_t +print_scatter_define(io_reserve_type_t>, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> c) +{ + if (!c.pred) + { + return {print_scatter_define(io_reserve_type, c.t2)}; + } + else + { + return basic_io_scatter_t{}; + } +} + +template <::std::integral char_type, typename T2> + requires(scatter_printable && !details::cond_value_transferable) +inline constexpr basic_io_scatter_t +print_scatter_define(io_reserve_type_t>, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> const &c) +{ + if (!c.pred) + { + return {print_scatter_define(io_reserve_type, c.t2)}; + } + else + { + return basic_io_scatter_t{}; + } +} + namespace details { @@ -217,7 +320,7 @@ inline constexpr char_type *cond_print_reserve_define_impl(char_type *iter, T1 c template <::std::integral char_type, typename T1, typename T2> requires((details::cond_ok_dynamic_rsv_printable_impl && - details::cond_ok_dynamic_rsv_printable_impl) && + details::cond_ok_dynamic_rsv_printable_impl) && (!(scatter_printable && scatter_printable)) && details::cond_transferable_value) inline constexpr ::std::size_t @@ -236,7 +339,7 @@ print_reserve_size(io_reserve_type_t requires((details::cond_ok_dynamic_rsv_printable_impl && - details::cond_ok_dynamic_rsv_printable_impl) && + details::cond_ok_dynamic_rsv_printable_impl) && (!(scatter_printable && scatter_printable)) && !details::cond_transferable_value) inline constexpr ::std::size_t @@ -291,6 +394,142 @@ print_reserve_define(io_reserve_type_t + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + details::cond_value_transferable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>, + ::fast_io::manipulators::condition c) +{ + if (c.pred) + { + return ::fast_io::details::cond_print_reserve_size_impl(c.t1); + } + else + { + return 0; + } +} + +template <::std::integral char_type, typename T1> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + !details::cond_value_transferable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>, + ::fast_io::manipulators::condition const &c) +{ + if (c.pred) + { + return ::fast_io::details::cond_print_reserve_size_impl(c.t1); + } + else + { + return 0; + } +} + +template <::std::integral char_type, typename T1> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + details::cond_value_transferable) +inline constexpr char_type * +print_reserve_define(io_reserve_type_t>, char_type *iter, + ::fast_io::manipulators::condition c) +{ + if (c.pred) + { + return ::fast_io::details::cond_print_reserve_define_impl(iter, c.t1); + } + else + { + return iter; + } +} + +template <::std::integral char_type, typename T1> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + !details::cond_value_transferable) +inline constexpr char_type * +print_reserve_define(io_reserve_type_t>, char_type *iter, + ::fast_io::manipulators::condition const &c) +{ + if (c.pred) + { + return ::fast_io::details::cond_print_reserve_define_impl(iter, c.t1); + } + else + { + return iter; + } +} + +template <::std::integral char_type, typename T2> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + details::cond_value_transferable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> c) +{ + if (!c.pred) + { + return ::fast_io::details::cond_print_reserve_size_impl(c.t2); + } + else + { + return 0; + } +} + +template <::std::integral char_type, typename T2> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + !details::cond_value_transferable) +inline constexpr ::std::size_t +print_reserve_size(io_reserve_type_t>, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> const &c) +{ + if (!c.pred) + { + return ::fast_io::details::cond_print_reserve_size_impl(c.t2); + } + else + { + return 0; + } +} + +template <::std::integral char_type, typename T2> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + details::cond_value_transferable) +inline constexpr char_type * +print_reserve_define(io_reserve_type_t>, char_type *iter, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> c) +{ + if (!c.pred) + { + return ::fast_io::details::cond_print_reserve_define_impl(iter, c.t2); + } + else + { + return iter; + } +} + +template <::std::integral char_type, typename T2> + requires(details::cond_ok_dynamic_rsv_printable_impl && !scatter_printable && + !details::cond_value_transferable) +inline constexpr char_type * +print_reserve_define(io_reserve_type_t>, char_type *iter, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> const &c) +{ + if (!c.pred) + { + return ::fast_io::details::cond_print_reserve_define_impl(iter, c.t2); + } + else + { + return iter; + } +} + template <::std::integral char_type, typename T1, typename T2, typename bop> requires((details::cond_ok_printable_impl && details::cond_ok_printable_impl) && (!(details::cond_ok_dynamic_rsv_printable_impl && @@ -327,4 +566,51 @@ inline constexpr void print_define(io_reserve_type_t + requires(details::cond_ok_printable_impl && !details::cond_ok_dynamic_rsv_printable_impl && + details::cond_value_transferable) +inline constexpr void print_define(io_reserve_type_t>, bop b, + ::fast_io::manipulators::condition c) +{ + if (c.pred) + { + ::fast_io::operations::print_freestanding(b, c.t1); + } +} + +template <::std::integral char_type, typename T1, typename bop> + requires(details::cond_ok_printable_impl && !details::cond_ok_dynamic_rsv_printable_impl && + !details::cond_value_transferable) +inline constexpr void print_define(io_reserve_type_t>, bop b, + ::fast_io::manipulators::condition const &c) +{ + if (c.pred) + { + ::fast_io::operations::print_freestanding(b, c.t1); + } +} + +template <::std::integral char_type, typename T2, typename bop> + requires(details::cond_ok_printable_impl && !details::cond_ok_dynamic_rsv_printable_impl && + details::cond_value_transferable) +inline constexpr void print_define(io_reserve_type_t>, bop b, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> c) +{ + if (!c.pred) + { + ::fast_io::operations::print_freestanding(b, c.t2); + } +} + +template <::std::integral char_type, typename T2, typename bop> + requires(details::cond_ok_printable_impl && !details::cond_ok_dynamic_rsv_printable_impl && + !details::cond_value_transferable) +inline constexpr void print_define(io_reserve_type_t>, bop b, + ::fast_io::manipulators::condition<::fast_io::io_null_t, T2> const &c) +{ + if (!c.pred) + { + ::fast_io::operations::print_freestanding(b, c.t2); + } +} } // namespace fast_io diff --git a/include/fast_io_freestanding_impl/decorators/deco_partial_adapter.h b/include/fast_io_freestanding_impl/decorators/deco_partial_adapter.h index 95f3f529a..5aa3d86dd 100644 --- a/include/fast_io_freestanding_impl/decorators/deco_partial_adapter.h +++ b/include/fast_io_freestanding_impl/decorators/deco_partial_adapter.h @@ -11,10 +11,12 @@ struct deco_partial_adapter static inline constexpr ::std::size_t remained_max{T::remained_max}; static inline constexpr ::std::size_t output_final_max{T::output_final_max}; using decorator_type = T; +#ifndef __INTELLISENSE__ #if __has_cpp_attribute(msvc::no_unique_address) [[msvc::no_unique_address]] #elif __has_cpp_attribute(no_unique_address) [[no_unique_address]] +#endif #endif T deco; ::std::size_t remained{}; diff --git a/include/fast_io_hosted/platforms/nt/nt_api.h b/include/fast_io_hosted/platforms/nt/nt_api.h index 38f19af15..5d344f217 100644 --- a/include/fast_io_hosted/platforms/nt/nt_api.h +++ b/include/fast_io_hosted/platforms/nt/nt_api.h @@ -136,5 +136,8 @@ FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtDeviceIoControlFile FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwDeviceIoControlFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine *, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwDeviceIoControlFile, 40); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlAcquirePrivilege(::fast_io::win32::nt::privileges *, ::std::uint_least32_t, ::std::uint_least32_t, void **) noexcept FAST_IO_WINSTDCALL_RENAME(RtlAcquirePrivilege, 16); FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlReleasePrivilege(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlReleasePrivilege, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlQueryEnvironmentVariable_U(void *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlQueryEnvironmentVariable_U, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtSetInformationVirtualMemory(void *, ::fast_io::win32::nt::virtual_memory_information_class, ::std::size_t, ::fast_io::win32::nt::memory_range_entry *, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtSetInformationVirtualMemory, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwSetInformationVirtualMemory(void *, ::fast_io::win32::nt::virtual_memory_information_class, ::std::size_t, ::fast_io::win32::nt::memory_range_entry *, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtSetInformationVirtualMemory, 24); } // namespace fast_io::win32::nt diff --git a/include/fast_io_hosted/platforms/nt/nt_definitions.h b/include/fast_io_hosted/platforms/nt/nt_definitions.h index 215261c8c..5f3a64595 100644 --- a/include/fast_io_hosted/platforms/nt/nt_definitions.h +++ b/include/fast_io_hosted/platforms/nt/nt_definitions.h @@ -1341,4 +1341,17 @@ enum class privileges : ::std::uint_least64_t SE_DELEGATE_SESSION_USER_IMPERSONATE_PRIVILEGE = 36, }; +struct memory_range_entry +{ + void* VirtualAddress; + ::std::size_t NumberOfBytes; +}; + +enum class virtual_memory_information_class +{ + VmPrefetchInformation, + VmPagePriorityInformation, + VmCfgCallTargetInformation +}; + } // namespace fast_io::win32::nt diff --git a/include/fast_io_hosted/platforms/nt/nt_zw.h b/include/fast_io_hosted/platforms/nt/nt_zw.h index 92ab4aa18..88171e150 100644 --- a/include/fast_io_hosted/platforms/nt/nt_zw.h +++ b/include/fast_io_hosted/platforms/nt/nt_zw.h @@ -688,4 +688,17 @@ inline ::std::uint_least32_t nt_device_io_control_file(Args... args) noexcept } } +template + requires(sizeof...(Args) == 6) +inline ::std::uint_least32_t nt_set_information_virtual_memory(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwSetInformationVirtualMemory(args...); + } + else + { + return ::fast_io::win32::nt::NtSetInformationVirtualMemory(args...); + } +} } // namespace fast_io::win32::nt diff --git a/include/fast_io_hosted/platforms/posix.h b/include/fast_io_hosted/platforms/posix.h index 09153f7d1..a767b972f 100644 --- a/include/fast_io_hosted/platforms/posix.h +++ b/include/fast_io_hosted/platforms/posix.h @@ -677,7 +677,7 @@ inline constexpr posix_file_status struct_stat_to_posix_file_status(stat_model & {st.st_mtime, {}}, {st.st_ctime, {}}, {0, 0}, -#elif !defined(__CYGWIN__) && (defined(__BSD_VISIBLE) || defined(__DARWIN_C_LEVEL)) && !defined(_PICOLIBC__) && \ +#elif !defined(__NEWLIB__) && !defined(__CYGWIN__) && (defined(__BSD_VISIBLE) || defined(__DARWIN_C_LEVEL)) && !defined(_PICOLIBC__) && \ !defined(__linux__) static_cast<::fast_io::uintfpos_t>(st.st_blksize), static_cast<::fast_io::uintfpos_t>(st.st_blocks), @@ -693,9 +693,15 @@ inline constexpr posix_file_status struct_stat_to_posix_file_status(stat_model & #else static_cast<::fast_io::uintfpos_t>(st.st_blksize), static_cast<::fast_io::uintfpos_t>(st.st_blocks), +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) + {st.st_atime, 0}, + {st.st_mtime, 0}, + {st.st_ctime, 0}, +#else timespec_to_unix_timestamp(st.st_atim), timespec_to_unix_timestamp(st.st_mtim), timespec_to_unix_timestamp(st.st_ctim), +#endif #if defined(__CYGWIN__) timespec_to_unix_timestamp(st.st_birthtim) #else @@ -703,7 +709,7 @@ inline constexpr posix_file_status struct_stat_to_posix_file_status(stat_model & #endif , #endif -#if !defined(__CYGWIN__) && (defined(__BSD_VISIBLE) || defined(__DARWIN_C_LEVEL)) && !defined(_PICOLIBC__) && \ +#if !defined(__NEWLIB__) && !defined(__CYGWIN__) && (defined(__BSD_VISIBLE) || defined(__DARWIN_C_LEVEL)) && !defined(_PICOLIBC__) && \ !defined(__linux__) st.st_flags, st.st_gen @@ -1330,7 +1336,7 @@ class basic_posix_family_pipe if (noexcept_call(::_pipe, a2, 131072u, _O_BINARY) == -1) #elif defined(__linux__) if (noexcept_call(::pipe2, a2, O_CLOEXEC) == -1) -#elif (defined(__MSDOS__) || defined(__DJGPP__)) +#elif (defined(__MSDOS__) || defined(__DJGPP__)) || defined(__NEWLIB__) if (noexcept_call(::pipe, a2) == -1) #else if (noexcept_call(::pipe, a2) == -1 || ::fast_io::details::sys_fcntl(a2[0], F_SETFD, FD_CLOEXEC) == -1 || ::fast_io::details::sys_fcntl(a2[1], F_SETFD, FD_CLOEXEC) == -1) diff --git a/include/fast_io_hosted/platforms/win32/apis.h b/include/fast_io_hosted/platforms/win32/apis.h index b433560e3..e13323a3e 100644 --- a/include/fast_io_hosted/platforms/win32/apis.h +++ b/include/fast_io_hosted/platforms/win32/apis.h @@ -166,5 +166,7 @@ FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL LookupPrivilegeValueW(char16_t const *_ FAST_IO_DLLIMPORT void *FAST_IO_WINSTDCALL CreateThread(security_attributes *, ::std::size_t, ::std::uint_least32_t (FAST_IO_WINSTDCALL*)(void*), void*, ::std::uint_least32_t, ::std::uint_least32_t*) noexcept FAST_IO_WINSTDCALL_RENAME(CreateThread, 24); FAST_IO_DLLIMPORT char16_t **FAST_IO_WINSTDCALL CommandLineToArgvW(char16_t const *, int *) noexcept FAST_IO_WINSTDCALL_RENAME(CommandLineToArgvW, 8); FAST_IO_DLLIMPORT void *FAST_IO_WINSTDCALL LocalFree(void *) noexcept FAST_IO_WINSTDCALL_RENAME(LocalFree, 4); +FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL PrefetchVirtualMemory(void *, ::std::size_t, ::fast_io::win32::win32_memory_range_entry *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(PrefetchVirtualMemory, 16); +FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL SetConsoleTextAttribute(void *, ::std::int_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleTextAttribute, 8); } // namespace fast_io::win32 diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_32.h b/include/fast_io_hosted/platforms/win32/msvc_linker_32.h index e53e2691f..477580d5e 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker_32.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_32.h @@ -163,6 +163,8 @@ #pragma comment(linker,"/alternatename:__imp_?CreateThread@win32@fast_io@@YAPAXPAUsecurity_attributes@12@IP6AIPAX@Z1IPAI@Z=__imp_CreateThread") #pragma comment(linker,"/alternatename:__imp_?CommandLineToArgvW@win32@fast_io@@YAPAPA_SPB_SPAH@Z=__imp_CommandLineToArgvW") #pragma comment(linker,"/alternatename:__imp_?LocalFree@win32@fast_io@@YAPAXPAX@Z=__imp_LocalFree") +#pragma comment(linker,"/alternatename:__imp_?PrefetchVirtualMemory@win32@fast_io@@YAHPAXIPAUwin32_memory_range_entry@12@I@Z=__imp_PrefetchVirtualMemory") +#pragma comment(linker,"/alternatename:__imp_?SetConsoleTextAttribute@win32@fast_io@@YAHPAXH@Z=__imp_SetConsoleTextAttribute") // NT #pragma comment(linker,"/alternatename:__imp_?rtl_nt_status_to_dos_error@nt@win32@fast_io@@YAII@Z=__imp_RtlNtStatusToDosError") #pragma comment(linker,"/alternatename:__imp_?NtClose@nt@win32@fast_io@@YAIPAX@Z=__imp_NtClose") @@ -295,6 +297,9 @@ #pragma comment(linker,"/alternatename:__imp_?ZwDeviceIoControlFile@nt@win32@fast_io@@YAIPAX0PAP6AX0PAUio_status_block@123@I@_E01I0I0I@Z=__imp_ZwDeviceIoControlFile") #pragma comment(linker,"/alternatename:__imp_?RtlAcquirePrivilege@nt@win32@fast_io@@YAIPAW4privileges@123@IIPAPAX@Z=__imp_RtlAcquirePrivilege") #pragma comment(linker,"/alternatename:__imp_?RtlReleasePrivilege@nt@win32@fast_io@@YAXPAX@Z=__imp_RtlReleasePrivilege") +#pragma comment(linker,"/alternatename:__imp_?RtlQueryEnvironmentVariable_U@nt@win32@fast_io@@YAIPAXPAUunicode_string@123@1@Z=__imp_RtlQueryEnvironmentVariable_U") +#pragma comment(linker,"/alternatename:__imp_?NtSetInformationVirtualMemory@nt@win32@fast_io@@YAIPAXW4virtual_memory_information_class@123@IPAUmemory_range_entry@123@0I@Z=__imp_NtSetInformationVirtualMemory") +#pragma comment(linker,"/alternatename:__imp_?ZwSetInformationVirtualMemory@nt@win32@fast_io@@YAIPAXW4virtual_memory_information_class@123@IPAUmemory_range_entry@123@0I@Z=__imp_ZwSetInformationVirtualMemory") //msvc #pragma comment(linker,"/alternatename:__imp_?msvc__RTtypeid@msvc@fast_io@@YAPAXPAX@Z=__imp___RTtypeid") #pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@YAPAXPAX@Z=__RTtypeid") diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_32_i686.h b/include/fast_io_hosted/platforms/win32/msvc_linker_32_i686.h index 00e99a25e..b32bfcb45 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker_32_i686.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_32_i686.h @@ -163,6 +163,8 @@ #pragma comment(linker,"/alternatename:__imp_?CreateThread@win32@fast_io@@YGPAXPAUsecurity_attributes@12@IP6GIPAX@Z1IPAI@Z=__imp__CreateThread@24") #pragma comment(linker,"/alternatename:__imp_?CommandLineToArgvW@win32@fast_io@@YGPAPA_SPB_SPAH@Z=__imp__CommandLineToArgvW@8") #pragma comment(linker,"/alternatename:__imp_?LocalFree@win32@fast_io@@YGPAXPAX@Z=__imp__LocalFree@4") +#pragma comment(linker,"/alternatename:__imp_?PrefetchVirtualMemory@win32@fast_io@@YGHPAXIPAUwin32_memory_range_entry@12@I@Z=__imp__PrefetchVirtualMemory@16") +#pragma comment(linker,"/alternatename:__imp_?SetConsoleTextAttribute@win32@fast_io@@YGHPAXH@Z=__imp__SetConsoleTextAttribute@8") // NT #pragma comment(linker,"/alternatename:__imp_?rtl_nt_status_to_dos_error@nt@win32@fast_io@@YGII@Z=__imp__RtlNtStatusToDosError@4") #pragma comment(linker,"/alternatename:__imp_?NtClose@nt@win32@fast_io@@YGIPAX@Z=__imp__NtClose@4") @@ -295,6 +297,9 @@ #pragma comment(linker,"/alternatename:__imp_?ZwDeviceIoControlFile@nt@win32@fast_io@@YGIPAX0PAP6AX0PAUio_status_block@123@I@_E01I0I0I@Z=__imp__ZwDeviceIoControlFile@40") #pragma comment(linker,"/alternatename:__imp_?RtlAcquirePrivilege@nt@win32@fast_io@@YGIPAW4privileges@123@IIPAPAX@Z=__imp__RtlAcquirePrivilege@16") #pragma comment(linker,"/alternatename:__imp_?RtlReleasePrivilege@nt@win32@fast_io@@YGXPAX@Z=__imp__RtlReleasePrivilege@4") +#pragma comment(linker,"/alternatename:__imp_?RtlQueryEnvironmentVariable_U@nt@win32@fast_io@@YGIPAXPAUunicode_string@123@1@Z=__imp__RtlQueryEnvironmentVariable_U@12") +#pragma comment(linker,"/alternatename:__imp_?NtSetInformationVirtualMemory@nt@win32@fast_io@@YGIPAXW4virtual_memory_information_class@123@IPAUmemory_range_entry@123@0I@Z=__imp__NtSetInformationVirtualMemory@24") +#pragma comment(linker,"/alternatename:__imp_?ZwSetInformationVirtualMemory@nt@win32@fast_io@@YGIPAXW4virtual_memory_information_class@123@IPAUmemory_range_entry@123@0I@Z=__imp__ZwSetInformationVirtualMemory@24") // msvc #pragma comment(linker,"/alternatename:__imp_?msvc__RTtypeid@msvc@fast_io@@YAPAXPAX@Z=__imp____RTtypeid") #pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@YAPAXPAX@Z=___RTtypeid") diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_64.h b/include/fast_io_hosted/platforms/win32/msvc_linker_64.h index 6adbc8785..54bf9a05b 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker_64.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_64.h @@ -163,6 +163,8 @@ #pragma comment(linker,"/alternatename:__imp_?CreateThread@win32@fast_io@@YAPEAXPEAUsecurity_attributes@12@_KP6AIPEAX@Z2IPEAI@Z=__imp_CreateThread") #pragma comment(linker,"/alternatename:__imp_?CommandLineToArgvW@win32@fast_io@@YAPEAPEA_SPEB_SPEAH@Z=__imp_CommandLineToArgvW") #pragma comment(linker,"/alternatename:__imp_?LocalFree@win32@fast_io@@YAPEAXPEAX@Z=__imp_LocalFree") +#pragma comment(linker,"/alternatename:__imp_?PrefetchVirtualMemory@win32@fast_io@@YAHPEAX_KPEAUwin32_memory_range_entry@12@I@Z=__imp_PrefetchVirtualMemory") +#pragma comment(linker,"/alternatename:__imp_?SetConsoleTextAttribute@win32@fast_io@@YAHPEAXH@Z=__imp_SetConsoleTextAttribute") // NT #pragma comment(linker,"/alternatename:__imp_?rtl_nt_status_to_dos_error@nt@win32@fast_io@@YAII@Z=__imp_RtlNtStatusToDosError") #pragma comment(linker,"/alternatename:__imp_?NtClose@nt@win32@fast_io@@YAIPEAX@Z=__imp_NtClose") @@ -295,6 +297,9 @@ #pragma comment(linker,"/alternatename:__imp_?ZwDeviceIoControlFile@nt@win32@fast_io@@YAIPEAX0PEAP6AX0PEAUio_status_block@123@I@_E01I0I0I@Z=__imp_ZwDeviceIoControlFile") #pragma comment(linker,"/alternatename:__imp_?RtlAcquirePrivilege@nt@win32@fast_io@@YAIPEAW4privileges@123@IIPEAPEAX@Z=__imp_RtlAcquirePrivilege") #pragma comment(linker,"/alternatename:__imp_?RtlReleasePrivilege@nt@win32@fast_io@@YAXPEAX@Z=__imp_RtlReleasePrivilege") +#pragma comment(linker,"/alternatename:__imp_?RtlQueryEnvironmentVariable_U@nt@win32@fast_io@@YAIPEAXPEAUunicode_string@123@1@Z=__imp_RtlQueryEnvironmentVariable_U") +#pragma comment(linker,"/alternatename:__imp_?NtSetInformationVirtualMemory@nt@win32@fast_io@@YAIPEAXW4virtual_memory_information_class@123@_KPEAUmemory_range_entry@123@0I@Z=__imp_NtSetInformationVirtualMemory") +#pragma comment(linker,"/alternatename:__imp_?ZwSetInformationVirtualMemory@nt@win32@fast_io@@YAIPEAXW4virtual_memory_information_class@123@_KPEAUmemory_range_entry@123@0I@Z=__imp_ZwSetInformationVirtualMemory") // msvc #pragma comment(linker,"/alternatename:__imp_?msvc__RTtypeid@msvc@fast_io@@YAPEAXPEAX@Z=__imp___RTtypeid") #pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@YAPEAXPEAX@Z=__RTtypeid") diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h index b9a002bc9..8074cb835 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h @@ -163,6 +163,8 @@ #pragma comment(linker,"/alternatename:?CreateThread$exit_thunk@win32@fast_io@@$$hYAPEAXPEAUsecurity_attributes@12@_KP6AIPEAX@Z2IPEAI@Z=#CreateThread") #pragma comment(linker,"/alternatename:?CommandLineToArgvW@win32@fast_io@@YAPEAPEA_SPEB_SPEAH@Z=#CommandLineToArgvW") #pragma comment(linker,"/alternatename:?LocalFree@win32@fast_io@@YAPEAXPEAX@Z=#LocalFree") +#pragma comment(linker,"/alternatename:?PrefetchVirtualMemory@win32@fast_io@@$$hYAHPEAX_KPEAUwin32_memory_range_entry@12@I@Z=#PrefetchVirtualMemory") +#pragma comment(linker,"/alternatename:?SetConsoleTextAttribute@win32@fast_io@@$$hYAHPEAXH@Z=#SetConsoleTextAttribute") // NT #pragma comment(linker,"/alternatename:?rtl_nt_status_to_dos_error$exit_thunk@nt@win32@fast_io@@$$hYAII@Z=#RtlNtStatusToDosError") #pragma comment(linker,"/alternatename:?NtClose$exit_thunk@nt@win32@fast_io@@$$hYAIPEAX@Z=#NtClose") @@ -295,6 +297,9 @@ #pragma comment(linker,"/alternatename:?ZwDeviceIoControlFile$exit_thunk@nt@win32@fast_io@@$$hYAIPEAX0PEAP6AX0PEAUio_status_block@123@I@_E01I0I0I@Z=#ZwDeviceIoControlFile") #pragma comment(linker,"/alternatename:?RtlAcquirePrivilege$exit_thunk@nt@win32@fast_io@@$$hYAIPEAW4privileges@123@IIPEAPEAX@Z=#RtlAcquirePrivilege") #pragma comment(linker,"/alternatename:?RtlReleasePrivilege$exit_thunk@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlReleasePrivilege") +#pragma comment(linker,"/alternatename:?RtlQueryEnvironmentVariable_U@nt@win32@fast_io@@$$hYAIPEAXPEAUunicode_string@123@1@Z=#RtlQueryEnvironmentVariable_U") +#pragma comment(linker,"/alternatename:?NtSetInformationVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXW4virtual_memory_information_class@123@_KPEAUmemory_range_entry@123@0I@Z=#NtSetInformationVirtualMemory") +#pragma comment(linker,"/alternatename:?ZwSetInformationVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXW4virtual_memory_information_class@123@_KPEAUmemory_range_entry@123@0I@Z=#ZwSetInformationVirtualMemory") // msvc #pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@$$hYAPEAXPEAX@Z=#__RTtypeid") // clang-format on diff --git a/include/fast_io_hosted/platforms/win32/win32_definitions.h b/include/fast_io_hosted/platforms/win32/win32_definitions.h index e4ad7580b..aecf1ba0e 100644 --- a/include/fast_io_hosted/platforms/win32/win32_definitions.h +++ b/include/fast_io_hosted/platforms/win32/win32_definitions.h @@ -438,4 +438,9 @@ struct win32_find_dataw using farproc = ::std::ptrdiff_t(FAST_IO_STDCALL *)() noexcept; +struct win32_memory_range_entry +{ + void* VirtualAddress; + ::std::size_t NumberOfBytes; +}; } // namespace fast_io::win32 diff --git a/include/fast_io_hosted/process/ipc/win32/alpc_nt.h b/include/fast_io_hosted/process/ipc/win32/alpc_nt.h index 58a5d2311..8fe9bd246 100644 --- a/include/fast_io_hosted/process/ipc/win32/alpc_nt.h +++ b/include/fast_io_hosted/process/ipc/win32/alpc_nt.h @@ -307,7 +307,7 @@ struct nt_ipc_alpc_thread_local_heap_allocate_guard // SERVER template -inline void *nt_family_create_alpc_ipc_server_port_impl(nt_alpc_char_type const *server_name, ::std::size_t server_name_size, ::fast_io::ipc_mode mode) +inline void *nt_family_create_alpc_ipc_server_port_impl(nt_alpc_char_type const *server_name, ::std::size_t server_name_size, [[maybe_unused]] ::fast_io::ipc_mode mode) { constexpr bool zw{family == nt_family::zw}; @@ -661,7 +661,7 @@ inline void nt_family_alpc_ipc_server_disconnect_impl(void *__restrict client_pi template inline ::fast_io::win32::nt::alpc_message_attributes *nt_family_create_alpc_ipc_client_message_attribute_view_impl() { - constexpr bool zw{family == nt_family::zw}; + // constexpr bool zw{family == nt_family::zw}; constexpr ::std::uint_least32_t message_attribute{ 0x80000000 /*ALPC_MESSAGE_SECURITY_ATTRIBUTE*/ | @@ -698,7 +698,7 @@ inline ::fast_io::win32::nt::alpc_message_attributes *nt_family_create_alpc_ipc_ } template -inline void *nt_family_ipc_alpc_client_connect_impl(nt_alpc_char_type const *server_name, ::std::size_t server_name_size, ::fast_io::ipc_mode mode, +inline void *nt_family_ipc_alpc_client_connect_impl(nt_alpc_char_type const *server_name, ::std::size_t server_name_size, [[maybe_unused]] ::fast_io::ipc_mode mode, ::std::byte const *message_begin, ::std::byte const *message_end, ::fast_io::win32::nt::alpc_message_attributes *__restrict message_attribute, nt_alpc_byte_vector &connect_recv_message) { diff --git a/include/fast_io_hosted/white_hole/white_hole.h b/include/fast_io_hosted/white_hole/white_hole.h index c993f3256..42d62d446 100644 --- a/include/fast_io_hosted/white_hole/white_hole.h +++ b/include/fast_io_hosted/white_hole/white_hole.h @@ -111,10 +111,12 @@ struct basic_white_hole_engine { using handle_type = handletype; using result_type = ::std::size_t; +#ifndef __INTELLISENSE__ #if __has_cpp_attribute(no_unique_address) [[no_unique_address]] #elif __has_cpp_attribute(msvc::no_unique_address) [[msvc::no_unique_address]] +#endif #endif handle_type handle; static inline constexpr result_type min() noexcept diff --git a/share/fast_io/fast_io.cppm b/share/fast_io/fast_io.cppm index 6ef183c16..d39b9d0e3 100644 --- a/share/fast_io/fast_io.cppm +++ b/share/fast_io/fast_io.cppm @@ -1,30 +1,39 @@ -module; +module; #include -#include #include #include +#include #include +#include #include -#if !(((__STDC_HOSTED__ == 1 && (!defined(_GLIBCXX_HOSTED) || _GLIBCXX_HOSTED == 1) && \ - !defined(_LIBCPP_FREESTANDING)) || \ - defined(FAST_IO_ENABLE_HOSTED_FEATURES))) -#ifndef FAST_IO_FREESTANDING -#define FAST_IO_FREESTANDING -#endif +#if !(((__STDC_HOSTED__ == 1 && (!defined(_GLIBCXX_HOSTED) || _GLIBCXX_HOSTED == 1) && !defined(_LIBCPP_FREESTANDING)) || \ + defined(FAST_IO_ENABLE_HOSTED_FEATURES))) +# ifndef FAST_IO_FREESTANDING +# define FAST_IO_FREESTANDING +# endif #endif export module fast_io; #include "fast_io_inc/core.inc" #include "fast_io_inc/core/allocation.inc" +#include "fast_io_inc/freestanding.inc" #ifndef FAST_IO_FREESTANDING -#include "fast_io_inc/hosted.inc" -#include "fast_io_inc/legacy/c.inc" -#include "fast_io_inc/legacy/filebuf.inc" -#include "fast_io_inc/device.inc" +# include "fast_io_inc/hosted.inc" + +# include "fast_io_inc/host/posix.inc" + +# if defined(_WIN32) || defined(__CYGWIN__) +# include "fast_io_inc/host/nt.inc" +# include "fast_io_inc/host/win32.inc" +# endif + +# include "fast_io_inc/legacy/c.inc" +# include "fast_io_inc/device.inc" +# include "fast_io_inc/io_buffer.inc" #endif /* @@ -36,5 +45,12 @@ io functions containers */ #include "fast_io_inc/dsal/array.inc" +#include "fast_io_inc/dsal/tuple.inc" #include "fast_io_inc/dsal/vector.inc" +#include "fast_io_inc/dsal/string_view.inc" #include "fast_io_inc/dsal/string.inc" + +/* +details +*/ +#include "fast_io_inc/detail.inc" diff --git a/share/fast_io/fast_io_crypto.cppm b/share/fast_io/fast_io_crypto.cppm new file mode 100644 index 000000000..2348c19ce --- /dev/null +++ b/share/fast_io/fast_io_crypto.cppm @@ -0,0 +1,9 @@ +module; + +#include +#include + +export module fast_io_crypto; +export import fast_io; + +#include "fast_io_inc/crypto.inc" diff --git a/share/fast_io/fast_io_inc/core.inc b/share/fast_io/fast_io_inc/core.inc index a15db166c..18b193b36 100644 --- a/share/fast_io/fast_io_inc/core.inc +++ b/share/fast_io/fast_io_inc/core.inc @@ -1,5 +1,9 @@ export namespace fast_io { +using ::fast_io::basic_io_scatter_t; +using ::fast_io::char_literal_v; +using ::fast_io::pr_rsv_size; +using ::fast_io::pr_rsv_to_iterator_unchecked; using ::fast_io::io_reserve_type_t; using ::fast_io::io_reserve_type; @@ -8,13 +12,103 @@ using ::fast_io::print_reserve_size; using ::fast_io::print_reserve_define; using ::fast_io::print_define_internal_shift; +using ::fast_io::print_scatter_define; + using ::fast_io::scan_contiguous_define; using ::fast_io::scan_context_type; using ::fast_io::scan_context_define; using ::fast_io::scan_context_eof_define; +using ::fast_io::unreachable; +using ::fast_io::noexcept_call; + +using ::fast_io::error; +using ::fast_io::cstr_len; +using ::fast_io::cstr_nlen; + +using ::fast_io::parse_by_scan; +using ::fast_io::parse_code; + +#if !defined(__clang__) // The gcc and msvc module does not support non-exported functions adl matching +using ::fast_io::input_stream_ref_define; +using ::fast_io::output_stream_ref_define; +using ::fast_io::io_stream_ref_define; + +using ::fast_io::input_decorators_ref_define; +using ::fast_io::output_decorators_ref_define; +// using ::fast_io::io_decorators_ref_define; + +using ::fast_io::ibuffer_begin; +using ::fast_io::ibuffer_curr; +using ::fast_io::ibuffer_end; +using ::fast_io::ibuffer_set_curr; +// using ::fast_io::status_scan_define; +using ::fast_io::read_some_underflow_define; +// using ::fast_io::read_all_underflow_define; +using ::fast_io::read_some_bytes_underflow_define; +#ifdef _WIN32 +using ::fast_io::read_all_bytes_underflow_define; +#endif +// using ::fast_io::scatter_read_some_bytes_underflow_define; +// using ::fast_io::scatter_read_all_bytes_underflow_define; +using ::fast_io::scatter_read_some_underflow_define; +// using ::fast_io::scatter_read_all_underflow_define; +// using ::fast_io::ibuffer_underflow_never_define; +using ::fast_io::pread_some_bytes_underflow_define; +// using ::fast_io::pread_all_bytes_underflow_define; +using ::fast_io::scatter_pread_some_bytes_underflow_define; +// using ::fast_io::scatter_pread_all_bytes_underflow_define; +using ::fast_io::pread_some_underflow_define; +using ::fast_io::pread_all_underflow_define; +using ::fast_io::scatter_pread_some_underflow_define; +using ::fast_io::scatter_pread_all_underflow_define; +using ::fast_io::ibuffer_minimum_size_define; +using ::fast_io::ibuffer_minimum_size_underflow_all_prepare_define; +// using ::fast_io::input_stream_mutex_ref_define; +// using ::fast_io::output_stream_mutex_ref_define; +using ::fast_io::io_stream_mutex_ref_define; +using ::fast_io::input_stream_unlocked_ref_define; +using ::fast_io::output_stream_unlocked_ref_define; +using ::fast_io::io_stream_unlocked_ref_define; +using ::fast_io::obuffer_begin; +using ::fast_io::obuffer_curr; +using ::fast_io::obuffer_end; +using ::fast_io::obuffer_set_curr; +// using ::fast_io::status_print_define; +using ::fast_io::write_some_overflow_define; +using ::fast_io::write_all_overflow_define; +using ::fast_io::write_some_bytes_overflow_define; +using ::fast_io::write_all_bytes_overflow_define; +// using ::fast_io::scatter_write_some_bytes_overflow_define; +// using ::fast_io::scatter_write_all_bytes_overflow_define; +using ::fast_io::scatter_write_some_overflow_define; +using ::fast_io::scatter_write_all_overflow_define; +// using ::fast_io::obuffer_overflow_never_define; +// using ::fast_io::output_stream_char_put_overflow_define; +using ::fast_io::pwrite_some_bytes_overflow_define; +using ::fast_io::pwrite_all_bytes_overflow_define; +using ::fast_io::scatter_pwrite_some_bytes_overflow_define; +// using ::fast_io::scatter_pwrite_all_bytes_overflow_define; +using ::fast_io::pwrite_some_overflow_define; +using ::fast_io::pwrite_all_overflow_define; +using ::fast_io::scatter_pwrite_some_overflow_define; +using ::fast_io::scatter_pwrite_all_overflow_define; +// using ::fast_io::obuffer_is_line_buffering_define; +using ::fast_io::input_stream_require_secure_clear_define; +// using ::fast_io::output_stream_require_secure_clear_define; +using ::fast_io::io_stream_require_secure_clear_define; +// using ::fast_io::input_stream_buffer_flush_define; +using ::fast_io::output_stream_buffer_flush_define; +using ::fast_io::io_stream_buffer_flush_define; +#endif + namespace manipulators { + +using ::fast_io::manipulators::print_alias_define; +using ::fast_io::manipulators::print_reserve_size; +using ::fast_io::manipulators::print_reserve_define; + using ::fast_io::manipulators::scalar_placement; using ::fast_io::manipulators::floating_format; using ::fast_io::manipulators::lc_time_flag; @@ -37,13 +131,26 @@ using ::fast_io::manipulators::scalar_manip_t; using ::fast_io::manipulators::member_function_pointer_holder_t; using ::fast_io::manipulators::whole_get_t; +using ::fast_io::manipulators::boolalpha; + using ::fast_io::manipulators::pointervw; using ::fast_io::manipulators::handlevw; using ::fast_io::manipulators::methodvw; -using ::fast_io::manipulators::os_c_str; using ::fast_io::manipulators::addrvw; using ::fast_io::manipulators::dfvw; +using ::fast_io::manipulators::os_c_str; +using ::fast_io::manipulators::os_c_str_carr; + +using ::fast_io::manipulators::rgvw; + +using ::fast_io::manipulators::code_cvt; +using ::fast_io::manipulators::code_cvt_os_c_str; +using ::fast_io::manipulators::os_c_str_null_terminated; +using ::fast_io::manipulators::os_c_str_null_terminated_carr; +using ::fast_io::manipulators::os_c_str_or_nullptr; +using ::fast_io::manipulators::os_c_str_with_known_size; + using ::fast_io::manipulators::base; using ::fast_io::manipulators::bin; using ::fast_io::manipulators::oct; @@ -65,12 +172,19 @@ using ::fast_io::manipulators::comma_fixed; using ::fast_io::manipulators::comma_scientific; using ::fast_io::manipulators::comma_hexfloat; +using ::fast_io::manipulators::width; +using ::fast_io::manipulators::left; +using ::fast_io::manipulators::middle; +using ::fast_io::manipulators::right; +using ::fast_io::manipulators::internal; + using ::fast_io::manipulators::bitfieldvw; using ::fast_io::manipulators::ip_generic; #if 0 using ::fast_io::manipulators::ip_scan_generic; #endif +using ::fast_io::manipulators::cur_src_loc; } // namespace manipulators namespace mnp = manipulators; @@ -194,4 +308,32 @@ using ::fast_io::ipv4_scan_state_t; using ::fast_io::ipv6_scan_state_t; using ::fast_io::ip_port_scan_state_t; #endif + +using ::fast_io::basic_timestamp; +using ::fast_io::unix_timestamp; +using ::fast_io::win32_timestamp; +using ::fast_io::csharp_timestamp; +using ::fast_io::year0_timestamp; +using ::fast_io::universe_timestamp; + +using ::fast_io::operator==; +using ::fast_io::operator!=; +using ::fast_io::operator<=>; +using ::fast_io::operator+; +using ::fast_io::operator-; +using ::fast_io::operator/; +using ::fast_io::operator+=; +using ::fast_io::operator-=; +using ::fast_io::operator/=; +using ::fast_io::operator*; +using ::fast_io::operator~; +using ::fast_io::operator&; +using ::fast_io::operator|; +using ::fast_io::operator^; +using ::fast_io::operator&=; +using ::fast_io::operator|=; +using ::fast_io::operator^=; + +using ::fast_io::operator++; + } // namespace fast_io diff --git a/share/fast_io/fast_io_inc/core/allocation.inc b/share/fast_io/fast_io_inc/core/allocation.inc index e5b061fc9..0091aca40 100644 --- a/share/fast_io/fast_io_inc/core/allocation.inc +++ b/share/fast_io/fast_io_inc/core/allocation.inc @@ -1,5 +1,68 @@ export namespace fast_io { + +namespace details +{ +using ::fast_io::details::has_allocate_impl; +using ::fast_io::details::has_allocate_aligned_impl; +using ::fast_io::details::has_allocate_zero_impl; +using ::fast_io::details::has_allocate_aligned_zero_impl; +using ::fast_io::details::has_reallocate_impl; +using ::fast_io::details::has_reallocate_aligned_impl; +using ::fast_io::details::has_reallocate_zero_impl; +using ::fast_io::details::has_reallocate_aligned_zero_impl; +using ::fast_io::details::has_reallocate_n_impl; +using ::fast_io::details::has_reallocate_aligned_n_impl; +using ::fast_io::details::has_reallocate_zero_n_impl; +using ::fast_io::details::has_reallocate_aligned_zero_n_impl; +using ::fast_io::details::has_deallocate_impl; +using ::fast_io::details::has_deallocate_aligned_impl; +using ::fast_io::details::has_deallocate_n_impl; +using ::fast_io::details::has_deallocate_aligned_n_impl; +using ::fast_io::details::has_allocate_at_least_impl; +using ::fast_io::details::has_allocate_aligned_at_least_impl; +using ::fast_io::details::has_allocate_zero_at_least_impl; +using ::fast_io::details::has_allocate_aligned_zero_at_least_impl; +using ::fast_io::details::has_reallocate_at_least_impl; +using ::fast_io::details::has_reallocate_aligned_at_least_impl; +using ::fast_io::details::has_reallocate_zero_at_least_impl; +using ::fast_io::details::has_reallocate_aligned_zero_at_least_impl; +using ::fast_io::details::has_reallocate_n_at_least_impl; +using ::fast_io::details::has_reallocate_aligned_n_at_least_impl; +using ::fast_io::details::has_reallocate_zero_n_at_least_impl; +using ::fast_io::details::has_reallocate_aligned_zero_n_at_least_impl; +using ::fast_io::details::has_non_empty_handle_type; +using ::fast_io::details::has_handle_allocate_impl; +using ::fast_io::details::has_handle_allocate_aligned_impl; +using ::fast_io::details::has_handle_allocate_zero_impl; +using ::fast_io::details::has_handle_allocate_aligned_zero_impl; +using ::fast_io::details::has_handle_reallocate_impl; +using ::fast_io::details::has_handle_reallocate_aligned_impl; +using ::fast_io::details::has_handle_reallocate_zero_impl; +using ::fast_io::details::has_handle_reallocate_aligned_zero_impl; +using ::fast_io::details::has_handle_reallocate_n_impl; +using ::fast_io::details::has_handle_reallocate_aligned_n_impl; +using ::fast_io::details::has_handle_reallocate_zero_n_impl; +using ::fast_io::details::has_handle_reallocate_aligned_zero_n_impl; +using ::fast_io::details::has_handle_allocate_at_least_impl; +using ::fast_io::details::has_handle_allocate_aligned_at_least_impl; +using ::fast_io::details::has_handle_allocate_zero_at_least_impl; +using ::fast_io::details::has_handle_allocate_aligned_zero_at_least_impl; +using ::fast_io::details::has_handle_reallocate_at_least_impl; +using ::fast_io::details::has_handle_reallocate_aligned_at_least_impl; +using ::fast_io::details::has_handle_reallocate_zero_at_least_impl; +using ::fast_io::details::has_handle_reallocate_aligned_zero_at_least_impl; +using ::fast_io::details::has_handle_reallocate_n_at_least_impl; +using ::fast_io::details::has_handle_reallocate_aligned_n_at_least_impl; +using ::fast_io::details::has_handle_reallocate_zero_n_at_least_impl; +using ::fast_io::details::has_handle_reallocate_aligned_zero_n_at_least_impl; +using ::fast_io::details::has_handle_deallocate_impl; +using ::fast_io::details::has_handle_deallocate_aligned_impl; +using ::fast_io::details::has_handle_deallocate_n_impl; +using ::fast_io::details::has_handle_deallocate_aligned_n_impl; + +} + using ::fast_io::generic_allocator_adapter; using ::fast_io::typed_generic_allocator_adapter; using ::fast_io::native_global_allocator; diff --git a/share/fast_io/fast_io_inc/crypto.inc b/share/fast_io/fast_io_inc/crypto.inc new file mode 100644 index 000000000..3869f9baf --- /dev/null +++ b/share/fast_io/fast_io_inc/crypto.inc @@ -0,0 +1,10 @@ +export namespace fast_io +{ + using ::fast_io::crc32_context; + using ::fast_io::crc32c_context; + namespace details + { + using ::fast_io::details::support_hardware_crc32; + using ::fast_io::details::support_hardware_crc32c; + } +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/detail.inc b/share/fast_io/fast_io_inc/detail.inc new file mode 100644 index 000000000..3cf9838e1 --- /dev/null +++ b/share/fast_io/fast_io_inc/detail.inc @@ -0,0 +1,7 @@ +export namespace fast_io +{ + namespace details + { + + } // namespace details +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/dsal/string_view.inc b/share/fast_io/fast_io_inc/dsal/string_view.inc new file mode 100644 index 000000000..3c01053c3 --- /dev/null +++ b/share/fast_io/fast_io_inc/dsal/string_view.inc @@ -0,0 +1,28 @@ +export namespace fast_io +{ +namespace containers +{ +using ::fast_io::containers::null_terminated_t; +using ::fast_io::containers::null_terminated; + +using ::fast_io::containers::basic_string_view; +using ::fast_io::containers::basic_cstring_view; +using ::fast_io::containers::operator==; +using ::fast_io::containers::operator<=>; +using ::fast_io::containers::swap; +using ::fast_io::containers::print_alias_define; +} // namespace containers + +using ::fast_io::string_view; +using ::fast_io::wstring_view; +using ::fast_io::u8string_view; +using ::fast_io::u16string_view; +using ::fast_io::u32string_view; + +using ::fast_io::cstring_view; +using ::fast_io::wcstring_view; +using ::fast_io::u8cstring_view; +using ::fast_io::u16cstring_view; +using ::fast_io::u32cstring_view; + +} // namespace fast_io \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/dsal/tuple.inc b/share/fast_io/fast_io_inc/dsal/tuple.inc new file mode 100644 index 000000000..4a2c20f8a --- /dev/null +++ b/share/fast_io/fast_io_inc/dsal/tuple.inc @@ -0,0 +1,16 @@ +export namespace fast_io +{ +namespace containers +{ +using ::fast_io::containers::tuple; +using ::fast_io::containers::get; +using ::fast_io::containers::is_tuple; +using ::fast_io::containers::forward_as_tuple; + +} // namespace containers + +using ::fast_io::tuple; +using ::fast_io::get; +using ::fast_io::is_tuple; +using ::fast_io::forward_as_tuple; +} // namespace fast_io diff --git a/share/fast_io/fast_io_inc/dsal/vector.inc b/share/fast_io/fast_io_inc/dsal/vector.inc index f3b4034ee..dba134ef7 100644 --- a/share/fast_io/fast_io_inc/dsal/vector.inc +++ b/share/fast_io/fast_io_inc/dsal/vector.inc @@ -11,7 +11,7 @@ using ::fast_io::containers::erase_if; namespace freestanding { -using ::fast_io::freestanding::is_trivially_relocatable; +using ::fast_io::freestanding::is_trivially_copyable_or_relocatable; using ::fast_io::freestanding::is_zero_default_constructible; } // namespace freestanding diff --git a/share/fast_io/fast_io_inc/freestanding.inc b/share/fast_io/fast_io_inc/freestanding.inc new file mode 100644 index 000000000..a30a0916e --- /dev/null +++ b/share/fast_io/fast_io_inc/freestanding.inc @@ -0,0 +1,48 @@ +export namespace fast_io +{ +namespace freestanding +{ + +using ::fast_io::freestanding::is_trivially_copyable_or_relocatable; +using ::fast_io::freestanding::is_zero_default_constructible; + +using ::fast_io::freestanding::lexicographical_compare_three_way; +using ::fast_io::freestanding::find_if; +using ::fast_io::freestanding::copy_n; +using ::fast_io::freestanding::copy; +using ::fast_io::freestanding::fill; +using ::fast_io::freestanding::fill_n; +using ::fast_io::freestanding::copy_backward; +using ::fast_io::freestanding::move_backward; +using ::fast_io::freestanding::my_mismatch; +using ::fast_io::freestanding::remove; +using ::fast_io::freestanding::my_memcpy; +using ::fast_io::freestanding::my_memmove; +using ::fast_io::freestanding::my_memset; +using ::fast_io::freestanding::my_memcmp; +using ::fast_io::freestanding::non_overlapped_copy_n; +using ::fast_io::freestanding::non_overlapped_copy; +using ::fast_io::freestanding::my_copy_n; +using ::fast_io::freestanding::my_copy; +using ::fast_io::freestanding::my_copy_backward; +using ::fast_io::freestanding::my_compare_iter_n; +using ::fast_io::freestanding::lexicographical_compare; +using ::fast_io::freestanding::equal; +using ::fast_io::freestanding::lower_bound; +using ::fast_io::freestanding::uninitialized_copy; +using ::fast_io::freestanding::uninitialized_copy_n; +using ::fast_io::freestanding::uninitialized_move_n; +using ::fast_io::freestanding::uninitialized_default_construct; +using ::fast_io::freestanding::uninitialized_default_construct_n; +using ::fast_io::freestanding::uninitialized_fill; +using ::fast_io::freestanding::uninitialized_fill_n; +using ::fast_io::freestanding::rotate; +using ::fast_io::freestanding::find_not; +using ::fast_io::freestanding::find_last; +using ::fast_io::freestanding::find_last_not; +using ::fast_io::freestanding::find_first_not_of; +using ::fast_io::freestanding::find_last_of; +using ::fast_io::freestanding::find_last_not_of; + +} // namespace freestanding +} // namespace fast_io \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/host/nt.inc b/share/fast_io/fast_io_inc/host/nt.inc new file mode 100644 index 000000000..fa03d6a6b --- /dev/null +++ b/share/fast_io/fast_io_inc/host/nt.inc @@ -0,0 +1,10 @@ +export namespace fast_io +{ + + namespace win32::nt + { + using ::fast_io::win32::nt::nt_get_current_peb; + using ::fast_io::win32::nt::CsrClientCallServer; + + } // namespace win32::nt +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/host/posix.inc b/share/fast_io/fast_io_inc/host/posix.inc new file mode 100644 index 000000000..50bfd50ed --- /dev/null +++ b/share/fast_io/fast_io_inc/host/posix.inc @@ -0,0 +1,4 @@ +export namespace fast_io +{ + using ::fast_io::posix_tzset; +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/host/win32.inc b/share/fast_io/fast_io_inc/host/win32.inc new file mode 100644 index 000000000..aba29f29a --- /dev/null +++ b/share/fast_io/fast_io_inc/host/win32.inc @@ -0,0 +1,20 @@ +export namespace fast_io +{ + using ::fast_io::win32_stdout_number; + using ::fast_io::win32_stderr_number; + using ::fast_io::win32_domain_value; + + namespace win32 + { + using ::fast_io::win32::GetLastError; + using ::fast_io::win32::GetStdHandle; + using ::fast_io::win32::GetConsoleMode; + using ::fast_io::win32::SetConsoleMode; + using ::fast_io::win32::GetConsoleCP; + using ::fast_io::win32::GetConsoleOutputCP; + using ::fast_io::win32::SetConsoleCP; + using ::fast_io::win32::SetConsoleOutputCP; + using ::fast_io::win32::CommandLineToArgvW; + using ::fast_io::win32::LocalFree; + } // namespace win32 +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/hosted.inc b/share/fast_io/fast_io_inc/hosted.inc index 2a9fc8ee7..05d65e514 100644 --- a/share/fast_io/fast_io_inc/hosted.inc +++ b/share/fast_io/fast_io_inc/hosted.inc @@ -1,26 +1,74 @@ export namespace fast_io { +using ::fast_io::fast_terminate; + #if defined(_WIN32) || defined(__CYGWIN__) using ::fast_io::win32_family; using ::fast_io::nt_family; using ::fast_io::basic_nt_family_io_observer; using ::fast_io::basic_nt_family_file; + using ::fast_io::nt_io_observer; using ::fast_io::nt_file; +using ::fast_io::wnt_io_observer; +using ::fast_io::wnt_file; +using ::fast_io::u8nt_io_observer; +using ::fast_io::u8nt_file; +using ::fast_io::u16nt_io_observer; +using ::fast_io::u16nt_file; +using ::fast_io::u32nt_io_observer; +using ::fast_io::u32nt_file; + +using ::fast_io::nt_stdin; +using ::fast_io::nt_stdout; +using ::fast_io::nt_stderr; + using ::fast_io::basic_win32_family_io_observer; using ::fast_io::basic_win32_family_file; + using ::fast_io::win32_io_observer; using ::fast_io::win32_file; +using ::fast_io::wwin32_io_observer; +using ::fast_io::wwin32_file; +using ::fast_io::u8win32_io_observer; +using ::fast_io::u8win32_file; +using ::fast_io::u16win32_io_observer; +using ::fast_io::u16win32_file; +using ::fast_io::u32win32_io_observer; +using ::fast_io::u32win32_file; + +using ::fast_io::win32_stdin; +using ::fast_io::win32_stdout; +using ::fast_io::win32_stderr; + #endif using ::fast_io::basic_posix_family_io_observer; using ::fast_io::basic_posix_family_file; + using ::fast_io::posix_io_observer; using ::fast_io::posix_file; +using ::fast_io::wposix_io_observer; +using ::fast_io::wposix_file; +using ::fast_io::u8posix_io_observer; +using ::fast_io::u8posix_file; +using ::fast_io::u16posix_io_observer; +using ::fast_io::u16posix_file; +using ::fast_io::u32posix_io_observer; +using ::fast_io::u32posix_file; + using ::fast_io::native_file; using ::fast_io::native_io_observer; +using ::fast_io::wnative_file; +using ::fast_io::wnative_io_observer; +using ::fast_io::u8native_file; +using ::fast_io::u8native_io_observer; +using ::fast_io::u16native_file; +using ::fast_io::u16native_io_observer; +using ::fast_io::u32native_file; +using ::fast_io::u32native_io_observer; using ::fast_io::at; using ::fast_io::drt; @@ -29,4 +77,22 @@ using ::fast_io::recursive; using ::fast_io::native_file_loader; +using ::fast_io::in; +using ::fast_io::out; +using ::fast_io::err; +using ::fast_io::u8in; +using ::fast_io::u8out; +using ::fast_io::u8err; + +using ::fast_io::posix_stdin; +using ::fast_io::posix_stdout; +using ::fast_io::posix_stderr; + +#if(defined(_WIN32) || defined(__CYGWIN__)) || ((!defined(_WIN32) || defined(__WINE__)) && (defined(__CYGWIN__) || (!defined(__NEWLIB__) && !defined(__wasi__)))) + using ::fast_io::native_dll_file; +#endif + +using ::fast_io::posix_clock_id; +using ::fast_io::posix_clock_gettime; + } // namespace fast_io diff --git a/share/fast_io/fast_io_inc/io_buffer.inc b/share/fast_io/fast_io_inc/io_buffer.inc new file mode 100644 index 000000000..56787e563 --- /dev/null +++ b/share/fast_io/fast_io_inc/io_buffer.inc @@ -0,0 +1,7 @@ +export namespace fast_io +{ + using ::fast_io::basic_ibuf; + using ::fast_io::basic_obuf; + using ::fast_io::basic_iobuf; + +} \ No newline at end of file diff --git a/share/fast_io/fast_io_inc/legacy/c.inc b/share/fast_io/fast_io_inc/legacy/c.inc index 413a0f6ba..6285a2d1e 100644 --- a/share/fast_io/fast_io_inc/legacy/c.inc +++ b/share/fast_io/fast_io_inc/legacy/c.inc @@ -62,17 +62,9 @@ using ::fast_io::obuffer_is_line_buffering_define; using ::fast_io::c_stdin; using ::fast_io::c_stdout; -using ::fast_io::wc_stdin; -using ::fast_io::wc_stdout; +using ::fast_io::c_stderr; using ::fast_io::u8c_stdin; using ::fast_io::u8c_stdout; +using ::fast_io::u8c_stderr; - -namespace freestanding -{ - -using ::fast_io::freestanding::is_trivially_copyable_or_relocatable; -using ::fast_io::freestanding::is_zero_default_constructible; - -} // namespace freestanding } // namespace fast_io diff --git a/share/fast_io/fast_io_inc/legacy/filebuf.inc b/share/fast_io/fast_io_inc/legacy/filebuf.inc index 5b640b214..ee2f3e65a 100644 --- a/share/fast_io/fast_io_inc/legacy/filebuf.inc +++ b/share/fast_io/fast_io_inc/legacy/filebuf.inc @@ -49,12 +49,4 @@ using ::fast_io::scatter_pwrite_some_bytes_overflow_define; using ::fast_io::read_some_bytes_underflow_define; using ::fast_io::write_some_bytes_overflow_define; -namespace freestanding -{ - -using ::fast_io::freestanding::is_trivially_relocatable; -using ::fast_io::freestanding::is_zero_default_constructible; - -} // namespace freestanding - } // namespace fast_io \ No newline at end of file diff --git a/share/fast_io/fast_io_legacy.cppm b/share/fast_io/fast_io_legacy.cppm new file mode 100644 index 000000000..51007d80c --- /dev/null +++ b/share/fast_io/fast_io_legacy.cppm @@ -0,0 +1,18 @@ +module; + +#include +#include + +#if !(((__STDC_HOSTED__ == 1 && (!defined(_GLIBCXX_HOSTED) || _GLIBCXX_HOSTED == 1) && !defined(_LIBCPP_FREESTANDING)) || \ + defined(FAST_IO_ENABLE_HOSTED_FEATURES))) +#ifndef FAST_IO_FREESTANDING +# define FAST_IO_FREESTANDING +#endif +#endif + +export module fast_io_legacy; +export import fast_io; + +#if !defined(FAST_IO_FREESTANDING) && (!defined(_LIBCPP_HAS_NO_FILESYSTEM) || defined(_LIBCPP_HAS_FSTREAM)) +#include "fast_io_inc/legacy/filebuf.inc" +#endif