Repository navigation
feat(libSceIcu): implement the string and UTF-8 character iterators - #11136
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Progress report (89a7f98 → 1138f8b)📈 System libraries: 26.81% (+0.1%, +47 implemented functions) ✅ 47 implemented
Changed libraries (implemented exports)
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the PR-specific iterator commit 428dab7 on its declared stack after #11132. Compared the string and UTF-8 iterator setup, callbacks, lazy UTF-16 indexing, surrogate-pair state, and malformed UTF-8 handling with ICU 78.1 uiter.cpp and uiter.h. The 112-byte guest layout, callback signatures, state/error ordering, and iterator behavior match the referenced implementation.
Local checks on this commit:
g++ -std=c++20 -Icore/libs -Icore/libs/prx/libc/include -fsyntax-onlyforIterator.cppandGuestIcuIterator.cpp: passed.- Built and ran
GuestIcuIterator.cppwithIterator.cppdirectly: passed, including the seeded malformed UTF-8 and state/movement cases. - Repeated that executable with AddressSanitizer and UndefinedBehaviorSanitizer: passed.
python3 tools/check_conventions.py --base upstream/main --head HEAD: passed.
The PR reports the full ICU suite and NID-patched library build on Windows; this host run covered the new iterator test only. Hosted eligibility, conventions, intake, labels and report checks pass; product build/test jobs are skipped. The declared dependency on #11132 remains part of the agreed ICU merge order.
|
@mantavisual
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the 36 stubs whose NIDs open PRs boykopovar#10962-boykopovar#10967, boykopovar#11115, boykopovar#11118, boykopovar#11122, boykopovar#11132 and boykopovar#11136 add to libSceIcu, leaving 112.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
…iterators # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt # docs/dev/debt/libSceIcu.md
…ric-helpers # Conflicts: # core/libs/prx/libSceIcu/libSceIcu.hpp # docs/dev/debt/libSceIcu.md
…rror-name # Conflicts: # core/libs/prx/libSceIcu/Version.cpp # core/libs/prx/libSceIcu/Version.hpp # core/libs/prx/libSceIcu/libSceIcu.hpp
…field-position # Conflicts: # core/libs/prx/libSceIcu/libSceIcu.hpp
…iterators # Conflicts: # core/libs/prx/libSceIcu/Iterator.hpp # core/libs/prx/libSceIcu/libSceIcu.hpp
…ric-helpers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt
…ric-helpers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt # docs/dev/debt/libSceIcu.md
…rror-name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt
…field-position Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt
…-point-sets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt # docs/dev/debt/libSceIcu.md
…patch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt
…iterators Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # core/libs/prx/libSceIcu/CMakeLists.txt
What
Implements
uiter_setStringanduiter_setUTF8, two exports that firmware 13.42'slibSceIcuhas (BunnyFl's export list). They fill a caller-ownedUCharIterator, ICU's C character iterator, which callers then drive through its function pointers:getIndex,move,hasNext,hasPrevious,current,next,previous,getStateandsetState. 13.42 also exportsucol_strcollIter, which consumes such iterators.The code is a port of ICU 78.1's uiter.cpp: the no-op,
char16_tstring and UTF-8 iterators. They are installed into the public 112-byteUCharIteratorlayout from uiter.h. The callbacks use the guest ABI, so guest code can call them, and they carry the_nid_no_patchsuffix because they are helpers, not exports.u_strlen's orstrlen's 32-bit result. Anything else installs the no-op iterator: index 0,U_SENTINELfor code units,UITER_NO_STATE, andsetStatereportsU_UNSUPPORTED_ERROR. A null iterator is ignored.UPRV_NO_SANITIZE_UNDEFINEDfunctions.moveclamps to start/limit, an unknown origin returns −1, the state is the index, andsetStatechecks the error, the iterator and the bounds in ICU's order.reservedFieldbetween them.byte offset << 1 | inside-pair, andsetStatevalidates it as ICU does.movefollows ICU's shortcuts and itsUITER_UNKNOWN_INDEXresults. That includes one quirk, which is kept: when an unknown-index forward move reaches the end, the index ICU has just computed is overwritten by the running position.U8_NEXT_OR_FFFDand fromU8_PREV_OR_FFFD'sutf8_prevCharSafeBody(..., -3)in utf8.h and utf_impl.cpp, with their validity bit tables.A callback given a null iterator, and the no-op
setStategiven a null error pointer, throwAPS5_INVALID_ARG_EX, since ICU dereferences them. The string and UTF-8setStateaccept a null error pointer as ICU does. The new debt entry records the port and that nothing is compared with a console.Depends on #11132 (stacked on it). The agreed ICU order is #11013 → #10961 → … → #10967 → #11088 → #11115 → #11118 → #11122 → #11132, and this PR comes after #11132. Until those merge, the diff also shows their commits. This PR's own change is the last commit,
428dab7efa.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, on #11132 (c1d9fa2f64).guest_icu_iterator, which drives every iterator only through its function pointers:setState's error, iterator and bound checks. Also explicit lengths with embedded NULs and the empty string.setStaterejections.getState/setStateround trip must restore it.E0lead accept80..9Ftrail bytes fails the forward comparison, and dropping the truncated four-byte case in the backward decoder fails the backward comparison.ctest -R "guest_icu_|patched_libraries": all 8 pass. The NID-patchedlibSceIcu.prxbuilds.tools/progress.py --module libSceIcu: 52 implemented, 0 stubs (+2; the callbacks are not counted).tools/check_test_registration.py build: 1347 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR implements or names anyuiter_function (checked 2026-10-25).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)