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
Branches
No related tags found
No related merge requests found
Pipeline #3585 passed
......@@ -30,9 +30,21 @@ struct config_option {
};
static struct config_option s_options[_EpicOptionCount] = {
[OptionExecuteElf] = { .name = "execute_elf",
.type = OptionType_Boolean,
.value = { .boolean = false } },
/* clang-format off */
#define INIT_Boolean(v) { .boolean = (v) }
#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)
......
#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 @@
#include <stdbool.h>
enum EpicConfigOption {
OptionExecuteElf,
#define CARD10_SETTING(identifier, spelling, type, default_value) Option ## identifier,
#include "modules/config.def"
_EpicOptionCount
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment