- 为所有模块添加统一的 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 指令编码操作数对齐检查 - 修复预处理器的指令处理和宏展开逻辑
36 lines
1.6 KiB
C
36 lines
1.6 KiB
C
#ifndef __SCC_POS_LOG_H__
|
|
#define __SCC_POS_LOG_H__
|
|
|
|
#include "scc_pos.h"
|
|
#include <scc_core.h>
|
|
|
|
int scc_log_handler(logger_t *module, log_level_t level, const char *file,
|
|
int line, int col, const char *fmt, ...);
|
|
typedef int (*scc_log_fn_t)(logger_t *module, log_level_t level,
|
|
const char *file, int line, int col,
|
|
const char *fmt, ...);
|
|
extern logger_t __scc_pos_log;
|
|
|
|
#define SCC_POS_LOG(logger, level, pos, fmt, ...) \
|
|
do { \
|
|
((scc_log_fn_t)(logger)->user_handler)( \
|
|
(logger), (level), scc_pos_pnt_val(pos), (fmt), ##__VA_ARGS__); \
|
|
} while (0)
|
|
|
|
#ifndef SCC_LOG_HANDLER
|
|
#define SCC_LOG_HANDLER &__scc_pos_log
|
|
#endif
|
|
|
|
#define SCC_DEBUG(pos, fmt, ...) \
|
|
SCC_POS_LOG(SCC_LOG_HANDLER, LOG_LEVEL_DEBUG, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_INFO(pos, fmt, ...) \
|
|
SCC_POS_LOG(SCC_LOG_HANDLER, LOG_LEVEL_INFO, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_WARN(pos, fmt, ...) \
|
|
SCC_POS_LOG(SCC_LOG_HANDLER, LOG_LEVEL_WARN, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_ERROR(pos, fmt, ...) \
|
|
SCC_POS_LOG(SCC_LOG_HANDLER, LOG_LEVEL_ERROR, pos, fmt, ##__VA_ARGS__)
|
|
#define SCC_FATAL(pos, fmt, ...) \
|
|
SCC_POS_LOG(SCC_LOG_HANDLER, LOG_LEVEL_FATAL, pos, fmt, ##__VA_ARGS__)
|
|
|
|
#endif /* __SCC_POS_LOG_H__ */
|