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