48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
#ifndef __SMCC_CORE_IMPL_H__
|
|
#define __SMCC_CORE_IMPL_H__
|
|
|
|
#include "core_type.h"
|
|
|
|
/* ====== 内存管理核心接口 ====== */
|
|
|
|
void* smcc_malloc(usize size);
|
|
void* smcc_calloc(usize count, usize size);
|
|
void* smcc_realloc(void *ptr, usize new_size);
|
|
void smcc_free(void *ptr);
|
|
|
|
/* ====== 文件系统核心接口 ====== */
|
|
|
|
/* 文件句柄 - 不透明指针 */
|
|
typedef struct smcc_file* smcc_file_t;
|
|
|
|
/* 文件打开模式 - 只保留编译器真正需要的 */
|
|
typedef enum {
|
|
SMCC_FILE_READ, /* 读取源文件、头文件 */
|
|
SMCC_FILE_WRITE, /* 写入目标文件、汇编文件 */
|
|
SMCC_FILE_APPEND /* 日志、调试输出 */
|
|
} smcc_file_mode_t;
|
|
|
|
/* 核心文件操作 */
|
|
smcc_file_t smcc_fopen(const char *path, smcc_file_mode_t mode);
|
|
void smcc_fclose(smcc_file_t file);
|
|
usize smcc_fread(smcc_file_t file, void *buffer, usize size);
|
|
usize smcc_fwrite(smcc_file_t file, const void *buffer, usize size);
|
|
cbool smcc_fexists(const char *path);
|
|
|
|
/* ====== 输入输出核心接口 ====== */
|
|
|
|
void smcc_snprintf(char *buf, usize size, const char *format, ...);
|
|
|
|
/* 标准输出 - 用于编译进度、结果 */
|
|
void smcc_printf(const char *format, ...);
|
|
|
|
/* 错误输出 - 用于错误信息、警告 */
|
|
void smcc_eprintf(const char *format, ...);
|
|
|
|
/* ====== 系统核心接口 ====== */
|
|
|
|
/* 程序控制 */
|
|
void smcc_exit(int code);
|
|
|
|
#endif // __SMCC_CORE_IMPL_H__
|