New function p_query_attset to define default attribute set.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Aug 1996 14:10:34 +0000 (14:10 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Aug 1996 14:10:34 +0000 (14:10 +0000)
util/Makefile
util/pquery.c

index 1439bf0..04c6c1a 100644 (file)
@@ -1,7 +1,7 @@
-# Copyright (C) 1994, Index Data I/S 
+# Copyright (C) 1994-1996, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.20 1996-05-22 08:36:07 adam Exp $
+# $Id: Makefile,v 1.21 1996-08-12 14:10:34 adam Exp $
 
 SHELL=/bin/sh
 INCLUDE=-I../include -I.
index e57b2a1..d0709b0 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1996, Index Data.
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: pquery.c,v $
- * Revision 1.9  1996-03-15 11:03:46  adam
+ * Revision 1.10  1996-08-12 14:10:35  adam
+ * New function p_query_attset to define default attribute set.
+ *
+ * Revision 1.9  1996/03/15  11:03:46  adam
  * Attribute set can be set globally for a query with the @attrset
  * operator. The @attr operator has an optional attribute-set specifier
  * that sets the attribute set locally.
@@ -44,6 +47,8 @@
 
 #include <pquery.h>
 
+static oid_value p_query_dfset = VAL_NONE;
+
 static const char *query_buf;
 static const char *query_lex_buf;
 static int query_lex_len;
@@ -332,6 +337,8 @@ Z_RPNQuery *p_query_rpn (ODR o, oid_proto proto, const char *qbuf)
         lex ();
     }
     if (topSet == VAL_NONE)
+        topSet = p_query_dfset;
+    if (topSet == VAL_NONE)
         topSet = VAL_BIB1;
     oset.proto = proto;
     oset.oclass = CLASS_ATTSET;
@@ -368,6 +375,8 @@ Z_AttributesPlusTerm *p_query_scan (ODR o, oid_proto proto,
         lex ();
     }
     if (topSet == VAL_NONE)
+        topSet = p_query_dfset;
+    if (topSet == VAL_NONE)
         topSet = VAL_BIB1;
     oset.proto = proto;
     oset.oclass = CLASS_ATTSET;
@@ -409,3 +418,9 @@ Z_AttributesPlusTerm *p_query_scan (ODR o, oid_proto proto,
     return rpn_term (o, proto, num_attr, attr_list, attr_set);
 }
 
+int p_query_attset (const char *arg)
+{
+    p_query_dfset = oid_getvalbyname (arg);
+    return (p_query_dfset == VAL_NONE) ? -1 : 0;
+}
+