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 指令编码操作数对齐检查 - 修复预处理器的指令处理和宏展开逻辑
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#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>
|
||||
#include <scc_pos_log.h>
|
||||
|
||||
typedef struct {
|
||||
scc_pos_t pos;
|
||||
|
||||
26
libs/sstream/include/scc_sstream_log.h
Normal file
26
libs/sstream/include/scc_sstream_log.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __SCC_SSTREAM_LOG_H__
|
||||
#define __SCC_SSTREAM_LOG_H__
|
||||
|
||||
typedef struct logger logger_t;
|
||||
extern logger_t __scc_sstream_log;
|
||||
extern logger_t __scc_sstream_user;
|
||||
|
||||
#define SCC_LOG_HANDLER &__scc_sstream_user
|
||||
#define LOG_DEFAULT_HANDLER &__scc_sstream_log
|
||||
#include <scc_log.h>
|
||||
|
||||
#ifdef __SCC_SSTREAM_LOG_IMPL__
|
||||
logger_t __scc_sstream_log = {
|
||||
.name = "sstream",
|
||||
.level = LOG_LEVEL_ALL,
|
||||
.handler = log_default_handler,
|
||||
};
|
||||
|
||||
logger_t __scc_sstream_user = {
|
||||
.name = "sstream",
|
||||
.level = LOG_LEVEL_ALL,
|
||||
.user_handler = scc_log_handler,
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* __SCC_SSTREAM_LOG_H__ */
|
||||
@@ -1,3 +1,6 @@
|
||||
#define __SCC_SSTREAM_LOG_IMPL__
|
||||
#include <scc_sstream_log.h>
|
||||
|
||||
#include <scc_sstream.h>
|
||||
|
||||
// 内部扫描函数:从指定位置扫描下一个有效字符
|
||||
@@ -91,7 +94,7 @@ int scc_sstream_init(scc_sstream_t *stream, const char *fname, int ring_size) {
|
||||
if (fsize == 0) {
|
||||
stream->fill_pos = scc_pos_create();
|
||||
stream->fill_pos.name = fname;
|
||||
SCC_WARN(stream->fill_pos, "file size is 0");
|
||||
LOG_WARN("file size is 0");
|
||||
scc_sstream_init_by_buffer(stream, "", 0, false, ring_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user