Files
scc/libs/sstream/include/scc_sstream.h
zzy 88846d7479 refactor(log): 统一日志系统并添加链接器实现
- 为所有模块添加统一的 scc_*_log.h 日志头文件,删除旧的 lexer_log.h/c
- 将运行时日志从 scc_utils 迁移到 scc_core 目录,统一日志管理
- 在解析器表达式/语句/类型解析中添加 LOG_TRACE 调试日志
- 实现 SCCF 链接器 (sccf_linker) 支持多目标文件链接
- 重构 CLI 主程序 (main.c/config.c),新增 cmd_log.h 调试支持
- 优化 x86 指令编码操作数对齐检查
- 修复预处理器的指令处理和宏展开逻辑
2026-06-05 13:07:41 +08:00

36 lines
1.1 KiB
C

#ifndef __SCC_SSTREAM_H__
#define __SCC_SSTREAM_H__
#include <scc_log.h>
#include <scc_core.h>
#include <scc_core_ring.h>
#include <scc_pos.h>
typedef struct {
scc_pos_t pos;
int character;
} scc_sstream_char_t;
typedef SCC_RING(scc_sstream_char_t) scc_sstream_ring_t;
typedef struct {
const char *fname;
scc_pos_t pos; // 当前消费位置 (可选,可由 ring 推导)
int used; // 是否仍然在使用
int owned_src; // 是否拥有src内存 即是否需要释放
const char *src; // 文件内容缓冲区 (由 sstream 管理)
usize len; // 缓冲区长度
scc_pos_t fill_pos; // 内部填充位置
scc_sstream_ring_t ring;
} scc_sstream_t;
int scc_sstream_init(scc_sstream_t *stream, const char *fname, int ring_size);
int scc_sstream_init_by_buffer(scc_sstream_t *stream, const char *buffer,
usize len, int owned, int ring_size);
scc_sstream_ring_t *scc_sstream_to_ring(scc_sstream_t *stream);
void scc_sstream_drop_ring(scc_sstream_ring_t *ring);
void scc_sstream_drop(scc_sstream_t *stream);
#endif /* __SCC_SSTREAM_H__ */