implement new "toggle" rc command
[rofl0r-gnuboy.git] / rc.h
blob2f398d71870a26c0943afdc9221b5b1016ffeacc
4 #ifndef __RC_H__
5 #define __RC_H__
9 typedef enum rctype
11 rcv_end,
12 rcv_int,
13 rcv_string,
14 rcv_vector,
15 rcv_bool
16 } rcvtype_t;
19 typedef struct rcvar_s
21 char *name;
22 char *help;
23 int type;
24 int len;
25 void *mem;
26 } rcvar_t;
28 #define RCV_END { 0, 0, rcv_end, 0, 0 }
29 #define RCV_INT(n,v,h) { (n), (h), rcv_int, 1, (v) }
30 #define RCV_STRING(n,v,h) { (n), (h), rcv_string, 0, (v) }
31 #define RCV_VECTOR(n,v,l,h) { (n), (h), rcv_vector, (l), (v) }
32 #define RCV_BOOL(n,v,h) { (n), (h), rcv_bool, 1, (v) }
34 typedef struct rccmd_s
36 char *name;
37 int (*func)(int, char **);
38 } rccmd_t;
40 #define RCC(n,f) { (n), (f) }
41 #define RCC_END { 0, 0 }
43 void rc_export(rcvar_t *v);
44 void rc_exportvars(rcvar_t *vars);
46 int rc_findvar(char *name);
48 int rc_setvar_n(int i, int c, char **v);
49 int rc_setvar(char *name, int c, char **v);
51 int rc_getint_n(int i);
52 int *rc_getvec_n(int i);
53 char *rc_getstr_n(int i);
55 int rc_getint(char *name);
56 int *rc_getvec(char *name);
57 char *rc_getstr(char *name);
59 int rc_command(char *line);
60 int rc_sourcefile(char *filename);
61 const char *rc_type_to_string(rcvtype_t type);
63 #endif