5 * Revision 1.8 1995/05/11 14:03:57 adam
6 * Changes in the reading of qualifier(s). New function: ccl_qual_fitem.
7 * New variable ccl_case_sensitive, which controls whether reserved
8 * words and field names are case sensitive or not.
10 * Revision 1.7 1995/04/17 09:31:46 adam
11 * Improved handling of qualifiers. Aliases or reserved words.
13 * Revision 1.6 1995/02/23 08:32:00 adam
16 * Revision 1.4 1995/02/14 19:55:12 adam
17 * Header files ccl.h/cclp.h are gone! They have been merged an
18 * moved to ../include/ccl.h.
19 * Node kind(s) in ccl_rpn_node have changed names.
21 * Revision 1.3 1995/02/14 16:20:56 adam
22 * Qualifiers are read from a file now.
24 * Revision 1.2 1995/02/14 10:25:56 adam
25 * The constructions 'qualifier rel term ...' implemented.
27 * Revision 1.1 1995/02/13 15:15:07 adam
28 * Added handling of qualifiers. Not finished yet.
39 /* Definition of CCL_bibset pointer */
40 struct ccl_qualifiers {
41 struct ccl_qualifier *list;
45 * ccl_qual_add: Add qualifier to Bibset. If qualifier already
46 * exists, then attributes are appendend to old
48 * name: name of qualifier
49 * no: No of attribute type/value pairs.
50 * pairs: Attributes. pairs[0] first type, pair[1] first value,
51 * ... pair[2*no-2] last type, pair[2*no-1] last value.
53 void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs)
55 struct ccl_qualifier *q;
56 struct ccl_rpn_attr **attrp;
59 for (q = b->list; q; q = q->next)
60 if (!strcmp (name, q->name))
64 struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual));
67 new_qual->next = b->list;
70 new_qual->name = malloc (strlen(name)+1);
71 assert (new_qual->name);
72 strcpy (new_qual->name, name);
73 attrp = &new_qual->attr_list;
77 attrp = &q->attr_list;
79 attrp = &(*attrp)->next;
83 struct ccl_rpn_attr *attr;
85 attr = malloc (sizeof(*attr));
87 attr->type = *pairs++;
88 attr->value = *pairs++;
96 * ccl_qual_mk: Make new (empty) bibset.
97 * return: empty bibset.
99 CCL_bibset ccl_qual_mk (void)
101 CCL_bibset b = malloc (sizeof(*b));
108 * ccl_qual_rm: Delete bibset.
109 * b: pointer to bibset
111 void ccl_qual_rm (CCL_bibset *b)
113 struct ccl_qualifier *q, *q1;
117 for (q = (*b)->list; q; q = q1)
119 struct ccl_rpn_attr *attr, *attr1;
121 for (attr = q->attr_list; attr; attr = attr1)
134 * ccl_qual_search: Search for qualifier in bibset.
136 * name: Name of qualifier to search for (need no null-termination)
137 * len: Length of name.
138 * return: Attribute info. NULL if not found.
140 struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, int len)
142 struct ccl_qualifier *q;
145 for (q = b->list; q; q = q->next)
146 if (strlen(q->name) == len)
147 if (ccl_case_sensitive)
149 if (!memcmp (name, q->name, len))
154 if (!ccl_memicmp (name, q->name, len))