Mon, 17 Nov 2003 22:04:25 +0100
trunk: changeset 60
Check that PREV!=NULL when unlinking item from a list. (PREV must
point to something if on list.)
5 | 1 | /* |
2 | * libtu/parser.h | |
3 | * | |
36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
53 | 5 | * |
6 | * You may distribute and modify this library under the terms of either | |
7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
5 | 8 | */ |
9 | ||
8 | 10 | #ifndef LIBTU_PARSER_H |
11 | #define LIBTU_PARSER_H | |
5 | 12 | |
13 | #include "tokenizer.h" | |
14 | ||
15 | /* | |
16 | * format: | |
17 | * l = long | |
18 | * d = double | |
19 | * i = identifier | |
20 | * s = string | |
21 | * c = char | |
22 | * . = 1 times any ("l.d") | |
23 | * * = 0 or more times any (must be the last, "sd*") | |
24 | * ? = optional ("?c") | |
25 | * : = conditional (":c:s") | |
26 | * + = 1 or more times last (most be the last, "l+") | |
27 | * special entries: | |
28 | * | |
29 | * "#end" call this handler at the end of section. | |
30 | * "#cancel" call this handler when recovering from error | |
31 | */ | |
32 | ||
38 | 33 | #define END_CONFOPTS {NULL, NULL, NULL, NULL} |
34 | ||
5 | 35 | typedef struct _ConfOpt{ |
36 | const char *optname; | |
37 | const char *argfmt; | |
38 | bool (*fn)(Tokenizer *tokz, int n, Token *toks); | |
39 | struct _ConfOpt *opts; | |
40 | } ConfOpt; | |
41 | ||
46 | 42 | #define CONFOPTS_NOT_SET libtu_dummy_confopts |
43 | extern ConfOpt libtu_dummy_confopts[]; | |
5 | 44 | |
45 | extern bool parse_config_tokz(Tokenizer *tokz, const ConfOpt *options); | |
46 | 46 | extern bool parse_config_tokz_skip_section(Tokenizer *tokz); |
5 | 47 | extern bool parse_config(const char *fname, const ConfOpt *options, int flags); |
48 | extern bool parse_config_file(FILE *file, const ConfOpt *options, int flags); | |
20 | 49 | extern bool check_args(const Tokenizer *tokz, Token *tokens, int ntokens, |
50 | const char *fmt); | |
40 | 51 | extern bool check_args_loose(const Tokenizer *tokz, Token *tokens, int ntokens, |
52 | const char *fmt); | |
5 | 53 | |
8 | 54 | #endif /* LIBTU_PARSER_H */ |