/* * Copyright © 2005 William Pitcock, et al. * Rights to this code are as documented in doc/pod/license.pod. * * Data structures for flags to bitmask processing routines. * * $Id: confparse.h,v 1.3 2007/08/28 17:08:06 pippijn Exp $ */ #ifndef CONFPARSE_H #define CONFPARSE_H #include struct config_file_t : zero_initialised { char *cf_filename; config_entry_t *cf_entries; config_file_t *cf_next; }; struct config_entry_t : zero_initialised { config_file_t *ce_fileptr; int ce_varlinenum; char *ce_varname; char *ce_vardata; int ce_vardatanum; int ce_fileposstart; int ce_fileposend; int ce_sectlinenum; config_entry_t *ce_entries; config_entry_t *ce_prevlevel; config_entry_t *ce_next; }; struct Token { char const * const text; int const value; }; class ConfTable : public zero_initialised { struct callbacks { functor::callback0<> ready; }; public: char const * const name; int const rehashable; int (*handler) (config_entry_t *); char *str_val; int *int_val; static callbacks callback; ConfTable (char const * const blockname, int const can_rehash, int (*handlerfunc) (config_entry_t *)) : name (blockname), rehashable (can_rehash), handler (handlerfunc) { } }; extern void init_newconf (void); extern struct ConfTable *find_top_conf (char const * const name); extern struct ConfTable *find_conf_item (char const * const name, list_t *conflist); extern void add_top_conf (char const * const name, int (*handler) (config_entry_t *ce)); extern void add_conf_item (char const * const name, list_t *conflist, int (*handler) (config_entry_t *ce)); extern void del_top_conf (char const * const name); extern void del_conf_item (char const * const name, list_t *conflist); extern int subblock_handler (config_entry_t *ce, list_t *entries); #endif