feat(libc): implement wide ctype classification and uppercase #17836
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17836"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-09T17:20:25Z.
What
Implements the five existing
std::ctype<wchar_t>member exports inlibSceLibcInternal:do_is(mask, wchar_t)(rh7L-TliPoc)do_is(first, last, masks)(D0lUMKU+ELI)do_scan_not(mask, first, last)(Kbe+LHOer9o)do_toupper(wchar_t)(JsZjB3TnZ8A)do_toupper(first, last)(r1W-NtOi6E8)The installed PS5
libc.prxdisassembly shows classification and case mapping read through the facet object, conversion through its narrow/widen virtual slots, anddo_scan_notdispatching through virtual scalardo_is. The range methods apply those operations per wide character. The implementation reads the facet-local tables and calls the facet conversion slots. The binary evidence is pinned to artifact SHA-256A485B34EF160EE635D357F21F4A93586BED1CF499B82918C734DCFD78B04E443; field labels follow the corresponding Dinkumware model.Against main
e5d0293e382f692802e85ed3fb3fbc8f75f432d5,tools/progress.py(collect_libraries()) measures 13,574/38,637 (35.13%) before this change and 13,579/38,637 (35.15%) in the clean merge preview. The five implementations movelibSceLibcInternalfrom 323 to 328 completed functions, with the total unchanged.The wide ctype and wide numpunct test registrations merge cleanly in either order with #17765.
Tested
Windows 11 (WinLibs GCC 15.2.0, Release): the RED control ran
guest_libc_internal_wide_ctype_redand produced the five expected named throws in order, withRED_EXPECTED_STUBS=5/5and the ordinary 1/1 CTest failure. No crash or exception occurred. c840 restore configure completed.WSL Ubuntu 22.04 (GCC 11.4.0, Release): the same RED selector produced all five expected named throws in order, with
RED_EXPECTED_STUBS=5/5and the ordinary 1/1 CTest failure. The c840 restore marker reports a clean source and successful configure.Windows GREEN on
925c062e5967aaa4c64a1a3ac2c1cba33a21e359:guest_libc_internal_wide_ctype,guest_locale, andguest_rune_localeeach passed 3/3. Public headers passed 65/65. The source and build configuration were restored to the baseline checkout after testing.WSL GREEN on
925c062e5967aaa4c64a1a3ac2c1cba33a21e359: the same three guest tests each passed 3/3, and public headers passed 65/65. The source and build configuration were restored to the baseline checkout after testing.WSL GREEN on
284b05dc74e(ordinary merge ofmain85c79e72218, which implements the otherctype<wchar_t>members inCtype.cpp; the stub-removal conflict inInventoryExports2kept both sides' removals):guest_libc_internal_wide_ctypeand main'sguest_libc_internal_ctypepassed 2/2.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)Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-09T17:53:53Z.
Review: COMMENTED
Read at
925c062e59againstmain, without building it (a title run is using this host). The facet layout and the per-element loops follow the description. One gap in how these get reached onmain:All five functions go through the facet's own
do_narrow(slot 14) and, for upper case,do_widen(slot 12). Forstd::ctype<wchar_t>onmainthose two are still the throwing stubs:_ZNKSt5ctypeIwE9do_narrowEwc(V+c0E+Uqcww) and_ZNKSt5ctypeIwE8do_widenEc(h3PbnNnZ-gI) inInventoryExports2.cpp:436-449._ZTVSt5ctypeIwE(libc/src/LocaleSupport.cpp:659), is 18 zero slots.So a facet that inherits narrow/widen from the base class throws
NotImplementedinsidedo_is. One built on the library's vtable has a null slot 14. The test's fixture brings its own narrow/widen, so it doesn't cover this.do_narrow(wchar_t, char)anddo_widen(char)are probably small enough to add here. Otherwise, a line in the debt entry saying these five need a facet that overrides narrow and widen would make the limit visible.AI-assisted: yes (Claude Code)