Skip to content

Foundation: 文字コード変換 libcode を追加 - #161

Merged
src3453 merged 1 commit into
mainfrom
claude/project-thread-c8i7h7
Oct 24, 2026
Merged

src3453 merged 1 commit into
mainfrom
claude/project-thread-c8i7h7

Conversation

@src3453

@src3453 src3453 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Requested by src3453 · project thread

Closes #160

概要

/lib/code.1.wal(libcode、image ID code 1.0)を追加。UTF-8(BOM あり/なし)、UTF-16LE/BE、UTF-32LE/BE の相互変換を、UTF-32BE を基準にした cpt_code_<enc>_to_utf32be / cpt_code_utf32be_to_<enc> で提供します。他の符号化どうしは UTF-32BE を経由します。

  • 戻り値・*dst_size は conde と同じ。不正入力は既定で CONDE_DATA/CONDE_INPUT_EOF、CODE_REPLACE で U+FFFD(maximal subpart)。
  • BOM: utf8bom は出力で必ず付与・入力で読み飛ばし。他は CODE_ADD_BOM/CODE_STRIP_BOM。cpt_code_detect で BOM から判別。
  • cpt_code_bound で出力サイズの上限を見積もり。
  • boot/build.py で既定ディスクに配置。README と memory/ を更新。

検証

  • CLANG=clang-20 python3 -m unittest foundation.tests.code.test_code(ホスト: Python codecs と照合、Foundation 上: -O1/-O2 × scalar/pipeline)通過
  • python foundation/run.py --build-only で /lib/code.1.wal が入ることを確認(tests/disk 自体は未実行)

Generated by Claude Code

UTF-32BE を基準に、UTF-8(BOM あり/なし)、UTF-16LE/BE、UTF-32LE との
cpt_code_<enc>_to_utf32be / cpt_code_utf32be_to_<enc> を /lib/code.1.wal として提供する。

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFAstnZtE3BzBcmKEHnjaW
@src3453 src3453 added this to the Foundation OS milestone Oct 24, 2026 — with Claude
@src3453 src3453 self-assigned this Oct 24, 2026
@src3453
src3453 merged commit ba7a485 into main Oct 24, 2026
10 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.

Foundation に文字コード変換ライブラリ libcode を追加する

2 participants