Skip to content

api: Obsolete spacing and stop passing it to liblouis - #32

Merged
henrikottesorensen merged 1 commit into
Notalib:mainfrom
henrikottesorensen:feature/obsolete-spacing
Oct 9, 2026
Merged

henrikottesorensen merged 1 commit into
Notalib:mainfrom
henrikottesorensen:feature/obsolete-spacing

Conversation

@henrikottesorensen

@henrikottesorensen henrikottesorensen commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes main, which has been red since #31 merged.

liblouis 3.39.0 deprecated the spacing parameter of lou_translate, lou_translateString, lou_backTranslate and lou_backTranslateString, and in practice it now ignores it. Each function only logs "the spacing parameter is deprecated and ignored; pass NULL" and never writes to the buffer. The release notes only say deprecated; the source shows it's ignored.

That breaks #19 on 3.39.0:

  • OutputSpacing reads back from a buffer liblouis no longer writes, so it returned the caller's own request as if it were liblouis's answer.
  • Every call that passed spacing logged the warning.
  • Spacing_ReportsTheRequestedDigits_AgainstTheOutputCellsTheyProduced and Spacing_BackTranslation_CoversTheWholeOutput fail on main.

Changes

  • C# can't put [Obsolete] on a parameter, so each of the four public Translate/BackTranslate methods gets a new overload without spacing. The new overload holds the body.
  • The existing overloads that take spacing are marked [Obsolete] and call the new ones without it. Callers keep compiling, get a CS0618 warning, and get the same results.
  • liblouis is always passed NULL for spacing, so nothing gets logged. The P/Invoke declarations are unchanged apart from their docs.
  • The obsolete overloads no longer throw when spacing's length doesn't match the input, since the value is never used.
  • Removed PrepareSpacingBuffer, ExtractOutputSpacing and TranslatedString.OutputSpacing from Marshal spacing as the output buffer it is #19. OutputSpacing never shipped in a release (no tags or packages exist) and would always be null now.
  • SpacingTests now covers the new behaviour:
    • Each obsolete overload returns the same output and positions as its replacement.
    • A spacing of the wrong length is accepted.
    • liblouis logs no spacing warning, checked against a log message that is known to arrive.
  • All other tests use the new overloads.

Testing

  • 80/80 passing on net8.0 and net10.0 against the 3.39.0 natives and tables, with no compiler warnings.
  • I checked that the no-warning test can fail: passing a spacing buffer to lou_translateString makes it fail.

🤖 Generated with Claude Code

@henrikottesorensen
henrikottesorensen requested a review from a team October 9, 2026 13:52
liblouis 3.39.0 deprecated the spacing parameter of lou_translate,
lou_translateString, lou_backTranslate and lou_backTranslateString, and
in practice ignores it: each function now only logs "the spacing
parameter is deprecated and ignored; pass NULL" and never touches the
buffer. The release notes say deprecated, the source says ignored.

That broke Notalib#19 on 3.39.0. OutputSpacing was read back from a buffer
liblouis no longer writes, so it reported the caller's own request as
if it were liblouis's answer, and every call with a spacing argument
logged the warning. Two SpacingTests failed on main as a result.

C# cannot obsolete a single parameter, so each of the four public
methods gains an overload without spacing, which now holds the body,
and the existing overloads are marked [Obsolete] and forward to it,
dropping spacing. liblouis is always handed NULL, so nothing is logged.
The obsolete overloads no longer check the length of spacing either,
since there is nothing left for a mismatch to break.

The spacing buffer helpers and TranslatedString.OutputSpacing from Notalib#19
are removed. OutputSpacing never shipped in a release, and it could
only ever be null now.

SpacingTests is rewritten for the new contract: the obsolete overloads
give the same results as the new ones, and liblouis logs no spacing
warning. The rest of the tests move to the new overloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@henrikottesorensen henrikottesorensen changed the title api: Obsolete the spacing parameter of Translate and BackTranslate api: Obsolete spacing and stop passing it to liblouis Oct 9, 2026
@henrikottesorensen
henrikottesorensen merged commit 797fcf5 into Notalib:main Oct 9, 2026
7 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.

2 participants