2
0
Fork 0
lighttpd2/include/lighttpd/config_parser.h

57 lines
1.4 KiB
C
Raw Normal View History

2008-08-02 20:56:07 +00:00
#ifndef _LIGHTTPD_CONFIGPARSER_H_
#define _LIGHTTPD_CONFIGPARSER_H_
#include <lighttpd/base.h>
typedef struct liConfigParserContext liConfigParserContext;
2008-07-23 20:22:33 +00:00
2008-09-24 22:00:23 +00:00
typedef enum {
LI_CFG_PARSER_CAST_NONE,
LI_CFG_PARSER_CAST_INT,
LI_CFG_PARSER_CAST_STR
} liCastType;
2008-09-24 22:00:23 +00:00
struct liConfigParserContext {
2008-07-08 16:51:03 +00:00
/* ragel vars */
int cs;
int *stack;
int top;
2008-08-02 20:56:07 +00:00
int stacksize; /* not really used by ragel but need to remember it */
2008-07-08 16:51:03 +00:00
char *p, *pe, *eof;
gchar *mark;
2008-08-02 20:56:07 +00:00
gboolean in_setup_block;
gboolean condition_with_key;
gboolean condition_nonbool;
gboolean condition_negated;
2008-07-23 20:22:33 +00:00
liCompOperator op;
gchar value_op;
2008-07-08 16:51:03 +00:00
liCastType cast;
GHashTable *action_blocks; /* foo { } */
GHashTable *uservars; /* var.foo */
2008-08-02 20:56:07 +00:00
GQueue *action_list_stack; /* first entry is current action list */
GQueue *option_stack; /* stack of liValue* */
GQueue *condition_stack; /* stack of condition* */
2008-08-02 20:56:07 +00:00
/* information about currenty parsed file */
gchar *filename;
gchar *ptr; /* pointer to the data */
gsize len;
gsize line; /* holds current line */
2008-07-08 16:51:03 +00:00
};
2008-08-02 20:56:07 +00:00
/* returns a new config parser stack with the first context in it */
LI_API GList* li_config_parser_init(liServer *srv);
LI_API void li_config_parser_finish(liServer *srv, GList *ctx_stack, gboolean free_all);
/* loads a file into memory and parses it */
LI_API gboolean li_config_parser_file(liServer *srv, GList *ctx_stack, const gchar *path);
2008-08-02 20:56:07 +00:00
#endif