Repository navigation
Conversation
… の操作を 1 つにする TcsHost の 15 個を、file の 6 個 (Api/TcsFiles.cs: 読む、配る file を読む、同じ file か、変更の印、text と byte 列を置き換えて書く) と、CLI が process に求める 4 個 (Cli/CliProcess.cs: 標準出力、標準エラー、flush、待つ) に分ける。 引数と終了 code は入口で受け渡す。program は引数を Cli.Arg に 1 つずつ渡し、Cli.Step が終了 code を返すまで呼ぶ。Arg、ArgCount、SetExitCode、SetDone は無くなる。 C の file の操作を Native/files.c に出す。文字列の型に依らず、C の文字列と byte 数で受け渡す。tcs c が作る module の文字列との橋渡しは Native/files_tcs.c に置き、CLI の program (Native/main.c) と lider の player (vm_tcs.c) が同じ 2 つを使う。 src/tcs/native.sh は、C と .NET の file の実装が同じ振る舞いをすることを比べる。 Tool/ を Cli/ に改名する。 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEQcu1nJxjeAsG7A2n4QN3
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEQcu1nJxjeAsG7A2n4QN3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
tcs が外とやり取りする口は
TcsHostの 15 個で、file の操作、CLI の都合 (引数、標準出力、終了 code、sleep)、lider の session の返事が混ざっていた。そのため、tcs を動かす側は 15 個を全部書き直していた。
Native/host.c、Dotnet/DotnetHost.cs、lider のvm_tcs.c)。C の 2 つは同じ OS の上の写しなのに振る舞いが違った。lider の方は、byte order mark を落とさず、Windows で同じ file かを path の文字列で比べ、置き換えて書くときに権限を保たず、失敗の理由に OS の誤りを入れなかった。host.cはmainと生成した C の include を含む 1 つの program で、file の操作だけを使うことができなかった。Arg、ArgCount) で引き取り、終了は外部関数 (SetExitCode、SetDone) で知らせていた。lider はArgを session への頼みの通り道に使っていた。変更
TcsHostを無くし、2 つの宣言に分ける。Api/TcsFiles.cs(tcs が file について求めるもの)Read、Shipped、SameFile、Stamp、WriteText、WriteBytesNative/files.cとNative/files_tcs.c、.NET はDotnet/Files.csCli/CliProcess.cs(CLI が process に求めるもの)Out、Err、Flush、SleepNative/main.c、.NET はDotnet/Process.csNative/files.c: OS の file の操作。C の文字列と byte 数で受け渡し、文字列の型に依らない。Native/files_tcs.c:tcs cが作る module の文字列 (TcsString) との橋渡し。Native/main.c(今までのhost.c): CLI の program。引数をCli.Argに 1 つずつ渡し、Cli.Stepが終了 code を返すまで呼ぶ。lub-gen も同じ program を使う。vm_tcs.cは、file の操作を写さずfiles_tcs.cを使う。残るのは、埋め込んだ配る file、session の返事の buffer、VM の関数の登録だけになる。ReadとShippedは、無いときに null を返す。FileExistsとReadFileの 2 回に分けていた読み方が 1 回になる。Sessions(lider の session の入口) は、頼みの語をSessions.Argで受け取る。返事をCliProcess.Outで受け取る約束は今のままにしている。Tool/をCli/に改名する。src/tcs/sources.shから取る。検査
src/tcs/native.shに、C と .NET の file の実装を比べる検査を足した。同じ file の一式の上で同じ command を走らせ、出力、終了 code、残る file を比べる。見るのは、byte order mark のある入力、無い入力、directory を入力に渡したとき、出力が入力と同じ file のとき (link 越しも)、出力先の directory が無いとき、一時 file が残らないこと、置き換えで権限が保たれること、書けない出力 (終了 code と、file がそのまま残ること)。tests/tcs/run-tests.shが通る。scripts/build-lub-gen.sh --verifyとscripts/verify-tcs-binding.shが通る。vm_tcs.cは、手元では共有 library として compile と link ができることだけを見た。player の上の動作は CI で見る。cが +0.01%、vmが +0.45%。命令数は CI で見る。やらなかったこと
SameFileを残し、判定は CLI (Cli.InputClash) の 1 か所のままにした。tcs vm --watchを消すこと (StampとSleepはそれまで残る)。tcs vm --watch をやめ、lub の hot reload を組み込みの tcs の session にする #592 で行う。Closes #670.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEQcu1nJxjeAsG7A2n4QN3