Ranges for ordered qualfiers implemented (e.g. pd=1980-1990).
[egate.git] / ccl / cclsh.c
index f6dd236..51754ec 100644 (file)
@@ -2,7 +2,13 @@
  * Europagate 1995
  *
  * $Log: cclsh.c,v $
- * Revision 1.2  1995/02/13 15:15:07  adam
+ * Revision 1.4  1995/02/14 14:12:42  adam
+ * Ranges for ordered qualfiers implemented (e.g. pd=1980-1990).
+ *
+ * Revision 1.3  1995/02/14  10:25:57  adam
+ * The constructions 'qualifier rel term ...' implemented.
+ *
+ * Revision 1.2  1995/02/13  15:15:07  adam
  * Added handling of qualifiers. Not finished yet.
  *
  * Revision 1.1  1995/02/13  12:35:21  adam
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 
 #include "ccl.h"
 
 static int debug = 0;
 static char *prog;
 
+static int ti_attr[] = {
+    CCL_BIB1_USE, 4,
+    CCL_BIB1_STR, CCL_BIB1_STR_WP
+};
+
+static int au_attr[] = {
+    CCL_BIB1_USE, 1,
+    CCL_BIB1_STR, CCL_BIB1_STR_WP
+};
+
+static int pd_attr[] = {
+    CCL_BIB1_USE, 31,
+    CCL_BIB1_REL, CCL_BIB1_REL_ORDER
+};
+
 int main (int argc, char **argv)
 {
     CCL_bibset bibset;
-    static int uses[10];
 
     prog = *argv;
     bibset = ccl_qual_mk ();    
@@ -47,28 +68,32 @@ int main (int argc, char **argv)
             exit (1);
         }
     }
-    uses[0] = 5;
-    ccl_qual_add (bibset, "ti", 1, uses, -1, -1,
-                  0, -1, -1);
-    uses[0] = 1;
-    ccl_qual_add (bibset, "au", 1, uses, -1, -1,
-                  0, -1, -1);
+    ccl_qual_add (bibset, "ti", sizeof(ti_attr)/(2*sizeof(int)), ti_attr);
+    ccl_qual_add (bibset, "au", sizeof(au_attr)/(2*sizeof(int)), au_attr);
+    ccl_qual_add (bibset, "pd", sizeof(pd_attr)/(2*sizeof(int)), pd_attr);
     while (1)
     {
         char buf[80];
-        int error;
-        int pos;
+        int error, pos;
+        struct ccl_rpn_node *rpn;
+
        printf ("CCLSH>"); fflush (stdout);
        if (!fgets (buf, 79, stdin))
            break;
-       ccl_find_str (bibset, buf, &error, &pos);
+       rpn = ccl_find_str (bibset, buf, &error, &pos);
         if (error)
         {
             printf ("%*s^ - ", 6+pos, " ");
             printf ("%s\n", ccl_err_msg (error));
-            
+        }
+        else
+        {
+            assert (rpn);
+            ccl_pr_tree (rpn);
+            putchar ('\n');
         }
     }
+    putchar ('\n');
     return 0;
 }