35 lines
1.3 KiB
C
35 lines
1.3 KiB
C
#ifndef CONFIG_TOOLS_H_
|
|
#define CONFIG_TOOLS_H_
|
|
|
|
#include "data.h"
|
|
#include "parser.h"
|
|
#include <stdio.h>
|
|
|
|
config_t *config_create(void);
|
|
void free_node(node_t *node);
|
|
void config_destroy(config_t *config);
|
|
int handle_map_key(config_t *config, node_t **args, int arg_count);
|
|
int handle_define(config_t *config, node_t **args, int arg_count);
|
|
int execute_function_call(config_t *config, node_t *call);
|
|
int config_parse_string(config_t *config, const char *input);
|
|
int config_parse_file(config_t *config, const char *filename);
|
|
|
|
const char *config_get_key_mapping(config_t *config, const char *key_combo);
|
|
node_t *find_variable(config_t *config, const char *name);
|
|
|
|
const char *config_get_string(config_t *config, const char *path,
|
|
const char *default_value);
|
|
int config_get_int(config_t *config, const char *path, int default_value);
|
|
double config_get_double(config_t *config, const char *path,
|
|
double default_value);
|
|
bool config_get_bool(config_t *config, const char *path, bool default_value);
|
|
void config_print_all(config_t *config);
|
|
|
|
static struct {
|
|
const char *name;
|
|
int (*handler)(config_t *config, node_t **args, int arg_count);
|
|
} builtin_functions[] = {
|
|
{"map-key", handle_map_key}, {"define", handle_define}, {NULL, NULL}};
|
|
|
|
#endif
|