-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kparser.h
57 lines (47 loc) · 789 Bytes
/
Kparser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef KPARSER_H
#define KPARSER_H
#include <stdbool.h>
enum ktype {
STRING,
INTEGER,
HEX_VALUE,
BOOL,
TRISTATE,
VARIABLE
};
struct kvalue {
enum ktype type;
union {
long number;
char *string;
} value;
};
struct krange {
struct kvalue lower;
struct kvalue upper;
};
struct kconfig {
enum ktype type;
struct kvalue value;
struct krange range;
bool not_flag;
};
struct kchoice {
char *default_config;
struct kconfig *config;
};
struct kvariable {
char *name;
char *help;
char *prompt;
struct kvalue default_value;
enum {
CONFIG,
CHOICE
} type;
union {
struct kconfig config;
struct kchoice choice;
} value;
};
#endif /* KPARSER_H */