- 新增 pproc_expand.h 头文件,定义宏展开相关的数据结构和函数接口 - 重命名宏相关类型和函数,将 scc_pp_* 前缀统一改为 scc_pproc_* - 修改宏参数解析逻辑,支持更灵活的参数处理方式 - 实现完整的宏展开功能,包括对象宏和函数宏的展开 - 添加字符串化操作符 (#) 的支持 - 改进预处理器主循环逻辑,优化宏展开流程 - 更新单元测试用例,增加对宏参数解析和字符串化的测试
27 lines
662 B
C
27 lines
662 B
C
#ifndef __SCC_PPROC_EXPAND_H__
|
|
#define __SCC_PPROC_EXPAND_H__
|
|
|
|
#include <pproc_macro.h>
|
|
#include <scc_core.h>
|
|
#include <scc_core_ring.h>
|
|
#include <scc_lexer.h>
|
|
|
|
typedef struct {
|
|
scc_pproc_macro_table_t *macro_table;
|
|
scc_lexer_tok_ring_t *input;
|
|
scc_lexer_tok_vec_t output;
|
|
scc_pproc_macro_table_t expanded_set;
|
|
int need_rescan;
|
|
} scc_pproc_expand_t;
|
|
|
|
static inline scc_lexer_tok_ring_t
|
|
scc_lexer_array_to_ring(scc_lexer_tok_vec_t *array) {
|
|
scc_lexer_tok_ring_t ret;
|
|
scc_ring_by_buffer(ret, array->data, array->size);
|
|
return ret;
|
|
}
|
|
|
|
void scc_pproc_expand_macro(scc_pproc_expand_t *expand_ctx);
|
|
|
|
#endif /* __SCC_PPROC_EXPAND_H__ */
|