]> mj.ucw.cz Git - eval.git/blob - sherlock/attrset.c
Adapted to reflect changes in libucw.
[eval.git] / sherlock / attrset.c
1 /*
2  *      Sherlock Library -- Parsing Attribute Sets
3  *
4  *      (c) 2006 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #include "sherlock/sherlock.h"
11 #include "sherlock/object.h"
12 #include "sherlock/attrset.h"
13 #include "ucw/clists.h"
14 #include "sherlock/conf.h"
15
16 struct attr_node {
17   cnode n;
18   uns attr;
19 };
20
21 struct cf_section attr_set_cf = {
22   CF_TYPE(struct attr_node),
23   CF_ITEMS {
24     CF_USER("Attr", PTR_TO(struct attr_node, attr), &cf_type_attr),
25     CF_END
26   }
27 };
28
29 struct cf_section attr_set_cf_sub = {
30   CF_TYPE(struct attr_node),
31   CF_ITEMS {
32     CF_USER("Attr", PTR_TO(struct attr_node, attr), &cf_type_attr_sub),
33     CF_END
34   }
35 };
36
37 void
38 attr_set_commit(struct attr_set *set, clist *l)
39 {
40   CF_JOURNAL_VAR(*set);
41   bit_array_zero(set->a, ATTR_SET_SIZE);
42   CLIST_FOR_EACH(struct attr_node *, n, *l)
43     bit_array_set(set->a, n->attr);
44 }