Skip to content
Snippets Groups Projects
Commit 70dc340b authored by swym's avatar swym
Browse files

card10.cfg: use X-macro idion for declaring settings

parent fe154963
No related branches found
No related tags found
1 merge request!215feat(epicardium): read card10.cfg
...@@ -30,9 +30,21 @@ struct config_option { ...@@ -30,9 +30,21 @@ struct config_option {
}; };
static struct config_option s_options[_EpicOptionCount] = { static struct config_option s_options[_EpicOptionCount] = {
[OptionExecuteElf] = { .name = "execute_elf", /* clang-format off */
.type = OptionType_Boolean, #define INIT_Boolean(v) { .boolean = (v) }
.value = { .boolean = false } }, #define INIT_Int(v) { .integer = (v) }
#define INIT_Float(v) { .floating_point = (v) }
#define INIT_String(v) { .string = (v) }
#define INIT_(tp, v) INIT_ ## tp (v)
#define INIT(tp, v) INIT_ (tp, v)
#define CARD10_SETTING(identifier, spelling, tp, default_value) \
[Option ## identifier] = { .name = (spelling), \
.type = OptionType_ ## tp, \
.value = INIT(tp, (default_value)) },
#include "modules/config.def"
/* clang-format on */
}; };
static struct config_option *findOption(const char *key) static struct config_option *findOption(const char *key)
......
#ifndef CARD10_SETTING
# define CARD10_SETTING(identifier, spelling, type, default_value)
#endif
CARD10_SETTING(ExecuteElf, "execute_elf", Boolean, false)
//CARD10_SETTING(Nick, "nick", String, "an0n")
//CARD10_SETTING(Timeout, "timeout", Integer, 123)
//CARD10_SETTING(Dampening, "dampening", Float, 420)
#undef CARD10_SETTING
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include <stdbool.h> #include <stdbool.h>
enum EpicConfigOption { enum EpicConfigOption {
OptionExecuteElf, #define CARD10_SETTING(identifier, spelling, type, default_value) Option ## identifier,
#include "modules/config.def"
_EpicOptionCount _EpicOptionCount
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment