#ifndef COMET_CONFIG_H #define COMET_CONFIG_H #include #include #include "util.h" typedef struct block block_t; typedef struct action action_t; typedef enum { CONFIG_STRING, CONFIG_INT, CONFIG_UINT, CONFIG_DOUBLE, CONFIG_BOOL, CONFIG_COLOR, CONFIG_GRADIENT, CONFIG_ENUM, CONFIG_TIME, CONFIG_LIST, } config_type_t; typedef struct { const char *key; config_type_t type; const void *data; 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; size_t n_actions; action_t *actions; bool override_redirect; bool action_strict_run; bool action_strict_set; bool action_failfast; bool wm_struts; char *wm_name; gradient_t background; char *font; char *monitor; unsigned int width; unsigned int height; unsigned int x_offset; unsigned int y_offset; double scale; } config_t; typedef struct { const char *label; int value; } config_enum_t; 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 *key, const char *value); int config_read(config_t *config, FILE *file); int config_validate(config_t *config); bool config_resolve_action(config_t *config, const char *label, action_t **action); bool config_resolve(config_t *config, block_t **block); void config_free(config_t *config); #endif