Repository navigation
Conversation
…ow members do_widen(char), do_widen(range), do_narrow(wchar_t, char) and do_narrow(range) of ctype<wchar_t> run libc btowc and wctob, the one-byte mbrtowc and wcrtomb that Dinkumware's _Dowiden and _Donarrow perform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for your contribution! Authors with no pull requests merged into |
Progress report (b11c7bf → 22335bf)📈 System libraries: 26.72% (+0.01%, +4 implemented, -4 removed functions) ✅ 4 implemented
🗑️ 4 removed
Changed libraries (implemented exports)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the four
std::ctype<wchar_t>widen and narrow members that libSceLibcInternal declared as stubs throwing throughNotImplemented_nid_no_patchinInventoryExports2.cpp:_ZNKSt5ctypeIwE8do_widenEch3PbnNnZ-gIbtowcof the byte, cut to the 16-bitwchar_t_ZNKSt5ctypeIwE8do_widenEPKcS2_PwKM0b6O8show[first, last)into the destination, returnslast_ZNKSt5ctypeIwE9do_narrowEwcV+c0E+Uqcwwwctobof the character, or the default when it has no one-byte form_ZNKSt5ctypeIwE9do_narrowEPKwS2_cPcVf68JAD5rbM[first, last)into the destination, returnslastThe reference is the Dinkumware
ctype<wchar_t>in microsoft/STLstl/inc/xlocaleat e1ed302, lines 2999 to 3037. There,_Dowidenisreturn _Mbrtowc(&_Wc, &_Byte, 1, &_Mbst, &_Cvt) < 0 ? static_cast<wchar_t>(WEOF) : _Wc;with a freshmbstate_t,_Donarrowisreturn _Wcrtomb(_Buf, _Ch, &_Mbst, &_Cvt) != 1 ? _Dflt : _Buf[0];, and both range forms loop*_Dest = _Dowiden(*_First)(or_Donarrow) up to_Lastand return_First. ISO C definesbtowcas exactly that one-bytembrtowcfrom the initial shift state (WEOF unless(unsigned char)cis a valid single-byte character) andwctobas thatwcrtombwhich must produce one byte (EOF otherwise), so the members run the existing libcbtowc_nid_postfixandwctob_nid_postfix(declared inprx/libc/include/Api.hpp). The byte is passed asunsigned char, so'\xff'is not read asEOF.wchar_tis 16 bits here, as in libc'smbtowcandnumpunct<wchar_t>, soWEOFbecomes 0xffff. The NIDs were checked by computing them from the mangled names withtools/nid_names.pycompute_nid.No libc export is added: the members live in libSceLibcInternal and call libc through its header, as
AlignedNew.cppdoes.Changes:
core/libs/prx/libSceLibcInternal/WideCtype.cpp: the four members, exported under their NIDs. They are declared inprx/libSceLibcInternal/include/Api.hppand built byCMakeLists.txt.core/libs/prx/libSceLibcInternal/InventoryExports2.cpp: the four stubs are removed.core/libs/tests/GuestLibcInternalWideCtype.cpp(guest_libc_internal_wide_ctype): checksdo_widen(char)for everycharvalue, including thaterrnobecomes 86 (EILSEQ) for the bytesbtowcrejects (0x80 to 0xbf, 0xf0 to 0xff) and stays 0 for incomplete lead bytes; checksdo_narrow(wchar_t, char)for every 16-bit value with the defaults?and\x80; checks a full range and a sub-range of both range forms, with\0, 0x7f, 0x80, 0xc3, 0xff, 0xe9, 0x20ac and 0xffff and an untouched guard element after the destination; and checks empty ranges with a null destination.docs/dev/debt/libSceLibcInternal.md: the four names are cut from their "signatures and behavior are unverified" entry. A Functional entry records the reference, and that the facet is not read: the console keeps the conversion state of the facet's locale in it (_Cvt), so a facet built for a locale other than C converts as libc's C locale does here, and the console bodies were not read.tools/progress.pycollect_libraries(): origin/mainb11c7bf84fhas 9921 done of 37146 (libSceLibcInternal 92 done, 1045 todo). This branch has 9925 done of 37146 (libSceLibcInternal 96 done, 1041 todo). Done goes up by 4, and the todo names removed are exactly the four stubs. No new todo appears.Wide stream formatting and parsing widen and narrow through
ctype<wchar_t>(num_putandtime_putstage 2, pattern scanning). This is runtime completeness; no title trace calls them yet.Tested
Only the libraries and the focused test target were built (
ninja -j3 guest_libc_internal_wide_ctype_tests libSceLibcInternal). No title was run.ctest -R '^(guest_libc_internal_wide_ctype|public_headers|conventions_unknown_nids|conventions_debt_length|conventions_doc_links|debt_split)$'ran 3 times, and each run passed 6 of 6 tests with 0 failures.guest_libc_internal_wide_ctypeis the new guest test.public_headerschecks the new declarations.conventions_unknown_nids,conventions_debt_length,conventions_doc_linksanddebt_splitare the repository's checker self-tests for the conventions and the debt-file split; they were run because the debt file changed.libSceLibcInternal.prxexportsh3PbnNnZ-gI,KM0b6O8show,V+c0E+UqcwwandVf68JAD5rbM(objdump -p).Api.hppandInventoryExports2.cpp, withoutWideCtype.cpp, plus the new test fail to buildguest_libc_internal_wide_ctype_tests. The errors saysceLibcInternalWideCtypeWiden_nid_no_patch,sceLibcInternalWideCtypeWidenRange_nid_no_patch,sceLibcInternalWideCtypeNarrow_nid_no_patchandsceLibcInternalWideCtypeNarrowRange_nid_no_patchwere not declared.python3 tools/check_conventions.py --base origin/mainprinted "All conventions checks passed."python3 tools/pr_overlap.py --branch feat/r3-ctype-wchar-widencompared 1822 open PRs and failed closed. It found no PR with the same exports or the same new files. It reported line-level file overlaps with refactor(libSceLibcInternal): serve siginterrupt from libSceLibcInternal #10749 and feat(libSceLibcInternal): implement collate<char> compare, hash and do_* members #15711 (docs/dev/debt/libSceLibcInternal.mdL330, the top of Functional), feat(libSceLibcInternal): implement the numpunct<char> members #14373, feat(libSceLibcInternal): run the deleting destructors of future_error, overflow_error and underflow_error #14834, feat(libSceLibcInternal): implement basic_string erase, append, assign, _Xran and _Xlen #15692 and feat(libSceLibcInternal): forward the error category destructors, _Xoverflow_error and the __sce_v2 mutex name override to libc #15697 (include/Api.hppL123), and feat(libSceLibcInternal): run the C++ ABI type_info destructors #15695 and feat(libSceLibcInternal): implement the error category names and codecvt_base queries #15696 (include/Api.hppL123 andCMakeLists.txtL62). It could not compare feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, fix(relinker): match AppContent utility import to provider #13486, feat(libSceLibcInternal): implement the msun trigonometric kernels #13778, feat(libSceLibcInternal): implement floating-point word access #13782, docs(debt): separate entries with blank lines and drop derived export totals #14212, feat(libSceLibcInternal): implement zero-return showmanyc exports #14401, feat(libSceLibcInternal): implement the placement operator delete and delete[] #14837 and feat(libSceLibcInternal): implement std::_MP_Add, _MP_Get, _MP_Mul and _MP_Rem #14936, which conflict with main, on the shared filesCMakeLists.txt,include/Api.hppand the libSceLibcInternal debt file. I grepped the added and removed lines of all 16 of them (gh pr diff) for the four NIDs, the four symbols, the stub names andWideCtype. None has a match, so none implements or removes these members; the overlaps are neighbouring lines only. For feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021gh pr diffreturned a single added line, so that check covers only what GitHub served.ctype<char>widen and narrow) edits the debt lines two above the line changed here, with one unchanged line between, and does not touch these members.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code