#ifndef __SCC_CORE_IMPL_H__ #define __SCC_CORE_IMPL_H__ #include "core_type.h" /* ====== 内存管理核心接口 ====== */ void *scc_malloc(usize size); void *scc_calloc(usize count, usize size); void *scc_realloc(void *ptr, usize new_size); void scc_free(void *ptr); /* ====== 文件系统核心接口 ====== */ /* 文件句柄 - 不透明指针 */ typedef struct scc_file *scc_file_t; /* 文件打开模式 - 只保留编译器真正需要的 */ typedef enum { SCC_FILE_READ, /* 读取源文件、头文件 */ SCC_FILE_WRITE, /* 写入目标文件、汇编文件 */ SCC_FILE_APPEND /* 日志、调试输出 */ } scc_fmode_t; /* 核心文件操作 */ scc_file_t scc_fopen(const char *path, scc_fmode_t mode); void scc_fclose(scc_file_t file); usize scc_fread(scc_file_t file, void *buffer, usize size); usize scc_fwrite(scc_file_t file, const void *buffer, usize size); cbool scc_fexists(const char *path); /* ====== 输入输出核心接口 ====== */ void scc_snprintf(char *buf, usize size, const char *format, ...); /* 标准输出 - 用于编译进度、结果 */ void scc_printf(const char *format, ...); /* 错误输出 - 用于错误信息、警告 */ void scc_eprintf(const char *format, ...); /* ====== 系统核心接口 ====== */ /* 程序控制 */ void scc_exit(int code); #endif /* __SCC_CORE_IMPL_H__ */