Skip to content

Expose the rest of the macOS-used API through the C ABI - #31

Merged
bubio merged 1 commit into
mainfrom
feat/capi-macos-parity
Oct 12, 2026
Merged

bubio merged 1 commit into
mainfrom
feat/capi-macos-parity

Conversation

@bubio

@bubio bubio commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • macOS 版が使っているのに C ABI に無かったコア機能を b88_* として42関数追加(既存関数のシグネチャ・挙動は不変)
    • 設定の読み出し(DIP SW1/2、メモリウェイト、CPU 倍速、OPN 強制)
    • イマーシブ音声のステム取り出し
    • マウス、全キー解放、画面テキストのコピー、フォントグリフ
    • テープ(マウント・取り出し・巻き戻し・状態)
    • ディスクの書き込み禁止確認・名前・書き戻し(onDiskWritten はコールバックの代わりにポーリング)
    • セーブステート(サムネイル・ホストセクション付き保存、日時・セクション読み出し)
    • .pat の解析、.n80 メモリイメージ
    • テキスト貼り付け/テープ自動起動/N80 自動ロードのシーケンサ
  • 新しい関数は CApiMachine.swift / CApiMedia.swift / CApiTyping.swift に分けたため、CI の DLL エクスポート確認が Sources/CApi/*.swift 全体を見るよう修正
  • デバッガ(@_spi(Debug))とタイムラインスクリプトは対象外

Test plan

  • swift test(1013件すべて通過、C ABI を直接呼ぶテスト11件を追加)
  • macOS でビルドしたライブラリのエクスポート80個と @_cdecl 80個が一致
  • scripts/check-api.sh:公開 API の互換破壊なし
  • フォーマット・lint

🤖 Generated with Claude Code

The Windows shell only reaches the core through b88_* functions, and a
good part of what the macOS app uses had none: settings read-back,
immersive audio stems, mouse, screen text and glyphs, the cassette,
disk write-back, save states with thumbnail and host sections, .pat
parsing, the .n80 memory image, and the Paste Text / Tape Auto Boot /
memory-image sequencers. Add 42 functions for them. Existing functions
keep their signatures and behaviour.

Disk writes reach macOS through PC88.onDiskWritten; a C host cannot take
a callback, so the context records them and b88_take_disk_written polls,
as the FDD sound events already do.

The new functions live in CApiMachine, CApiMedia and CApiTyping, so the
CI export check now reads every file under Sources/CApi. The debugger
(@_spi(Debug)) and timeline scripts are left out on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bubio
bubio merged commit 2b77fb8 into main Oct 12, 2026
3 checks passed
@bubio
bubio deleted the feat/capi-macos-parity branch October 12, 2026 09:21
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