040b9be6b9
✨ feat(lib/CMakeLists.txt): 添加 LUI 库支持 ✨ feat(lib/utils/inc/argpase.h): 引入 "stdbool.h" 以支持布尔类型 ✨ feat(sim/display/sim_display.cpp): 重新引入 "graphics.h" 和 "conio.h" 以修复依赖 ✨ feat(sim/lvgl/lv_port_indev.cpp): 移除未使用的头文件 "graphics.h" 和 "easyx.h" ✨ feat(main.c): 添加 LUI 库支持以增强功能 ✨ feat(lib/lui/lame_ui.c): 新增 LUI 库实现以支持 UI 组件
47 lines
865 B
C
47 lines
865 B
C
#ifndef ARGPASE_H
|
|
#define ARGPASE_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#include "stdbool.h"
|
|
typedef char OptId;
|
|
|
|
typedef struct Option {
|
|
char *name;
|
|
OptId id;
|
|
} Option;
|
|
|
|
typedef struct OptList {
|
|
struct OptList *next;
|
|
Option *Option;
|
|
} OptList;
|
|
|
|
extern char *Optarg, *Optstr;
|
|
//索引指示,可手动重载为0
|
|
extern int Optindex;
|
|
|
|
//选项链表创建
|
|
OptList *Options_Creat(char *opt, OptId index);
|
|
|
|
//使用选项结构体创建
|
|
OptList *Options_CreatOpt(Option *opt);
|
|
|
|
//添加
|
|
void Options_Add(OptList *opts, OptList *opt);
|
|
|
|
//删除
|
|
bool Options_Del(OptList *opts, char *opt);
|
|
|
|
//打印选项和id
|
|
void Options_Print(OptList *opts);
|
|
|
|
//开始匹配参数
|
|
OptId Options_Load(OptList *opts, char *argv[], size_t argc);
|
|
|
|
//字符串转参数数组
|
|
size_t Str_To_Args(char *str, char *argv[]);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif //ARGPASE_H
|