feat(libSceIcu): implement the constrained field position exports #11118
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11118"
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 mantavisual on 2026-10-25T18:38:51Z.
What
Implements the seven
ucfpos_exports that firmware 13.42'slibSceIcuhas (BunnyFl's export list):ucfpos_open,ucfpos_close,ucfpos_constrainCategory,ucfpos_constrainField,ucfpos_getCategory,ucfpos_getFieldanducfpos_getIndexes.UConstrainedFieldPositionis the state object callers pass toufmtval_nextPositionto walk the fields of formatted output. It holds a constraint, category, field and start/limit indexes, and needs no Unicode data.Behaviour follows ICU 78.1's formattedvalue.cpp and the handle check in capi_helper.h:
ucfpos_openreturns a new position with categoryUFIELD_CATEGORY_UNDEFINED(0), field 0 and indexes 0/0. Like ICU, it neither checks nor sets the error code unless allocation fails, so an incoming error and a null error pointer are accepted.Every other function validates the handle as
IcuCApiHelper::validatedoes:U_ILLEGAL_ARGUMENT_ERROR;0x55434600("UCF") setsU_INVALID_FORMAT_ERROR.Failing getters return 0 and leave the index outputs untouched.
ucfpos_constrainCategorysets the category constraint and keeps the field.ucfpos_constrainFieldsets the field constraint, category and field.ucfpos_closevalidates with its own status, clears the magic and frees the object, so null and foreign pointers are ignored.The handle is a host object that starts with the magic; the rest of its layout differs from ICU's, which callers can't see. A null error pointer, or a null
ucfpos_getIndexesoutput on a valid handle, throwsAPS5_INVALID_ARG_EX, since ICU dereferences them. No exported formatter fills a position yet, soucfpos_getIndexesreports 0/0. The constraint is stored for a laterufmtval_nextPosition. The new debt entry records all of this.Depends on #11115 (stacked on it). The agreed ICU order is #11013 → #10961 → … → #10967 → #11088 → #11115, and this PR comes after #11115. Until those merge, the diff also shows their commits. This PR's own change is the last commit,
c65ef82953.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, on #11115 (eb607ba588).guest_icu_constrained_field_position:ucfpos_openwith an incoming error and with a null error pointer.U_ILLEGAL_ARGUMENT_ERROR) and a zeroed foreign buffer (U_INVALID_FORMAT_ERROR).ucfpos_closeof null and foreign pointers.ctest -R "guest_icu_|patched_libraries": all 5 pass. The NID-patchedlibSceIcu.prxbuilds.tools/progress.py --module libSceIcu: 38 implemented, 0 stubs.tools/check_test_registration.py build: 1344 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR implements or names anyucfpos_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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:42:13Z.
Review: APPROVED
Reviewed exact head
c65ef82953against ICU 78.1formattedvalue.cppandcapi_helper.h. The magic value, success/error short-circuiting, null/foreign handle status, default state, category/field constraints, and getter fallbacks match those references. The small differences documented for null error/index pointers are explicit and follow the repository’s throw-on-unknown/error rule. I independently built and ranGuestIcuConstrainedFieldPositionwith GCC 12.2; it passed. The PR reports five focused ICU tests passing, and hosted conventions/intake checks are green; product build/test jobs are skipped. Its dependency on #11115 is declared.