Skip to content

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

Open
MoonL79 wants to merge 1 commit intomainfrom
gatsby/200_26/migrate_scheme_file
Open

[200_26] 将 (scheme file) 相关代码从 s7.c 迁移到 s7_scheme_file.c#497
MoonL79 wants to merge 1 commit intomainfrom
gatsby/200_26/migrate_scheme_file

Conversation

@MoonL79
Copy link
Contributor

@MoonL79 MoonL79 commented Mar 5, 2026

任务目标

完成 Issue #457:将 (scheme file) 相关代码从 s7.c 迁移到独立的 s7_scheme_file.c

改动内容

新增文件

  • src/s7_scheme_file.h - file 相关函数声明
  • src/s7_scheme_file.c - g_delete_file, g_access, g_file_mtime, g_unlink 实现
  • devel/200_26.md - 任务文档

修改文件

  • src/s7.c - 移除旧实现,添加 #include "s7_scheme_file.h"
  • xmake.lua - 添加 src/s7_scheme_file.c 编译

移除的代码

  • file_probe 函数(未使用)
  • g_delete_file 函数(迁移到新文件)
  • g_file_mtime 函数(迁移到新文件)
  • g_unlink 函数(迁移到新文件)
  • g_access 函数(迁移到新文件)

验证结果

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

关联 Issue

Closes #457

#include <errno.h>

/* -------------------------------- delete-file -------------------------------- */
s7_pointer g_delete_file(s7_scheme *sc, s7_pointer args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个接口需要移除,因为 goldfish.hpp 里面重新实现了

s7内置的实现无法处理中文文件名(在Windows上面)

- 创建 s7_scheme_file.h 和 s7_scheme_file.c
- 迁移 g_access, g_file_mtime, g_unlink 函数
- 完全移除 g_delete_file(已在 goldfish.hpp 中重新实现)
- 移除 s7.c 中的 delete_file_symbol 和相关注册
- 清理未使用的 file_probe 函数
- 更新 xmake.lua 添加新文件编译

测试通过: 28 correct, 0 failed

Co-Authored-By: Xiao Liyu
@MoonL79 MoonL79 force-pushed the gatsby/200_26/migrate_scheme_file branch from 6d4c2e2 to 2606f69 Compare March 5, 2026 03:15
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.

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

2 participants