feat(libSceIcu): implement field position iterator C API #19435
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19435"
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 AlexWhitehouse on 2026-11-13T09:33:20Z.
What
libSceIcu's field-position iterator C API threw
not implemented. #17265 had already givenufieldpositer_openandufieldpositer_closetheir signatures and early returns. This PR implements the rest of those two, plusufieldpositer_next:ufieldpositer_openNs2ep8k12awufieldpositer_closemANYKKAD1dgufieldpositer_nextv9QRrGYy3lkSources: the ICU revision the repository already builds (049e0d6a, ICU 78.1). These files are compiled unchanged into
icu_i18n:ufieldpositer.cpp;fpositer.cpp;fphdlimp.cpp.The three small
FieldPositionmethods they need (RTTI, destructor andclone) are ported fromformat.cppintoFieldPositionBackend.cpp, which starts with that file's notice. Building the whole offormat.cppwould pull in locale and formatting code. I checked ICU 68.2, which the library's other early-return entries cite: these C functions behave the same there.Behaviour:
openleaves an incoming failure status as is and returns null. Otherwise it creates an iterator and keeps the incoming status, so a warning survives.nextreturns the next field and writes its begin and end through whichever pointers aren't null. Once the iterator is exhausted, it returns -1 and leaves both outputs unchanged.close(nullptr)does nothing.Handles: the library records the iterators it creates, as its other opaque-handle wrappers do.
nextorcloseon a handle it didn't create throws, so the existing foreign-handle assertions still hold.Debt (as a fragment,
docs/dev/debt/changes/feat-libsceicu-field-position-iterator.md):ufieldpositer_nextplaceholder moves out ofRecoveredInventory.cpp, so the count of remaining placeholders drops from 48 to 47 (the entry onmainstill says 49 afteruscript_getCodeleft it).openandclosewere already outside it;Tested
guest_icu_field_position_iterator(core/libs/prx/libSceIcu/tests/FieldPositionIteratorBehavior.cpp) covers:openwith success and warning statuses, and failure statuses returning null with the status unchanged;FieldPositionIteratorHandler, iterated in insertion order and then exhausted;close(nullptr).main, the test fails withufieldpositer_open_nid_postfix not implemented;guest_icu_field_position_iterator,guest_icu_recovered_signatures(existing assertions unchanged) andpublic_headerspass.guest_icu_field_position_iterator,guest_icu_recovered_signatures,patched_librariesandpublic_headerspass at 477e77f654.libSceIcu.prxrelinks with no warnings in the changed files and no duplicate or undefined ICU symbols. The branch was then rebased onto currentmainwithout conflicts, and the focused tests pass again on Linux.python3 tools/check_conventions.py --base origin/main: all checks passed.python3 tools/pr_overlap.py: no open PR implements these exports.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