include/libtu/parser.h

Sat, 19 Jan 2002 19:14:36 +0100

author
tuomov
date
Sat, 19 Jan 2002 19:14:36 +0100
changeset 35
5a71d53d0228
parent 34
828f3afd5c76
child 36
63cd573ffbcf
permissions
-rw-r--r--

trunk: changeset 38
Warning callbacks (thanks to Lukas Schroeder). libtu now depends on
the asprintf functions and one implementation is included in
snprintf_2.2/.

5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
1 /*
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
2 * libtu/parser.h
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
3 *
9
55e7f2ff6021 trunk: changeset 12
tuomov
parents: 8
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2000.
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
5 * See the included file LICENSE for details.
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
6 */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
7
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
8 #ifndef LIBTU_PARSER_H
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
9 #define LIBTU_PARSER_H
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
10
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
11 #include "tokenizer.h"
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
12
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
13 /*
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
14 * format:
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
15 * l = long
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
16 * d = double
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
17 * i = identifier
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
18 * s = string
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
19 * c = char
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
20 * . = 1 times any ("l.d")
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
21 * * = 0 or more times any (must be the last, "sd*")
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
22 * ? = optional ("?c")
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
23 * : = conditional (":c:s")
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
24 * + = 1 or more times last (most be the last, "l+")
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
25 * special entries:
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
26 *
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
27 * "#end" call this handler at the end of section.
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
28 * "#cancel" call this handler when recovering from error
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
29 */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
30
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
31 typedef struct _ConfOpt{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
32 const char *optname;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
33 const char *argfmt;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
34 bool (*fn)(Tokenizer *tokz, int n, Token *toks);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
35 struct _ConfOpt *opts;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
36 } ConfOpt;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
37
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
38
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
39 extern bool parse_config_tokz(Tokenizer *tokz, const ConfOpt *options);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
40 extern bool parse_config(const char *fname, const ConfOpt *options, int flags);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
41 extern bool parse_config_file(FILE *file, const ConfOpt *options, int flags);
20
3f11f764772a trunk: changeset 23
tuomov
parents: 9
diff changeset
42 extern bool check_args(const Tokenizer *tokz, Token *tokens, int ntokens,
3f11f764772a trunk: changeset 23
tuomov
parents: 9
diff changeset
43 const char *fmt);
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
44
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
45 #endif /* LIBTU_PARSER_H */

mercurial