refactor: 重构前端代码并添加日志功能
- 重命名和重构了多个文件,包括 lexer、parser 和 AST 相关代码 - 添加了日志功能,使用 LOG_* 宏替代原有的 error 和 warn 函数 - 优化了错误处理和内存分配方式 - 调整了代码结构,提高了模块化和可读性
This commit is contained in:
32
lib/rt/std/rt_std.c
Normal file
32
lib/rt/std/rt_std.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "rt_api_def.h"
|
||||
|
||||
const smcc_rt_t rt = {
|
||||
._malloc = (rt_malloc)malloc,
|
||||
._free = (rt_free)free,
|
||||
.exit = (rt_exit)exit,
|
||||
|
||||
.fopen = (rt_fopen_t)fopen,
|
||||
.fflush = (rt_fflush_t)fflush,
|
||||
.fclose = (rt_fclose_t)fclose,
|
||||
.freads = (rt_freads_t)fread_s,
|
||||
.fwrite = (rt_fwrite_t)fwrite,
|
||||
|
||||
._realloc = (rt_realloc_t)realloc,
|
||||
.fprintf = (rt_fprintf_t)fprintf,
|
||||
.snprintf = (rt_snprintf_t)snprintf,
|
||||
};
|
||||
|
||||
rt_file_t rt_stdin;
|
||||
rt_file_t rt_stdout;
|
||||
rt_file_t rt_stderr;
|
||||
|
||||
void init_rt_std() {
|
||||
rt_stdin = stdin;
|
||||
rt_stdout = stdout;
|
||||
rt_stderr = stderr;
|
||||
}
|
||||
Reference in New Issue
Block a user