5 * Revision 1.7 1995/04/17 09:31:46 adam
6 * Improved handling of qualifiers. Aliases or reserved words.
8 * Revision 1.6 1995/02/23 08:32:00 adam
11 * Revision 1.4 1995/02/14 19:55:12 adam
12 * Header files ccl.h/cclp.h are gone! They have been merged an
13 * moved to ../include/ccl.h.
14 * Node kind(s) in ccl_rpn_node have changed names.
16 * Revision 1.3 1995/02/14 16:20:56 adam
17 * Qualifiers are read from a file now.
19 * Revision 1.2 1995/02/14 10:25:56 adam
20 * The constructions 'qualifier rel term ...' implemented.
22 * Revision 1.1 1995/02/13 15:15:07 adam
23 * Added handling of qualifiers. Not finished yet.
34 /* Definition of CCL_bibset pointer */
35 struct ccl_qualifiers {
36 struct ccl_qualifier *list;
40 * ccl_qual_add: Add qualifier to Bibset. If qualifier already
41 * exists, then attributes are appendend to old
43 * name: name of qualifier
44 * no: No of attribute type/value pairs.
45 * pairs: Attributes. pairs[0] first type, pair[1] first value,
46 * ... pair[2*no-2] last type, pair[2*no-1] last value.
48 void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs)
50 struct ccl_qualifier *q;
51 struct ccl_rpn_attr **attrp;
54 for (q = b->list; q; q = q->next)
55 if (!strcmp (name, q->name))
59 struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual));
62 new_qual->next = b->list;
65 new_qual->name = malloc (strlen(name)+1);
66 assert (new_qual->name);
67 strcpy (new_qual->name, name);
68 attrp = &new_qual->attr_list;
72 attrp = &q->attr_list;
74 attrp = &(*attrp)->next;
78 struct ccl_rpn_attr *attr;
80 attr = malloc (sizeof(*attr));
82 attr->type = *pairs++;
83 attr->value = *pairs++;
91 * ccl_qual_mk: Make new (empty) bibset.
92 * return: empty bibset.
94 CCL_bibset ccl_qual_mk (void)
96 CCL_bibset b = malloc (sizeof(*b));
103 * ccl_qual_rm: Delete bibset.
104 * b: pointer to bibset
106 void ccl_qual_rm (CCL_bibset *b)
108 struct ccl_qualifier *q, *q1;
112 for (q = (*b)->list; q; q = q1)
114 struct ccl_rpn_attr *attr, *attr1;
116 for (attr = q->attr_list; attr; attr = attr1)
129 * ccl_qual_search: Search for qualifier in bibset.
131 * name: Name of qualifier to search for (need no null-termination)
132 * len: Length of name.
133 * return: Attribute info. NULL if not found.
135 struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, int len)
137 struct ccl_qualifier *q;
140 for (q = b->list; q; q = q->next)
141 if (strlen(q->name) == len && !memcmp (name, q->name, len))