Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 1.68 KB

File metadata and controls

51 lines (43 loc) · 1.68 KB

[200_26] 将 (scheme file) 相关代码从 s7.c 迁移到 s7_scheme_file.c

任务目标

根据 Issue #457,完成以下任务:

  1. 移除 s7.c 中 delete-file 的实现(已经通过 tbox 重新实现了)
  2. file-exists? 在 s7.c 中的相关函数已经移除,可能需要清理一下 s7.c
  3. 剩余函数的迁移
  4. tests/goldfish/scheme/file-test.scm 的测试用例补充和文档补充

任务相关的代码文件

  • src/s7.c
  • src/s7_scheme_file.c (新建)
  • src/s7_scheme_file.h (新建)
  • xmake.lua
  • goldfish/scheme/file.scm
  • tests/goldfish/scheme/file-test.scm
  • devel/200_26.md

如何测试

xmake b goldfish
bin/goldfish -m r7rs tests/goldfish/scheme/file-test.scm

执行记录

2026/03/05 任务开始

  • 创建分支: gatsby/200_26/migrate_scheme_file
  • 分析 s7.c 中的 file 相关代码
  • 发现 delete-file 实现在 s7.c 第 35373 行
  • file-exists? 的实现可能已被移除,但 file_probe 函数仍存在

2026/03/05 代码迁移

  • 创建 src/s7_scheme_file.h - 导出 g_delete_file, g_access, g_file_mtime, g_unlink
  • 创建 src/s7_scheme_file.c - 实现上述函数(使用 s7 公共 API)
  • 修改 src/s7.c:
    • 添加 #include "s7_scheme_file.h"
    • 移除 file_probe 函数(未使用)
    • 移除 g_delete_file 函数
    • 移除 g_file_mtime 函数
    • 移除 g_unlink 函数
    • 移除 g_access 函数
  • 修改 xmake.lua - 添加 src/s7_scheme_file.c 编译

2026/03/05 验证

  • ✅ 编译成功: xmake b goldfish
  • ✅ 测试通过: bin/goldfish -m r7rs tests/goldfish/scheme/file-test.scm (28 correct, 0 failed)

待办

  • 补充 file-test.scm 的测试用例和文档
  • Git 提交并推送到 GitHub