- 重命名和重构了多个文件,包括 lexer、parser 和 AST 相关代码 - 添加了日志功能,使用 LOG_* 宏替代原有的 error 和 warn 函数 - 优化了错误处理和内存分配方式 - 调整了代码结构,提高了模块化和可读性
33 lines
673 B
C
33 lines
673 B
C
#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;
|
|
}
|