diff --git a/README.md b/README.md index 632a8bf4956e2601a1dfe1a18be7b962199290d7..85f9b04a72c9fe5741217f16ff9e5af96bcb1672 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,105 @@ -# FT (hybird markup language for C) +```markdown +# FT 项目 -# Usage: +## 简介 +FT 是一个用 C 语言开发的混合编程语言项目,旨在提供一个灵活且高效的开发框架。该项目支持多种功能,包括内存管理、数据结构操作、文件处理、任务调度等,适用于嵌入式系统和通用应用程序开发。 +## 主要特性 +- **内存管理**:提供内存分配、释放、复制等操作。 +- **数据结构**:支持链表、哈希集合、环形缓冲区、池式内存分配等。 +- **文件操作**:提供文件读写、格式化输出等功能。 +- **任务调度**:支持任务创建、调度和管理。 +- **跨平台支持**:可在不同操作系统上运行,包括 Windows、Unix 和 macOS。 -## Usage Config: -```bash -$ cp config.h ft_conf.h || cp config.h ft_conf.h -``` +## 安装 +1. 克隆仓库: + ```bash + git clone https://gitee.com/your-repo/ft.git + ``` +2. 进入项目目录: + ```bash + cd ft + ``` +3. 编译项目: + ```bash + make + ``` + +## 使用 +### 编译和运行 +- **编译项目**: + ```bash + ./ft -c your_file.ft + ``` +- **运行项目**: + ```bash + ./ft -r your_file.ft + ``` + +### 示例 +以下是一个简单的示例,展示如何使用 FT 编写一个程序: + +```c +int main(int argc, char *argv[]) { + printf(" ---FT:%s------ \n", FT_Ver); + + if (argc < 2) { + printf("Err:\n at least 2 arg!!!\n\n"); + _helpPrint(); + return 1; + } + + Bool isCompile = str_compare(argv[1], "-c"); + Bool isRuntime = str_compare(argv[1], "-r"); + if (!isCompile && !isRuntime) { + printf("Err:\n cmd not correct, only support -c|-r given:%s !!!\n\n", argv[1]); + _helpPrint(); + return 1; + } -## Usage Compile: -```bash -$ make -$ make build -$ make build.ft + FT_FilePath path = FT_FilePathP{argv[2]}; + Res res = ft_u_pathCreate(path); + if (!Res_isOk(res)) { + printf("path error:%s res:%d \n\n", argv[2], res); + return res; + } + + FT_Fml fml = ft_createConst(null, FT_FmlP{ + FT_FmlParam, + }); + + if (isCompile) _compiler(fml, path); + if (isRuntime) _runtime(fml, path); + + printf("\n\nResult::\n"); + ft_constPrint(fml); + printf("\n"); + + ft_dispose(fml, null); + ft_u_pathDispose(path); + return 0; +} ``` -## Usage Example: -```bash -$ ./demo_ft app +### 编译和运行示例 +1. 编写一个简单的 `.ft` 文件,例如 `example.ft`。 +2. 编译文件: + ```bash + ./ft -c example.ft + ``` +3. 运行文件: + ```bash + ./ft -r example.ft + ``` + +## 贡献 +欢迎贡献代码和文档。请遵循以下步骤: +1. Fork 仓库。 +2. 创建新分支。 +3. 提交更改。 +4. 发起 Pull Request。 + +## 许可证 +本项目采用 MIT 许可证。详情请查看 [LICENSE](LICENSE) 文件。 ``` \ No newline at end of file