5 * Revision 1.2 1995-09-27 15:02:44 quinn
6 * Modified function heads & prototypes.
8 * Revision 1.1 1995/04/10 10:28:20 quinn
11 * Revision 1.6 1995/02/23 08:32:00 adam
14 * Revision 1.4 1995/02/14 19:55:12 adam
15 * Header files ccl.h/cclp.h are gone! They have been merged an
16 * moved to ../include/ccl.h.
17 * Node kind(s) in ccl_rpn_node have changed names.
19 * Revision 1.3 1995/02/14 16:20:56 adam
20 * Qualifiers are read from a file now.
22 * Revision 1.2 1995/02/14 10:25:56 adam
23 * The constructions 'qualifier rel term ...' implemented.
25 * Revision 1.1 1995/02/13 15:15:07 adam
26 * Added handling of qualifiers. Not finished yet.
37 struct ccl_qualifiers {
38 struct ccl_qualifier *list;
41 void MDF ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs)
43 struct ccl_qualifier *q;
44 struct ccl_rpn_attr **attrp;
47 for (q = b->list; q; q = q->next)
48 if (!strcmp (name, q->name))
52 struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual));
55 new_qual->next = b->list;
58 new_qual->name = malloc (strlen(name)+1);
59 assert (new_qual->name);
60 strcpy (new_qual->name, name);
61 attrp = &new_qual->attr_list;
65 attrp = &q->attr_list;
67 attrp = &(*attrp)->next;
71 struct ccl_rpn_attr *attr;
73 attr = malloc (sizeof(*attr));
75 attr->type = *pairs++;
76 attr->value = *pairs++;
83 CCL_bibset MDF ccl_qual_mk (void)
85 CCL_bibset b = malloc (sizeof(*b));
91 void MDF ccl_qual_rm (CCL_bibset *b)
97 struct ccl_rpn_attr MDF *ccl_qual_search (CCL_bibset b, const char *name, int len)
99 struct ccl_qualifier *q;
102 for (q = b->list; q; q = q->next)
103 if (strlen(q->name) == len && !memcmp (name, q->name, len))
108 void MDF ccl_qual_file (CCL_bibset bibset, FILE *inf)
116 while (fgets (line, 255, inf))
121 if (sscanf (cp, "%s%n", qual_name, &no_scan) != 1)
131 if (sscanf (cp, "%s%n", qual_des, &no_scan) != 1)
134 if (!(split = strchr (qual_des, '=')))
139 qual_type = qual_des;
143 if ((split = strchr (qual_value, ',')))
145 pair[1] = atoi (qual_value);
146 switch (qual_type[0])
149 pair[0] = CCL_BIB1_USE;
152 pair[0] = CCL_BIB1_REL;
153 if (!strcmp (qual_value, "o"))
154 pair[1] = CCL_BIB1_REL_ORDER;
157 pair[0] = CCL_BIB1_POS;
160 pair[0] = CCL_BIB1_STR;
161 if (!strcmp (qual_value, "pw"))
162 pair[1] = CCL_BIB1_STR_WP;
165 pair[0] = CCL_BIB1_TRU;
166 if (!strcmp (qual_value, "l"))
167 pair[1] = CCL_BIB1_TRU_CAN_LEFT;
168 else if (!strcmp (qual_value, "r"))
169 pair[1] = CCL_BIB1_TRU_CAN_RIGHT;
170 else if (!strcmp (qual_value, "b"))
171 pair[1] = CCL_BIB1_TRU_CAN_BOTH;
172 else if (!strcmp (qual_value, "n"))
173 pair[1] = CCL_BIB1_TRU_CAN_NONE;
176 pair[0] = CCL_BIB1_COM;
179 pair[0] = atoi (qual_type);
181 ccl_qual_add (bibset, qual_name, 1, pair);