Moving data1 to yaz/retrieval
authorSebastian Hammer <quinn@indexdata.com>
Wed, 1 Nov 1995 13:58:22 +0000 (13:58 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Wed, 1 Nov 1995 13:58:22 +0000 (13:58 +0000)
Makefile
index/Makefile
index/attribute.c [new file with mode: 0644]
index/zrpn.c
util/Makefile

index 866aa1b..3eb93ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
 # Copyright (C) 1994, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.33 1995-10-30 15:12:38 adam Exp $
+# $Id: Makefile,v 1.34 1995-11-01 13:58:22 quinn Exp $
 
 SHELL=/bin/sh
 MAKE=make
-SUBDIR=util str bfile dfa dict isam rset data1 index
+SUBDIR=util str bfile dfa dict isam rset index
 RANLIB=ranlib
 YAZ=../../yaz
 #OSILIB=../../xtimosi/src/libmosi.a $(YAZ)/lib/librfc.a
index 6838103..5968ac4 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1995, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.15 1995-10-30 15:12:42 adam Exp $
+# $Id: Makefile,v 1.16 1995-11-01 13:58:27 quinn Exp $
 
 SHELL=/bin/sh
 RANLIB=ranlib
@@ -15,18 +15,19 @@ TPROG2=kdump
 TPROG3=zserver
 DEFS=$(INCLUDE)
 O1 = main.o dir.o trav.o extract.o kinput.o kcompare.o \
- symtab.o text.o recctrl.o
+ symtab.o text.o recctrl.o structrec.o
 O2 = kdump.o
-O3 = zserver.o kcompare.o zrpn.o zsets.o text.o recctrl.o
+O3 = zserver.o kcompare.o zrpn.o zsets.o text.o recctrl.o structrec.o  \
+       attribute.o
 CPP=$(CC) -E
 
 all: $(TPROG1) $(TPROG2) $(TPROG3)
 
 $(TPROG1): $(O1) ../lib/dict.a \
-               ../lib/isam.a ../lib/bfile.a ../lib/data1.a ../lib/alexutil.a \
+               ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a \
                $(YAZLIB)
        $(CC) $(CFLAGS) -o $(TPROG1) $(O1) ../lib/dict.a \
-               ../lib/isam.a ../lib/bfile.a ../lib/data1.a ../lib/alexutil.a \
+               ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a \
                $(YAZLIB) $(OSILIB)
 
 $(TPROG2): $(O2) $(YAZLIB)
@@ -34,11 +35,11 @@ $(TPROG2): $(O2) $(YAZLIB)
 
 $(TPROG3): $(O3) \
                ../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/bfile.a \
-               ../lib/dfa.a ../lib/alexutil.a ../lib/data1.a \
+               ../lib/dfa.a ../lib/alexutil.a \
                $(YAZLIB)
        $(CC) $(CFLAGS) -o $(TPROG3) $(O3) \
                ../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/bfile.a \
-               ../lib/dfa.a ../lib/data1.a ../lib/alexutil.a \
+               ../lib/dfa.a ../lib/alexutil.a \
                $(YAZLIB) $(OSILIB) $(NETLIB) -lm
 
 .c.o:
diff --git a/index/attribute.c b/index/attribute.c
new file mode 100644 (file)
index 0000000..64d7035
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * This interface is used by other modules (the Z-server in particular)
+ * to normalize the attributes given in queries.
+ */
+
+#include <stdio.h>
+
+#include <log.h>
+#include <alexutil.h>
+#include <res.h>
+
+#include "d1_attset.h"
+
+#include "attribute.h"
+
+static int initialized = 0;
+
+static data1_attset *registered_sets = 0;
+
+static void att_loadset(const char *n, const char *name)
+{
+    data1_attset *new;
+
+    if (!(new = data1_read_attset((char*) name)))
+    {
+       logf(LOG_WARN|LOG_ERRNO, "%s", name);
+       return;
+    }
+    new->next = registered_sets;
+    registered_sets = new;
+    return;
+}
+
+static void load_atts()
+{
+    res_trav(common_resource, "attset", att_loadset);
+}
+
+static data1_att *getatt(data1_attset *p, int att)
+{
+    data1_att *a;
+
+    for (; p; p = p->next)
+    {
+       /* scan local set */
+       for (a = p->atts; a; a = a->next)
+           if (a->value == att)
+               return a;
+       /* scan included sets */
+       if (p->children && (a = getatt(p->children, att)))
+           return a;
+    }
+    return 0;
+}
+
+attent *att_getentbyatt(oid_value set, int att)
+{
+    static attent res;
+    data1_att *r;
+    data1_attset *p;
+
+    if (!initialized)
+    {
+       initialized = 1;
+       load_atts();
+    }
+    for (p = registered_sets; p; p = p->next)
+       if (p->reference == set && (r = getatt(p, att)))
+           break;;
+    if (!p)
+       return 0;
+    res.attset_ordinal = r->parent->ordinal;
+    res.local_attribute = r->local;
+    return &res;
+}
index b6ee62d..501a294 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zrpn.c,v $
- * Revision 1.32  1995-10-27 14:00:11  adam
+ * Revision 1.33  1995-11-01 13:58:28  quinn
+ * Moving data1 to yaz/retrieval
+ *
+ * Revision 1.32  1995/10/27  14:00:11  adam
  * Implemented detection of database availability.
  *
  * Revision 1.31  1995/10/17  18:02:10  adam
 #include <unistd.h>
 
 #include "zserver.h"
-#include <attribute.h>
+#include "attribute.h"
 
 #include <rsisam.h>
 #include <rstemp.h>
index c8a0ea3..cc3cd37 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1994, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.19 1995-10-30 14:11:03 adam Exp $
+# $Id: Makefile,v 1.20 1995-11-01 13:58:30 quinn Exp $
 
 SHELL=/bin/sh
 RANLIB=ranlib
@@ -13,7 +13,7 @@ TPROG=opt-test
 DEFS=$(INCLUDE)
 CPP=$(CC) -E
 LIB=../lib/alexutil.a
-PO = xmalloc.o res.o alexpath.o common.o readconf.o
+PO = res.o alexpath.o common.o
 
 all: $(LIB)