aboutsummaryrefslogtreecommitdiff
path: root/src/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/config.h b/src/config.h
index d76c515..024b6f6 100644
--- a/src/config.h
+++ b/src/config.h
@@ -4,7 +4,9 @@
#include <stdio.h>
#include <stdint.h>
-#include "block.h"
+#include "util.h"
+
+typedef struct block block_t;
typedef enum {
CONFIG_STRING,
@@ -13,24 +15,16 @@ typedef enum {
CONFIG_DOUBLE,
CONFIG_BOOL,
CONFIG_COLOR,
+ CONFIG_ENUM,
} config_type_t;
typedef struct {
const char *key;
config_type_t type;
+ void *data;
size_t offset;
} config_entry_t;
-typedef bool (*config_block_apply_t)(block_t *block, void *result);
-
-typedef struct {
- const char *type_name;
- size_t type_size;
- block_t base;
- const config_entry_t *entries;
- config_block_apply_t apply;
-} config_block_t;
-
typedef struct {
size_t n_blocks;
block_t *blocks;
@@ -42,6 +36,11 @@ typedef struct {
color_t background;
} config_t;
+typedef struct {
+ const char *label;
+ int value;
+} config_enum_t;
+
void config_init(config_t *config);
void config_read(config_t *config, FILE *file);