Skip to content

Add RelString, measured on Mac OS 9.2.2 - #44

Merged
colemancda merged 7 commits into
masterfrom
feature/relstring
Dec 1, 2026
Merged

colemancda merged 7 commits into
masterfrom
feature/relstring

Conversation

@colemancda

Copy link
Copy Markdown
Member

Adds TextUtilities.relString(_:_:caseSensitive:diacriticSensitive:), the Roman ordering HFS sorts catalog names by. It matches Mac OS 9.2.2 on every one-byte pair in all four sensitivity modes.

The capture

  • ReferenceTests/Retro68/RelStringCapture.c records RelString for all 65,536 pairs of one-byte strings in each mode, plus 20 multi-byte cases. It ran in the Mac OS 9.2.2 VM through the IDE-disk workflow (the iBook Carbon reference was offline).
  • The result, RelString-macos-9.2.2-ppc.bin (format GRS1), is checked in, and the README records its SHA-256.

What it showed

  • One pass, first difference wins: strings compare byte by byte through a per-mode key. With diacritics significant, "éx" sorts after "ez". A prefix sorts first, even when the longer string only adds a NUL.
  • Case and spaces: in case-sensitive mode uppercase sorts before lowercase. Space and the non-breaking space (0xCA) are equal in every mode.
  • Cross-check: each mode is a consistent total order, and the bytes it finds equal are exactly those EqualString finds equal.
  • No folding shortcut: the diacritic-insensitive orders are not the fully sensitive order applied to EqualString's folding.

Implementation

RelStringKeys.swift holds one measured key table per mode, 256 bytes each, generated from the capture. relString compares bytes through these keys.

Tests

relStringMatchesMacOS9 replays all 262,144 pairs and the 20 multi-byte cases. It accepts GRAPHITE_RELSTRING_CAPTURE to check another capture. All package tests pass.

@colemancda
colemancda merged commit 4d32858 into master Dec 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant