feat(libc): implement the C locale wide character class functions #1783
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1783"
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 babyhuey on 2026-10-08T19:07:21Z.
What
Implements the C locale wide character class functions in libc on top of the rune locale from #1781:
iswalnum,iswalpha,iswblank,iswcntrl,iswdigit,iswgraph,iswlower,iswprint,iswpunct,iswspace,iswupper,iswxdigit,iswctype,wctype,towlower,towupper,btowcandwctob.Following FreeBSD 11
_ctype.h,wctype.c,btowc.c,wctob.candnone.cfor the C locale, the only onesetlocaleaccepts:isw*andiswctypetest_CurrentRuneLocale->__runetype[c]for 0..255 and are false above 0xFF and forWEOF(the_extranges are empty).iswalnumis_CTYPE_A|_CTYPE_N.wctypereturns FreeBSD's_CTYPE_*masks for the twelve standard names and the BSDideogram,special,phonogram,numberandrune, and 0 for any other name.towlower/towuppermap 0..255 through__maplower/__mapupperand return anything else unchanged.btowc(EOF)isWEOF; any other value is(unsigned char)c.wctobreturns the value for 0..255 andEOFotherwise, includingWEOF.Found with
tools/import_audit.pyon the catalog homebrew titles: each of these is absent in 9 or 10 of 36 audited titles.Builds on #1781, which has merged; this branch is now a single commit on
main.Tested
Linux (Ubuntu 24.04, GCC 13, Release):
guest_rune_localepasses with--repeat until-fail:3. It now checks everyisw*/iswctypeagainst the narrowis*exports for 0..299 andWEOF, everywctypename and unknown names,towlower/towupperfor 0..299 andWEOF, andbtowc/wctobat EOF, 0, ASCII, 0xE9, negative bytes, 0x100, 0x20AC andWEOF. It fails whenwctobdrops its range check.check_conventions.pypasses. Windows: both files compile with MinGW-w64 GCC 13 (-Wall -Wextra -fsyntax-only); not run on Windows.import_audit.pywith #1781 and this branch, absent imports before → after: PPSA19111 66 → 45, PPSA59322 ccleste 50 → 29, PPSA68091 Ruffle 71 → 50, PPSA97510 74 → 53, PPSA98510 74 → 53, PPSA99002 74 → 53, PPSA99010 vkQuake 51 → 30, PPSA99420 116 → 110, PPSA99728 28 → 26, PPSA99764 80 → 59, PPSA99810 64 → 43. No title run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:46:04Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
10ff0cef, merged ontomaind70b8998in one build with 38 other PRs that had no Windows run.guest_rune_locale. None of them reported skipping a case.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:10:52Z.
Progress report (
2f250f8→1bfb3cb)📈 System libraries: 85.77% (+0.08%, +18 implemented functions)
✅ 18 implemented
btowc_nid_postfixiswalnum_nid_postfixiswalpha_nid_postfixiswblank_nid_postfixiswcntrl_nid_postfixiswctype_nid_postfixiswdigit_nid_postfixiswgraph_nid_postfixiswlower_nid_postfixiswprint_nid_postfixiswpunct_nid_postfixiswspace_nid_postfixiswupper_nid_postfixiswxdigit_nid_postfixtowlower_nid_postfixtowupper_nid_postfixwctob_nid_postfixwctype_nid_postfix