diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-24 17:40:26 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-24 17:40:26 +0100 |
| commit | 76ad6b0d404d40f08b73d90ac5f66564c29feb95 (patch) | |
| tree | 59e2c0b0c5ecd0e092a295352f8b7fa0bc15db4e /src/config.h | |
| parent | 30020a08392c959505bd27388564f7436a04bace (diff) | |
Refactor config parser
Diffstat (limited to 'src/config.h')
| -rw-r--r-- | src/config.h | 21 |
1 files changed, 21 insertions, 0 deletions
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); |
