]>
Commit | Line | Data |
---|---|---|
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 | */ | |
4 | ||
5 | #ifndef _NEWCONF_H_INCLUDED | |
6 | #define _NEWCONF_H_INCLUDED | |
7 | ||
8 | struct ConfEntry | |
9 | { | |
10 | const char *cf_name; | |
11 | int cf_type; | |
12 | void (*cf_func) (void *); | |
13 | int cf_len; | |
14 | void *cf_arg; | |
15 | }; | |
16 | ||
17 | struct TopConf | |
18 | { | |
19 | const char *tc_name; | |
20 | int (*tc_sfunc) (struct TopConf *); | |
21 | int (*tc_efunc) (struct TopConf *); | |
22 | rb_dlink_list tc_items; | |
23 | struct ConfEntry *tc_entries; | |
24 | }; | |
25 | ||
26 | ||
27 | #define CF_QSTRING 0x01 | |
28 | #define CF_INT 0x02 | |
29 | #define CF_STRING 0x03 | |
30 | #define CF_TIME 0x04 | |
31 | #define CF_YESNO 0x05 | |
32 | #define CF_LIST 0x06 | |
33 | #define CF_ONE 0x07 | |
34 | ||
35 | #define CF_MTYPE 0xFF | |
36 | ||
37 | #define CF_FLIST 0x1000 | |
38 | #define CF_MFLAG 0xFF00 | |
39 | ||
40 | typedef struct conf_parm_t_stru | |
41 | { | |
42 | struct conf_parm_t_stru *next; | |
43 | int type; | |
44 | union | |
45 | { | |
46 | char *string; | |
47 | int number; | |
48 | struct conf_parm_t_stru *list; | |
49 | } | |
50 | v; | |
51 | } | |
52 | conf_parm_t; | |
53 | ||
54 | extern struct TopConf *conf_cur_block; | |
55 | ||
56 | extern char *current_file; | |
57 | ||
58 | int read_config(char *); | |
59 | int conf_start_block(char *, char *); | |
60 | int conf_end_block(struct TopConf *); | |
61 | int conf_call_set(struct TopConf *, char *, conf_parm_t *, int); | |
62 | void conf_report_error(const char *, ...); | |
63 | void newconf_init(void); | |
64 | int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); | |
65 | int remove_conf_item(const char *topconf, const char *name); | |
66 | int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items); | |
67 | int remove_top_conf(char *name); | |
68 | struct TopConf *find_top_conf(const char *name); | |
69 | struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name); | |
70 | ||
71 | #endif |