1 /* This code is in the public domain. 2 * $Nightmare: nightmare/include/config.h,v 1.32.2.2.2.2 2002/07/02 03:41:28 ejb Exp $ 3 * $Id: newconf.h 26094 2008-09-19 15:33:46Z androsyn $ 4 */ 5 6 #ifndef _NEWCONF_H_INCLUDED 7 #define _NEWCONF_H_INCLUDED 8 9 extern FILE *conf_fbfile_in; 10 11 #define CF_QSTRING 0x01 12 #define CF_INT 0x02 13 #define CF_STRING 0x03 14 #define CF_TIME 0x04 15 #define CF_YESNO 0x05 16 #define CF_LIST 0x06 17 #define CF_ONE 0x07 18 19 #define CF_MTYPE 0xFF 20 21 #define CF_FLIST 0x1000 22 #define CF_MFLAG 0xFF00 23 24 25 26 typedef struct conf_parm_t_stru 27 { 28 struct conf_parm_t_stru *next; 29 int type; 30 union 31 { 32 char *string; 33 int number; 34 struct conf_parm_t_stru *list; 35 } 36 v; 37 } 38 conf_parm_t; 39 40 struct _confentry; 41 42 extern int lineno; 43 extern char linebuf[]; 44 45 extern int yyparse(void); 46 47 48 typedef struct _confentry 49 { 50 rb_dlink_node node; 51 char *entryname; 52 long number; 53 char *string; 54 rb_dlink_list flist; 55 unsigned int line; 56 char *filename; 57 int type; 58 } confentry_t; 59 60 typedef struct _conf 61 { 62 rb_dlink_node node; 63 char *confname; 64 char *subname; 65 rb_dlink_list entries; 66 char *filename; 67 unsigned int line; 68 } conf_t; 69 70 struct conf_items; 71 72 typedef void CONF_CB(confentry_t *, conf_t *, struct conf_items *); 73 74 struct conf_items 75 { 76 const char *c_name; 77 int type; 78 CONF_CB *cb_func; 79 int len; 80 void *data; 81 }; 82 83 84 85 /* parser/lexer support functions */ 86 int conf_yy_fatal_error(const char *msg); 87 void conf_yy_report_error(const char *msg); 88 void conf_report_warning(const char *format, ...); 89 90 void yyerror(const char *msg); 91 int conf_fgets(char *, int, FILE *); 92 93 94 void delete_all_conf(void); 95 int check_valid_blocks(void); 96 int check_valid_entries(void); 97 98 int read_config_file(const char *); 99 int conf_start_block(char *, char *); 100 int conf_end_block(void); 101 int conf_call_set(char *, conf_parm_t *, int); 102 void conf_report_error(const char *, ...); 103 void newconf_init(void); 104 int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); 105 void add_all_conf_settings(void); 106 void load_conf_settings(void); 107 #endif 108