varch/README.md
2024-04-22 00:09:51 +08:00

175 lines
5.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# varch
![替代文字](/image/logo.png)
## 介绍
varchwe-architecture意为我们的框架库是嵌入式C语言常用代码模块库包含了嵌入式中常用的算法库、数据结构容器库、解析器库、独立C语言std库、工具库等等。
具有**简单、通用、高效**的特点,目的为了**学习**以及在开发中**拿来就用**,提高开发效率以及代码可靠稳定性。
## 内容
### 一级目录结构
```
> varch
|---> built // 编译相关的文件夹
|---> doc // varch模块介绍文档
|---> source // varch源码目录
|---> LICENSE // 开源许可 GPL3
'---> README.md // 本文件
```
### 二级目录source
```
> source
|---> general // 存放varch一般的代码
|---> application // 存放应用层的代码
|---> platform // 存放平台相关的代码
|---> template // 存放模板型代码,一般是相同模块不同实现形式的代码
|---> lib // 通用库代码
|---> tool // 工具库代码
'---> devices // 模拟设备代码
```
### 三级目录
#### general
```
> source/general
|---> calculate // 计算式模块,输入计算表达式得到计算结果
|---> command // 命令解析模块输入字符串命令类似shell命令执行相应命令函数
|---> vlog // 日志输出模块
|---> kern // 周期任务调度内核模块在varch测试中基本都是使用此周期任务
|---> vserdes // 虚拟串行解串器模块
|---> vcan // 虚拟CAN总线通信模块
|---> vuart // 虚拟uart串口通信模块
|---> vio // 虚拟IO口模块
'---> std_types.h // varch标准类型头文件
```
#### lib
```
> source/lib
|---> container // 数据结构容器库
|---> algorithm // 算法库
|---> vstd // std库
'---> parser // 解析器库
```
* container
```
> source/lib/container
|---> queue.c // 通用队列容器
|---> queue.h
|---> stack.c // 通用栈容器
|---> stack.h
|---> deque.c // 通用双端队列容器
|---> deque.h
|---> vector.c // 通用向量(数组)容器
|---> vector.h
|---> list.c // 通用链表容器
|---> list.h
|---> heap.c // 通用堆容器
|---> heap.h
|---> str.c // 字符串类
|---> str.h
|---> set.c // 通用集合容器
|---> set.h
|---> map.c // 通用映射容器
|---> map.h
|---> map_cfg.c // 映射容器的配置文件
|---> map_cfg.h
|---> tree.c // 通用树容器
|---> tree.h
'---> tree // 基于通用树实现的各种树结构
```
* algorithm
```
> source/lib/algorithm
|---> encrypt.c // 加解密算法DES、3DES
|---> encrypt.h
|---> checkcode.c // 校验算法求和校验、奇偶校验、异或校验、lrc校验、标准及通用crc校验
|---> checkcode.h
|---> hash.c // 哈希算法bkdr、ap、djb、js、rs、sdbm、pjw、elf、dek、bp、fnv、jdk6
|---> hash.h
|---> sort.c // 通用排序算法(各种数据结构),冒泡排序、选择排序、插入排序、希尔排序、快速排序、堆排序
'---> sort.h
```
* parser
```
> source/lib/parser
|---> ini.c // ini配置文件解析生成器
|---> ini.h
|---> json.c // json文件解析生成器
|---> json.h
|---> xml.c // xml文件解析生成器
|---> xml.h
|---> txls.c // 文本表格类markdown表格文件解析生成器
'---> txls.h
```
* vstd
```
> source/lib/vstd
|---> vstddef.h // <stddef.h>
|---> vmath.c
|---> vmath.h // <math.h>
|---> vstdlib.c
|---> vstdlib.h // <stdlib.h>
|---> vstring.c
|---> vstring.h // <string.h>
|---> vctype.c
'---> vctype.h // <ctype.h>
```
#### tool
```
> source/tool
|---> arg.h // 不定参数,获取不定参数个数和指定参数
|---> valloc.c
|---> valloc.h // 动态内存使用情况测试工具
|---> tool.c
'---> tool.h // 通用工具
```
#### platform
```
> source/platform
|---> bsp_io // 模拟IO物理层
|---> tstamp // 在linux平台获取的时间戳
|---> platform_types.h // 平台的基本数据类型
'---> init // 初始化导出模块
```
#### application
```
> source/application
|---> main.c // 主函数所在文件
|---> console // 控制台命令输入,与'command'模块搭配,在控制台输入命令进行解析
'---> test // 各个模块的测试代码
```
#### devices
```
> source/devices
|---> ecu // 仿真模拟ECU
|---> dtool // 仿真模拟DTOOL
'---> lidar // 仿真模拟LIDAR
```
## 使用说明
代码在linux环境下编写编译测试在`built`目录下的`makefile`配置需要编译的文件进行编译即可,也可以直接运行`run.sh`文件编译加运行。varch模块尽可能的保持独立为了减少对其他模块的依赖大部分的文件是可以直接单独拎出来就可以直接使用。如果编译存在对其他模块的依赖解决依赖问题只是数据类型依赖的问题完全可以参考定义所需类型即可。
## 开源协议
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
## 联系方式
Lamdonn@163.com