Last change
on this file since 1167 was 1162, checked in by rossy, 3 years ago |
Daodan: Add float-type config options
|
File size:
974 bytes
|
Rev | Line | |
---|
[838] | 1 | #ifndef DAODAN_CONFIG_H
|
---|
| 2 | #define DAODAN_CONFIG_H
|
---|
| 3 |
|
---|
| 4 | #include "stdint.h"
|
---|
| 5 |
|
---|
[994] | 6 | typedef void (*cmd_callback)();
|
---|
| 7 |
|
---|
[993] | 8 | typedef enum {
|
---|
[994] | 9 | C_CMD,
|
---|
[993] | 10 | C_BOOL,
|
---|
| 11 | C_INT,
|
---|
[1162] | 12 | C_FLOAT,
|
---|
[993] | 13 | C_STRING,
|
---|
| 14 | EXT_BOOL
|
---|
| 15 | } OptionType_t;
|
---|
[838] | 16 |
|
---|
[993] | 17 | typedef union {
|
---|
| 18 | int intBoolVal;
|
---|
[1162] | 19 | float floatVal;
|
---|
[993] | 20 | uint8_t* extBoolVal;
|
---|
| 21 | char* stringVal;
|
---|
[994] | 22 | cmd_callback callback;
|
---|
[993] | 23 | } OptionValue_t;
|
---|
[838] | 24 |
|
---|
[993] | 25 | typedef struct {
|
---|
| 26 | char* name;
|
---|
| 27 | char* description;
|
---|
| 28 | OptionType_t type;
|
---|
| 29 | OptionValue_t defaultValue;
|
---|
| 30 | OptionValue_t value;
|
---|
| 31 | } ConfigOption_t;
|
---|
[838] | 32 |
|
---|
[993] | 33 | typedef struct {
|
---|
| 34 | char* name;
|
---|
| 35 | char* description;
|
---|
[1000] | 36 | ConfigOption_t options[20];
|
---|
[993] | 37 | } ConfigSection_t;
|
---|
[838] | 38 |
|
---|
[993] | 39 |
|
---|
| 40 | void DDrConfig(int argc, char* argv[]);
|
---|
[1000] | 41 | void DDrConfig_WriteIni();
|
---|
[993] | 42 |
|
---|
| 43 | ConfigOption_t* DDrConfig_GetOptOfType(const char* fullOptName, OptionType_t type);
|
---|
| 44 | const char* DDrConfig_GetOptionTypeName(OptionType_t type);
|
---|
[1000] | 45 | const char* DDrConfig_GetOptionValueString(ConfigOption_t* opt, char printdefault);
|
---|
| 46 | char DDrConfig_NonDefaultOptionValue(ConfigOption_t* opt);
|
---|
[993] | 47 |
|
---|
[838] | 48 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.