refactor(pprocessor): rename macro table type and update function names
- Change `scc_macro_table_t` to `scc_pp_macro_table_t` for consistency - Rename `scc_pp_macro_create` to `scc_pp_macro_new` for naming convention - Remove unused `scc_pp_compress_whitespace` function - Update macro table function names: `scc_pp_find_macro` → `scc_pp_macro_table_get`, `scc_pp_remove_macro` → `scc_pp_macro_table_remove` - Add new `scc_pp_macro_table_set` function for setting macros - Update all function signatures to use new type name - Remove commented-out whitespace compression code from implementation
This commit is contained in:
@@ -22,7 +22,7 @@ typedef struct scc_macro {
|
||||
|
||||
typedef struct scc_macro_table {
|
||||
scc_hashtable_t table; // 宏定义表
|
||||
} scc_macro_table_t;
|
||||
} scc_pp_macro_table_t;
|
||||
|
||||
/**
|
||||
* @brief 创建宏对象
|
||||
@@ -30,8 +30,8 @@ typedef struct scc_macro_table {
|
||||
* @param type 宏类型
|
||||
* @return 创建的宏对象指针,失败返回NULL
|
||||
*/
|
||||
scc_pp_macro_t *scc_pp_macro_create(const scc_cstring_t *name,
|
||||
scc_pp_macro_type_t type);
|
||||
scc_pp_macro_t *scc_pp_macro_new(const scc_cstring_t *name,
|
||||
scc_pp_macro_type_t type);
|
||||
|
||||
/**
|
||||
* @brief 销毁宏对象
|
||||
@@ -39,13 +39,6 @@ scc_pp_macro_t *scc_pp_macro_create(const scc_cstring_t *name,
|
||||
*/
|
||||
void scc_pp_macro_drop(scc_pp_macro_t *macro);
|
||||
|
||||
/**
|
||||
* @brief 压缩空白字符
|
||||
* @param tokens token列表
|
||||
* @return 压缩后的字符串
|
||||
*/
|
||||
scc_cstring_t scc_pp_compress_whitespace(const scc_pp_macro_list_t *tokens);
|
||||
|
||||
/**
|
||||
* @brief 添加对象宏
|
||||
* @param pp 预处理器实例
|
||||
@@ -53,7 +46,8 @@ scc_cstring_t scc_pp_compress_whitespace(const scc_pp_macro_list_t *tokens);
|
||||
* @param replacement 替换文本列表
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
cbool scc_pp_add_object_macro(scc_macro_table_t *pp, const scc_cstring_t *name,
|
||||
cbool scc_pp_add_object_macro(scc_pp_macro_table_t *pp,
|
||||
const scc_cstring_t *name,
|
||||
const scc_pp_macro_list_t *replacement);
|
||||
|
||||
/**
|
||||
@@ -64,10 +58,19 @@ cbool scc_pp_add_object_macro(scc_macro_table_t *pp, const scc_cstring_t *name,
|
||||
* @param replacement 替换文本列表
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
cbool scc_pp_add_function_macro(scc_macro_table_t *pp,
|
||||
cbool scc_pp_add_function_macro(scc_pp_macro_table_t *pp,
|
||||
const scc_cstring_t *name,
|
||||
const scc_pp_macro_list_t *params,
|
||||
const scc_pp_macro_list_t *replacement);
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param pp
|
||||
* @param macro
|
||||
* @return scc_pp_macro_t*
|
||||
*/
|
||||
scc_pp_macro_t *scc_pp_macro_table_set(scc_pp_macro_table_t *pp,
|
||||
scc_pp_macro_t *macro);
|
||||
|
||||
/**
|
||||
* @brief 查找宏定义
|
||||
@@ -75,7 +78,8 @@ cbool scc_pp_add_function_macro(scc_macro_table_t *pp,
|
||||
* @param name 宏名称
|
||||
* @return 找到的宏对象指针,未找到返回NULL
|
||||
*/
|
||||
scc_pp_macro_t *scc_pp_find_macro(scc_macro_table_t *pp, scc_cstring_t *name);
|
||||
scc_pp_macro_t *scc_pp_macro_table_get(scc_pp_macro_table_t *pp,
|
||||
scc_cstring_t *name);
|
||||
|
||||
/**
|
||||
* @brief 从预处理器中删除宏
|
||||
@@ -83,8 +87,9 @@ scc_pp_macro_t *scc_pp_find_macro(scc_macro_table_t *pp, scc_cstring_t *name);
|
||||
* @param name 宏名称
|
||||
* @return 成功删除返回true,未找到返回false
|
||||
*/
|
||||
cbool scc_pp_remove_macro(scc_macro_table_t *pp, const scc_cstring_t *name);
|
||||
cbool scc_pp_macro_table_remove(scc_pp_macro_table_t *pp,
|
||||
const scc_cstring_t *name);
|
||||
|
||||
void scc_pp_marco_table_init(scc_macro_table_t *macros);
|
||||
void scc_pp_macro_table_drop(scc_macro_table_t *macros);
|
||||
void scc_pp_marco_table_init(scc_pp_macro_table_t *macros);
|
||||
void scc_pp_macro_table_drop(scc_pp_macro_table_t *macros);
|
||||
#endif /* __SCC_PP_MACRO_H__ */
|
||||
|
||||
Reference in New Issue
Block a user