English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/common-nfo/tools/nfotiser/nfotiser.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3468 - (show annotations) (download)
Thu Aug 9 15:46:10 2007 UTC (6 years, 6 months ago) by tg
File MIME type: text/plain
File size: 1517 byte(s)
algorithm for variable expansion, dead simple:
• first, variables are looked up:
  - ${FOO} -> content of FOO
  syntax errors are handled by eating the dollar sign and braces:
  - $x -> x
  - ${x -> x
• then, all first backslashes are removed

1 /*-
2 * $FreeWRT$
3 *-
4 * This file is part of the FreeWRT project. FreeWRT is copyrighted
5 * material, please see the LICENCE file in the top-level directory
6 * or at http://www.freewrt.org/licence for details.
7 */
8
9 #ifndef NFOTISER_NFOTISER_H
10 #define NFOTISER_NFOTISER_H
11
12 #include <sys/queue.h>
13 #include "nfohelpr.h"
14
15 struct categories {
16 const char *catname;
17 const char *catdesc;
18 };
19
20 enum parser_kwtype {
21 KWT_NORMAL,
22 KWT_MULTI,
23 KWT_ITERATED,
24 KWT_MULTITER,
25 KWT_MULTITOP
26 };
27
28 enum parser_argtype {
29 ARGT_STRING,
30 ARGT_INTEGER
31 };
32
33 #ifndef parser_kwords
34 #define parser_kwords int
35 #endif
36
37 struct parser_keywords {
38 const char *kwprefix;
39 parser_kwords kwnum;
40 enum parser_kwtype kwtype;
41 enum parser_argtype argtype;
42 };
43
44 struct parser_res {
45 CIRCLEQ_ENTRY(parser_res) e;
46 parser_kwords keyword;
47 char *kw_multi;
48 unsigned kw_iter;
49 char *value;
50 };
51
52 CIRCLEQ_HEAD(parser_result, parser_res);
53
54 __BEGIN_DECLS
55 /* categories.c */
56 extern const struct categories categories[];
57 const char *category(const char *);
58 /* parser.c */
59 struct parser_result *nfo_parse(int, const struct parser_keywords *);
60 const struct parser_keywords *parser_getkwbynum(parser_kwords,
61 const struct parser_keywords *);
62 void parser_dump(struct parser_res *, const struct parser_keywords *);
63 void parser_free(struct parser_result *);
64 EXTERN char *parser_errpfx I__(NULL);
65 struct parser_res *parse_lookupbyname(struct parser_result *, const char *);
66 struct parser_res *parse_lookup(struct parser_result *, struct parser_res *);
67 __END_DECLS
68
69 #endif

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20