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