The constructions 'qualifier rel term ...' implemented.
[egate.git] / ccl / cclqual.c
index 4dff9cb..263b6ce 100644 (file)
@@ -2,7 +2,10 @@
  * Europagate, 1995
  *
  * $Log: cclqual.c,v $
- * Revision 1.1  1995/02/13 15:15:07  adam
+ * Revision 1.2  1995/02/14 10:25:56  adam
+ * The constructions 'qualifier rel term ...' implemented.
+ *
+ * Revision 1.1  1995/02/13  15:15:07  adam
  * Added handling of qualifiers. Not finished yet.
  *
  */
@@ -18,13 +21,11 @@ struct ccl_qualifiers {
     struct ccl_qualifier *list;
 };
 
-void ccl_qual_add (CCL_bibset b,
-                   const char *name, int nuse, int *use, int relation,
-                   int position, int structure, int truncation,
-                   int completeness)
+void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs)
 {
     struct ccl_qualifier *new_qual;
-
+    struct ccl_rpn_attr **attrp;
+    
     assert (b);
     new_qual = malloc (sizeof(*new_qual));
     assert (new_qual);
@@ -35,15 +36,20 @@ void ccl_qual_add (CCL_bibset b,
     new_qual->name = malloc (strlen(name)+1);
     assert (new_qual->name);
     strcpy (new_qual->name, name);
-    new_qual->nuse = nuse;
-    new_qual->use = malloc (sizeof(int)*nuse);
-    assert (new_qual->use);
-    memcpy (new_qual->use, use, sizeof(int)*nuse);
-    new_qual->relation = relation;
-    new_qual->position = position;
-    new_qual->structure = structure;
-    new_qual->truncation = truncation;
-    new_qual->completeness = completeness;
+    attrp = &new_qual->attr_list;
+
+    while (--no >= 0)
+    {
+        struct ccl_rpn_attr *attr;
+
+        attr = malloc (sizeof(*attr));
+        assert (attr);
+        attr->type = *pairs++;
+        attr->value = *pairs++;
+        *attrp = attr;
+        attrp = &attr->next;
+    }
+    *attrp = NULL;
 }
 
 CCL_bibset ccl_qual_mk (void)
@@ -60,13 +66,13 @@ void ccl_qual_rm (CCL_bibset *b)
     *b = NULL;
 }
 
-struct ccl_qualifier *ccl_qual_search (CCL_bibset b, const char *name)
+struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, int len)
 {
     struct ccl_qualifier *q;
 
     assert (b);
     for (q = b->list; q; q = q->next)
-        if (strcmp (name, q->name))
-            return q;
+        if (strlen(q->name) == len && !memcmp (name, q->name, len))
+            return q->attr_list;
     return NULL;
 }