regex: fix rinst struct field comment
[neatvi.git] / conf.c
blobfb7b0cc1522df86bb522ab86dc15fc3f07728989
1 #include <stdio.h>
2 #include <string.h>
3 #include "vi.h"
4 #include "conf.h"
5 #include "kmap.h"
7 int conf_dirmark(int idx, char **pat, int *ctx, int *dir, int *grp)
9 if (idx < 0 || idx >= LEN(dirmarks))
10 return 1;
11 if (pat)
12 *pat = dirmarks[idx].pat;
13 if (ctx)
14 *ctx = dirmarks[idx].ctx;
15 if (dir)
16 *dir = dirmarks[idx].dir;
17 if (grp)
18 *grp = dirmarks[idx].grp;
19 return 0;
22 int conf_dircontext(int idx, char **pat, int *ctx)
24 if (idx < 0 || idx >= LEN(dircontexts))
25 return 1;
26 if (pat)
27 *pat = dircontexts[idx].pat;
28 if (ctx)
29 *ctx = dircontexts[idx].dir;
30 return 0;
33 int conf_placeholder(int idx, char **s, char **d, int *wid)
35 if (idx < 0 || idx >= LEN(placeholders))
36 return 1;
37 if (s)
38 *s = placeholders[idx].s;
39 if (d)
40 *d = placeholders[idx].d;
41 if (wid)
42 *wid = placeholders[idx].wid;
43 return 0;
46 int conf_highlight(int idx, char **ft, int **att, char **pat, int *end)
48 if (idx < 0 || idx >= LEN(highlights))
49 return 1;
50 if (ft)
51 *ft = highlights[idx].ft;
52 if (att)
53 *att = highlights[idx].att;
54 if (pat)
55 *pat = highlights[idx].pat;
56 if (end)
57 *end = highlights[idx].end;
58 return 0;
61 int conf_filetype(int idx, char **ft, char **pat)
63 if (idx < 0 || idx >= LEN(filetypes))
64 return 1;
65 if (ft)
66 *ft = filetypes[idx].ft;
67 if (pat)
68 *pat = filetypes[idx].pat;
69 return 0;
72 int conf_highlight_revdir(int *att)
74 *att = SYN_REVDIR;
75 return 0;
78 char **conf_kmap(char *name)
80 int i;
81 for (i = 0; i < LEN(kmaps); i++)
82 if (name && kmaps[i][0] && !strcmp(name, kmaps[i][0]))
83 return kmaps[i];
84 return kmap_en;
87 char *conf_digraph(int c1, int c2)
89 int i;
90 for (i = 0; i < LEN(digraphs); i++)
91 if (digraphs[i][0][0] == c1 && digraphs[i][0][1] == c2)
92 return digraphs[i][1];
93 return NULL;