feat(libSceIcu): implement Unicode decimal digit classification #16250

Closed
nabil88 wants to merge 1 commit from upstream-pr/16250 into main
nabil88 commented 2026-11-05 23:54:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nabil88 on 2026-11-05T23:54:54Z.


What

u_charDigitValue, u_digit, u_isdigit and u_isxdigit in libSceIcu threw through NotImplemented_nid_no_patch. They now follow ICU 78.1 uchar.cpp over the Unicode 17.0 Nd ranges (72 ranges, 770 code points) instead of ICU's property data. u_digit accepts radices 2 to 36 and ASCII/fullwidth letters; other radices return -1. The console behavior is not verified.

Tested

Windows, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON:

  • ctest --test-dir build-full -R "guest_icu_character" passes guest_icu_character, including ASCII, Arabic-Indic, extended Arabic-Indic, fullwidth, Myanmar and mathematical-digit spot checks, the u_isxdigit ASCII/fullwidth matrix and the u_digit radix/letter cases.
  • python tools/check_conventions.py --base origin/main passes.
  • pr_overlap reports no overlap with any open pull request.

Not tested on a console; the classification follows the public Unicode/ICU data, unverified against the console.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5180528993 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16250). Originally posted by [nabil88](https://github.com/nabil88) on 2026-11-05T23:54:54Z. --- ### What `u_charDigitValue`, `u_digit`, `u_isdigit` and `u_isxdigit` in libSceIcu threw through `NotImplemented_nid_no_patch`. They now follow ICU 78.1 `uchar.cpp` over the Unicode 17.0 `Nd` ranges (72 ranges, 770 code points) instead of ICU's property data. `u_digit` accepts radices 2 to 36 and ASCII/fullwidth letters; other radices return -1. The console behavior is not verified. ### Tested Windows, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`: - `ctest --test-dir build-full -R "guest_icu_character"` passes `guest_icu_character`, including ASCII, Arabic-Indic, extended Arabic-Indic, fullwidth, Myanmar and mathematical-digit spot checks, the `u_isxdigit` ASCII/fullwidth matrix and the `u_digit` radix/letter cases. - `python tools/check_conventions.py --base origin/main` passes. - `pr_overlap` reports no overlap with any open pull request. Not tested on a console; the classification follows the public Unicode/ICU data, unverified against the console. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
ahmadmuj commented 2026-11-06 07:18:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T07:18:13Z.

Review: COMMENTED


Checked head c0c6e77bfe, PR base 399292ce5c. This review covers u_isdigit and u_isxdigit only.

On Linux, I built the actual libSceIcu module with main ea443a1546 integrated locally. The classification bodies, helper and table remain byte-identical to this head. Both character fixtures pass. The local resolution combines Character.cpp/header additions, removes replaced stubs, and gives main's fixture a separate registration. The contributor branch still needs conflict resolution.

A separate probe parses category fields from pinned UnicodeData.txt, including First/Last records. It applies the ASCII/fullwidth hex rules from uchar.cpp. All code points through U+10FFFF and eight invalid int32 controls match: 2,228,240 exact 0/1 comparisons, zero mismatches. There are 770 decimal and 794 hex positives. Loader bindings confirm both calls use the built module.

A probe-only boundary mutation at U+0030 produces the expected mismatch. No classification issue found against that source. Numeric-value exports and console compatibility are outside this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5796958844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16250#pullrequestreview-5796958844). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-06T07:18:13Z. **Review:** COMMENTED --- Checked head c0c6e77bfefaf83aedc4d8f8ca191d11a1b4617d, PR base 399292ce5ce33a055959e9134c9af0b2e76a9ee0. This review covers u_isdigit and u_isxdigit only. On Linux, I built the actual libSceIcu module with main ea443a1546ca04f66d15ebf17b0fd4d98d75f7e6 integrated locally. The classification bodies, helper and table remain byte-identical to this head. Both character fixtures pass. The local resolution combines Character.cpp/header additions, removes replaced stubs, and gives main's fixture a separate registration. The contributor branch still needs conflict resolution. A separate probe parses category fields from [pinned UnicodeData.txt](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/data/unidata/UnicodeData.txt), including First/Last records. It applies the ASCII/fullwidth hex rules from [uchar.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uchar.cpp#L115-L135). All code points through U+10FFFF and eight invalid int32 controls match: 2,228,240 exact 0/1 comparisons, zero mismatches. There are 770 decimal and 794 hex positives. Loader bindings confirm both calls use the built module. A probe-only boundary mutation at U+0030 produces the expected mismatch. No classification issue found against that source. Numeric-value exports and console compatibility are outside this review.
MarcZX10 commented 2026-11-18 04:40:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T04:40:12Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: ensure the four implemented functions have the correct public export names and are reachable through the library’s export registration.

What I ran

Reviewed head c0c6e77bfefaf83aedc4d8f8ca191d11a1b4617d using the prepared diff and the pinned repository reader, repo_read.py. No build or tests were run.

Results

Check Result Note
Patch and source review passed Inspected implementation, declarations, and CMake wiring.
Tests not run No test command was run during this review.
Console behavior not run The description reports this is unverified.

Findings

Blocking

  • The new implementations do not use the exported symbol names. The implementations and declarations define u_charDigitValue_nid_postfix, u_digit_nid_postfix, u_isdigit_nid_postfix, and u_isxdigit_nid_postfix as plain C-linkage symbols. The diff removes the old throwing implementations from Export.cpp, but does not add APS5_EXPORT registrations for the new implementations. The nearby unknown export in that file explicitly uses APS5_EXPORT, while these four functions have no corresponding registration in the inspected changed code. As a result, calls through the library’s public ICU export names will not be routed to these implementations. Register the four functions with the correct export names/NIDs. Evidence: core/libs/prx/libSceIcu/Character.cpp:48 and core/libs/prx/libSceIcu/Character.cpp:67.

Non-blocking

None.

Not verified

  • Did not run the test suite, convention checker, or overlap check reported in the PR description.
  • Did not verify behavior or symbol availability on a physical console.
  • Read all six files listed as reviewed in manifest.json: core/libs/prx/libSceIcu/CMakeLists.txt, core/libs/prx/libSceIcu/Character.cpp, core/libs/prx/libSceIcu/Character.hpp, core/libs/prx/libSceIcu/Export.cpp, core/libs/prx/libSceIcu/Identified.hpp, core/libs/tests/GuestIcuCharacter.cpp, and docs/dev/debt/libSceIcu.md. No changed files were excluded; files.json was unavailable through the reader.

To get this to a good state

Register the four implementations under their public export names/NIDs, then rerun the character test and convention check on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5950893218 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16250#pullrequestreview-5950893218). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T04:40:12Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: ensure the four implemented functions have the correct public export names and are reachable through the library’s export registration. ## What I ran Reviewed head `c0c6e77bfefaf83aedc4d8f8ca191d11a1b4617d` using the prepared diff and the pinned repository reader, `repo_read.py`. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Patch and source review | passed | Inspected implementation, declarations, and CMake wiring. | | Tests | not run | No test command was run during this review. | | Console behavior | not run | The description reports this is unverified. | ## Findings ### Blocking - **The new implementations do not use the exported symbol names.** The implementations and declarations define `u_charDigitValue_nid_postfix`, `u_digit_nid_postfix`, `u_isdigit_nid_postfix`, and `u_isxdigit_nid_postfix` as plain C-linkage symbols. The diff removes the old throwing implementations from `Export.cpp`, but does not add `APS5_EXPORT` registrations for the new implementations. The nearby unknown export in that file explicitly uses `APS5_EXPORT`, while these four functions have no corresponding registration in the inspected changed code. As a result, calls through the library’s public ICU export names will not be routed to these implementations. Register the four functions with the correct export names/NIDs. Evidence: `core/libs/prx/libSceIcu/Character.cpp:48` and `core/libs/prx/libSceIcu/Character.cpp:67`. ### Non-blocking None. ## Not verified - Did not run the test suite, convention checker, or overlap check reported in the PR description. - Did not verify behavior or symbol availability on a physical console. - Read all six files listed as reviewed in `manifest.json`: `core/libs/prx/libSceIcu/CMakeLists.txt`, `core/libs/prx/libSceIcu/Character.cpp`, `core/libs/prx/libSceIcu/Character.hpp`, `core/libs/prx/libSceIcu/Export.cpp`, `core/libs/prx/libSceIcu/Identified.hpp`, `core/libs/tests/GuestIcuCharacter.cpp`, and `docs/dev/debt/libSceIcu.md`. No changed files were excluded; `files.json` was unavailable through the reader. ## To get this to a good state Register the four implementations under their public export names/NIDs, then rerun the character test and convention check on the updated head.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!16250
No description provided.