#include "prx/libc/include/general/VabiMacros.hpp" #include #include #include #include extern "C" { int __mb_cur_max_nid_postfix = 1; int APS5_VABI ___mb_cur_max_nid_postfix() { return 1; } int APS5_VABI mbsinit_nid_postfix(const void*) { return 1; } std::size_t APS5_VABI mbrtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count, void*) { if (!source) return 0; if (!count) return static_cast(-2); const auto value = static_cast(*source); if (destination) *destination = value; return value != 0; } std::size_t APS5_VABI mbrlen_nid_postfix(const char* source, std::size_t count, void* state) { return mbrtowc_nid_postfix(nullptr, source, count, state); } int APS5_VABI mbtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count) { const auto result = mbrtowc_nid_postfix(destination, source, count, nullptr); if (result == static_cast(-2)) { errno = 86; return -1; } return static_cast(result); } std::size_t APS5_VABI wcrtomb_nid_postfix(char* destination, std::uint16_t value, void*) { if (!destination) return 1; if (value > 255) { errno = 86; return static_cast(-1); } *destination = static_cast(value); return 1; } std::size_t APS5_VABI mbsrtowcs_nid_postfix(std::uint16_t* destination, const char** source, std::size_t capacity, void*) { if (!destination) return std::strlen(*source); std::size_t converted = 0; while (converted < capacity) { const auto value = static_cast((*source)[converted]); destination[converted] = value; if (value == 0) { *source = nullptr; return converted; } ++converted; } *source += converted; return converted; } }