Provide locale-bound POSIX byte string comparisons #94

Open
opened 2026-11-08 18:30:32 +01:00 by erikinkinen · 1 comment
Owner

Problem and motivation

The selected CMake source uses external strcasecmp and strncasecmp on its Clang/GNU-compatible path. Git core also calls both directly. EriX has byte classification and ordinary comparisons, but these required POSIX interfaces are missing.

Proposed behavior and scope

Add both conventional functions and their hidden native aliases, with a standard strings.h declaration. Compare unsigned bytes after the installed locale profile's byte lowercasing. C/POSIX and the current UTF-8 profile use the existing ASCII byte mapping; this does not provide Unicode case folding.

Select the rooted exports with an explicit startup case-insensitive-string feature requiring current-locale. Reuse the original character companion. Unobserved _l variants and optional GNU extensions are outside this feature.

Authority, security and reliability

Borrow the sole installed process runtime and its actual current thread/category selection. Missing, foreign or retired bindings refuse rather than select an implicit C or host locale. Source ranges remain caller-owned and read-only; overlapping inputs are valid. No allocation, cursor, errno mutation or new thread-image field is needed. The counted interface uses full-width size_t, stops at the first difference or zero, and reads neither string at zero count. Results promise ordering sign only.

Acceptance criteria

  • Implement both functions over the actual locale and original character companion, with complete range and inline safety contracts.
  • Provide C/C++ headers, conventional/hidden aliases and explicit native producer feature/symbol checks.
  • Cover all 256 byte values, mixed case, high bytes, zero/count bounds, full-width counts, read-only guards and result sign.
  • Cover actual root/thread/locale lifetime failures and preserve the original ABI, error and retirement behavior.
  • Update the manual and pass affected strict Rust/header/native controls.

Alternatives and tradeoffs

A hard-coded process-global C fallback would bypass current locale selection. Unicode folding would introduce behavior beyond these byte interfaces. Optional upstream fallback implementations must be distinguished from calls actually selected by the declared build recipes.

Tracking and rollout

Build on #93 and the existing current-locale providers. Implementation: #95. Native producer bindings: Integration #617. Manual and API contracts: Docs #94. This pair does not establish closure for the complete external workload inventory or guest toolchain adoption.

## Problem and motivation The selected CMake source uses external `strcasecmp` and `strncasecmp` on its Clang/GNU-compatible path. Git core also calls both directly. EriX has byte classification and ordinary comparisons, but these required POSIX interfaces are missing. ## Proposed behavior and scope Add both conventional functions and their hidden native aliases, with a standard `strings.h` declaration. Compare unsigned bytes after the installed locale profile's byte lowercasing. C/POSIX and the current UTF-8 profile use the existing ASCII byte mapping; this does not provide Unicode case folding. Select the rooted exports with an explicit startup `case-insensitive-string` feature requiring `current-locale`. Reuse the original character companion. Unobserved `_l` variants and optional GNU extensions are outside this feature. ## Authority, security and reliability Borrow the sole installed process runtime and its actual current thread/category selection. Missing, foreign or retired bindings refuse rather than select an implicit C or host locale. Source ranges remain caller-owned and read-only; overlapping inputs are valid. No allocation, cursor, errno mutation or new thread-image field is needed. The counted interface uses full-width `size_t`, stops at the first difference or zero, and reads neither string at zero count. Results promise ordering sign only. ## Acceptance criteria - [x] Implement both functions over the actual locale and original character companion, with complete range and inline safety contracts. - [x] Provide C/C++ headers, conventional/hidden aliases and explicit native producer feature/symbol checks. - [x] Cover all 256 byte values, mixed case, high bytes, zero/count bounds, full-width counts, read-only guards and result sign. - [x] Cover actual root/thread/locale lifetime failures and preserve the original ABI, error and retirement behavior. - [x] Update the manual and pass affected strict Rust/header/native controls. ## Alternatives and tradeoffs A hard-coded process-global C fallback would bypass current locale selection. Unicode folding would introduce behavior beyond these byte interfaces. Optional upstream fallback implementations must be distinguished from calls actually selected by the declared build recipes. ## Tracking and rollout Build on #93 and the existing current-locale providers. Implementation: #95. Native producer bindings: [Integration #617](https://git.erikinkinen.fi/erix/integration/pulls/617). Manual and API contracts: [Docs #94](https://git.erikinkinen.fi/erix/docs/pulls/94). This pair does not establish closure for the complete external workload inventory or guest toolchain adoption.
erikinkinen added this to the Alpha 1 milestone 2026-11-08 18:30:32 +01:00
Author
Owner

Both required comparisons are implemented in #95, with producer bindings in Integration #617 and the manual/API contracts in Docs #94. Independent case-only builds keep the memory/tokenizer feature disabled. Actual image and workload acceptance remain separate.

Both required comparisons are implemented in #95, with producer bindings in Integration #617 and the manual/API contracts in Docs #94. Independent case-only builds keep the memory/tokenizer feature disabled. Actual image and workload acceptance remain separate.
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set

Reference
erix/lib-cstd#94
No description provided.