-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.h
executable file
·75 lines (50 loc) · 1.15 KB
/
rc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef __RC_H__
#define __RC_H__
typedef enum rctype
{
rcv_end,
rcv_int,
rcv_string,
rcv_vector,
rcv_bool
} rcvtype_t;
typedef struct rcvar_s
{
char *name;
int type;
int len;
void *mem;
} rcvar_t;
#define RCV_END { 0, rcv_end, 0, 0 }
#define RCV_INT(n,v) { (n), rcv_int, 1, (v) }
#define RCV_STRING(n,v) { (n), rcv_string, 0, (v) }
#define RCV_VECTOR(n,v,l) { (n), rcv_vector, (l), (v) }
#define RCV_BOOL(n,v) { (n), rcv_bool, 1, (v) }
typedef struct rccmd_s
{
char *name;
int (*func)(int, char **);
} rccmd_t;
#define RCC(n,f) { (n), (f) }
#define RCC_END { 0, 0 }
void rc_export(rcvar_t *v);
void rc_exportvars(rcvar_t *vars);
int rc_findvar(char *name);
int rc_setvar_n(int i, int c, char **v);
int rc_setvar(char *name, int c, char **v);
int rc_getint_n(int i);
int *rc_getvec_n(int i);
char *rc_getstr_n(int i);
int rc_getint(char *name);
int *rc_getvec(char *name);
char *rc_getstr(char *name);
void rc_dokey(int key, int st);
/* rccmds.c */
int rc_command(char *line);
/* rcfile.c */
int rc_sourcefile(char *filename);
/* rckeys.c */
int rc_bindkey(char *keyname, char *cmd);
int rc_unbindkey(char *keyname);
void rc_unbindall();
#endif