From 76ad6b0d404d40f08b73d90ac5f66564c29feb95 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 24 Nov 2024 17:40:26 +0100 Subject: Refactor config parser --- src/config.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/config.h') diff --git a/src/config.h b/src/config.h index e005dff..e56de55 100644 --- a/src/config.h +++ b/src/config.h @@ -30,6 +30,12 @@ typedef struct { size_t offset; } config_entry_t; +typedef enum { + CONFIG_SUCCESS, + CONFIG_INVALID, + CONFIG_UNKNOWN, +} config_status_t; + typedef struct { size_t n_blocks; block_t **blocks; @@ -49,8 +55,23 @@ typedef struct { int value; } config_enum_t; +extern config_enum_t text_align_enum[]; + +extern const config_entry_t bar_entries[]; + +extern const config_entry_t block_entries[]; + +extern const config_entry_t block_group_entries[]; + +extern const config_entry_t block_text_entries[]; + +const char *config_type_to_string(config_type_t type); + void config_init(config_t *config); +config_status_t config_read_entry(const config_entry_t *entries, void *result, size_t *index, + const char *section, const char *label, const char *key, const char *value); + int config_read(config_t *config, FILE *file); int config_validate(config_t *config); -- cgit v1.2.3