You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

#include "condition.h"
struct config_parser_context_t;
typedef struct config_parser_context_t config_parser_context_t;
15 years ago
struct config_parser_data_t;
typedef struct config_parser_data_t config_parser_data_t;
struct config_parser_filestack_entry_t;
typedef struct config_parser_filestack_entry_t config_parser_filestack_entry_t;
/* initializes the config parser */
config_parser_context_t *config_parser_init();
15 years ago
/* loads a file into memory and parses it */
gboolean config_parser_file(server *srv, config_parser_context_t *ctx, const gchar *path);
15 years ago
/* launched a command through the shell and parses the stdout it returns */
gboolean config_parser_shell(server *srv, config_parser_context_t *ctx, const gchar *command);
15 years ago
/* parses a buffer pointed to by the previously allocated config_parser_data struct */
gboolean config_parser_buffer(server *srv, config_parser_context_t *ctx);
15 years ago
config_parser_data_t *config_parser_data_new();
void config_parser_data_free(config_parser_data_t *cpd);
struct config_parser_context_t {
GList *action_list_stack;
GList *stack;
15 years ago
struct config_parser_data_t {
/* information of currently parsed file */
gchar *filename;
gchar *ptr;
gsize len;
gsize line;
int stacksize;
/* ragel vars */
int cs;
int *stack;
int top;
char *p, *pe, *eof;
/* markers to start of current data */
gchar *mark;
gchar *mark_var;
/* action list stack */
GList *action_list_stack;
15 years ago
/* current value */
enum { CONFP_BOOL, CONFP_INT, CONFP_STR, CONFP_LIST, CONFP_HASH } val_type, val_type_last;
15 years ago
GString *val_str;
15 years ago
gint64 val_int;
15 years ago
gboolean val_bool;
GArray *val_list;
GHashTable *val_hash;
option *opt;
15 years ago
/* operator */
comp_operator_t operator;
15 years ago
/* name of current variable */
GString *varname;