Update for YAZ 3s new OID system
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Apr 2007 08:44:31 +0000 (08:44 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Apr 2007 08:44:31 +0000 (08:44 +0000)
35 files changed:
data1/d1_absyn.c
data1/d1_attset.c
data1/d1_doespec.c
data1/d1_espec.c
data1/d1_expout.c
data1/d1_map.c
data1/d1_marc.c
data1/d1_read.c
data1/d1_tagset.c
data1/d1_varset.c
include/attrfind.h
include/d1_absyn.h
include/idzebra/api.h
include/idzebra/data1.h
include/idzebra/recctrl.h
index/alvis.c
index/attribute.c
index/index.h
index/mod_dom.c
index/recgrs.c
index/rectext.c
index/retrieve.c
index/rpnscan.c
index/rpnsearch.c
index/safari.c
index/zebraapi.c
index/zebrash.c
index/zebrasrv.c
index/zinfo.c
index/zsets.c
test/api/t16.c
test/api/t4.c
test/api/testlib.c
test/api/testlib.h
util/attrfind.c

index 4af2713..2f03b0c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_absyn.c,v 1.34 2007-01-22 18:15:02 adam Exp $
+/* $Id: d1_absyn.c,v 1.35 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <string.h>
 
 #include <yaz/log.h>
 #include <string.h>
 
 #include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
 #include <idzebra/data1.h>
 #include <idzebra/recctrl.h>
 #include <zebra_xpath.h>
 #include <idzebra/data1.h>
 #include <idzebra/recctrl.h>
 #include <zebra_xpath.h>
@@ -250,13 +250,13 @@ data1_attset *data1_attset_search_name (data1_handle dh, const char *name)
     return 0;
 }
 
     return 0;
 }
 
-data1_attset *data1_attset_search_id (data1_handle dh, int id)
+data1_attset *data1_attset_search_id(data1_handle dh, const int *oid)
 {
     data1_attset_cache p = *data1_attset_cache_get (dh);
 
     while (p)
     {
 {
     data1_attset_cache p = *data1_attset_cache_get (dh);
 
     while (p)
     {
-       if (id == p->attset->reference)
+       if (p->attset->oid && !oid_oidcmp(oid, p->attset->oid))
            return p->attset;
        p = p->next;
     }
            return p->attset;
        p = p->next;
     }
@@ -700,7 +700,7 @@ static data1_absyn *data1_read_absyn(data1_handle dh, const char *file,
     
     res = (data1_absyn *) nmem_malloc(data1_nmem_get(dh), sizeof(*res));
     res->name = 0;
     
     res = (data1_absyn *) nmem_malloc(data1_nmem_get(dh), sizeof(*res));
     res->name = 0;
-    res->reference = VAL_NONE;
+    res->oid = 0;
     res->tagset = 0;
     res->encoding = 0;
     res->xpath_indexing = 
     res->tagset = 0;
     res->encoding = 0;
     res->xpath_indexing = 
@@ -1022,7 +1022,10 @@ static data1_absyn *data1_read_absyn(data1_handle dh, const char *file,
                continue;
            }
            name = argv[1];
                continue;
            }
            name = argv[1];
-           if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+            res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                              CLASS_SCHEMA, name, 
+                                              data1_nmem_get(dh));
+            if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'", 
                     file, lineno, name);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'", 
                     file, lineno, name);
index 4e2bd9e..fd0bd72 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_attset.c,v 1.13 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_attset.c,v 1.14 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <stdlib.h>
 
 #include <yaz/log.h>
 #include <stdlib.h>
 
 #include <yaz/log.h>
+#include <yaz/oid_db.h>
 #include <idzebra/data1.h>
 
 data1_att *data1_getattbyname(data1_handle dh, data1_attset *s, const char *name)
 #include <idzebra/data1.h>
 
 data1_att *data1_getattbyname(data1_handle dh, data1_attset *s, const char *name)
@@ -52,7 +53,7 @@ data1_attset *data1_empty_attset(data1_handle dh)
     data1_attset *res = (data1_attset*) nmem_malloc(mem,sizeof(*res));
 
     res->name = 0;
     data1_attset *res = (data1_attset*) nmem_malloc(mem,sizeof(*res));
 
     res->name = 0;
-    res->reference = VAL_NONE;
+    res->oid = 0;
     res->atts = 0;
     res->children = 0;
     res->next = 0;
     res->atts = 0;
     res->children = 0;
     res->next = 0;
@@ -132,7 +133,10 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file)
                continue;
            }
            name = argv[1];
                continue;
            }
            name = argv[1];
-           if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+
+            res->oid  = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                               CLASS_ATTSET, name, mem);
+           if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference oid '%s'",
                        file, lineno, name);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference oid '%s'",
                        file, lineno, name);
index 3623336..c00cc90 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_doespec.c,v 1.12 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_doespec.c,v 1.13 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -20,12 +20,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
 
 */
 
+/** \file d1_doespec.c
+ *  \brief handle Z39.50 variant-1 specs
+ *   
+ *  See http://www.loc.gov/z3950/agency/defns/variant1.html
+ */
 #include <assert.h>
 #include <stdlib.h>
 
 #include <yaz/log.h>
 #include <assert.h>
 #include <stdlib.h>
 
 #include <yaz/log.h>
-#include <yaz/oid.h>
 #include <yaz/proto.h>
 #include <yaz/proto.h>
+#include <yaz/oid_db.h>
 #include <idzebra/data1.h>
 
 static int match_children(data1_handle dh, data1_node *n,
 #include <idzebra/data1.h>
 
 static int match_children(data1_handle dh, data1_node *n,
@@ -45,23 +50,18 @@ static int match_children_wildpath(data1_handle dh, data1_node *n,
  * set is the set to look for, universal set is the set that applies to a
  * triple with an unknown set.
  */
  * set is the set to look for, universal set is the set that applies to a
  * triple with an unknown set.
  */
-static Z_Triple *find_triple(Z_Variant *var, oid_value universalset,
-    oid_value set, int zclass, int type)
+static Z_Triple *find_triple(Z_Variant *var, const int *universal_oid,
+                             const int *var_oid, int zclass, int type)
 {
     int i;
 {
     int i;
-    oident *defaultsetent = oid_getentbyoid(var->globalVariantSetId);
-    oid_value defaultset = defaultsetent ? defaultsetent->value :
-       universalset;
 
     for (i = 0; i < var->num_triples; i++)
     {
 
     for (i = 0; i < var->num_triples; i++)
     {
-       oident *cursetent =
-           oid_getentbyoid(var->triples[i]->variantSetId);
-       oid_value curset = cursetent ? cursetent->value : defaultset;
-
-       if (set == curset &&
-           *var->triples[i]->zclass == zclass &&
-           *var->triples[i]->type == type)
+        const int *cur_oid = var->triples[i]->variantSetId;
+        if (!cur_oid)
+            cur_oid = var->globalVariantSetId;
+        if (cur_oid && var_oid 
+            && !oid_oidcmp(var_oid, cur_oid) && *var->triples[i]->type == type)
            return var->triples[i];
     }
     return 0;
            return var->triples[i];
     }
     return 0;
@@ -106,9 +106,9 @@ static void mark_subtree(data1_node *n, int make_variantlist, int no_data,
 }
 
 
 }
 
 
-static void match_triple (data1_handle dh, Z_Variant *vreq,
-                         oid_value defsetval,
-                         oid_value var1, data1_node *n)
+static void match_triple(data1_handle dh, Z_Variant *vreq,
+                         const int *def_oid,
+                         const int *var_oid, data1_node *n)
 {
     data1_node **c;
 
 {
     data1_node **c;
 
@@ -127,7 +127,7 @@ static void match_triple (data1_handle dh, Z_Variant *vreq,
        if ((*c)->u.variant.type->zclass->zclass == 4 &&
            (*c)->u.variant.type->type == 1)
        {
        if ((*c)->u.variant.type->zclass->zclass == 4 &&
            (*c)->u.variant.type->type == 1)
        {
-           if ((r = find_triple(vreq, defsetval, var1, 4, 1)) &&
+           if ((r = find_triple(vreq, def_oid, var_oid, 4, 1)) &&
                (r->which == Z_Triple_internationalString))
            {
                const char *string_value =
                (r->which == Z_Triple_internationalString))
            {
                const char *string_value =
@@ -142,7 +142,7 @@ static void match_triple (data1_handle dh, Z_Variant *vreq,
        }
        else
        {
        }
        else
        {
-           match_triple (dh, vreq, defsetval, var1, *c);
+           match_triple(dh, vreq, def_oid, var_oid, *c);
            c = &(*c)->next;
        }
     }
            c = &(*c)->next;
        }
     }
@@ -282,10 +282,8 @@ static int match_children_here (data1_handle dh, data1_node *n,
 
                    Z_Variant *vreq =
                        e->elements[i]->u.simpleElement->variantRequest;
 
                    Z_Variant *vreq =
                        e->elements[i]->u.simpleElement->variantRequest;
-                   oident *defset = oid_getentbyoid(e->defaultVariantSetId);
-                   oid_value defsetval = defset ? defset->value : VAL_NONE;
-                   oid_value var1 = oid_getvalbyname("Variant-1");
 
 
+                    const int *var_oid = yaz_oid_variant1();
                    if (!vreq)
                        vreq = e->defaultVariantRequest;
 
                    if (!vreq)
                        vreq = e->defaultVariantRequest;
 
@@ -296,21 +294,25 @@ static int match_children_here (data1_handle dh, data1_node *n,
                        /*
                         * 6,5: meta-data requested, variant list.
                         */
                        /*
                         * 6,5: meta-data requested, variant list.
                         */
-                       if (find_triple(vreq, defsetval, var1, 6, 5))
+                       if (find_triple(vreq, e->defaultVariantSetId, 
+                                        var_oid, 6, 5))
                            show_variantlist = 1;
                        /*
                         * 9,1: Miscellaneous, no data requested.
                         */
                            show_variantlist = 1;
                        /*
                         * 9,1: Miscellaneous, no data requested.
                         */
-                       if (find_triple(vreq, defsetval, var1, 9, 1))
+                       if (find_triple(vreq, e->defaultVariantSetId,
+                                        var_oid, 9, 1))
                            no_data = 1;
 
                        /* howmuch */
                            no_data = 1;
 
                        /* howmuch */
-                       if ((r = find_triple(vreq, defsetval, var1, 5, 5)))
+                       if ((r = find_triple(vreq, e->defaultVariantSetId,
+                                             var_oid, 5, 5)))
                            if (r->which == Z_Triple_integer)
                                get_bytes = *r->value.integer;
 
                        if (!show_variantlist)
                            if (r->which == Z_Triple_integer)
                                get_bytes = *r->value.integer;
 
                        if (!show_variantlist)
-                           match_triple (dh, vreq, defsetval, var1, c);
+                           match_triple(dh, vreq, e->defaultVariantSetId,
+                                         var_oid, c);
                    }
                    mark_subtree(c, show_variantlist, no_data, get_bytes, vreq,
                                 select_flag);
                    }
                    mark_subtree(c, show_variantlist, no_data, get_bytes, vreq,
                                 select_flag);
index ac43e3f..4c64840 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_espec.c,v 1.13 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_espec.c,v 1.14 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -29,20 +29,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/odr.h>
 #include <yaz/proto.h>
 #include <idzebra/data1.h>
 #include <yaz/odr.h>
 #include <yaz/proto.h>
 #include <idzebra/data1.h>
+#include <yaz/oid_db.h>
 
 static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
                               const char *file, int lineno)
 {
     Z_Variant *r = (Z_Variant *)nmem_malloc(nmem, sizeof(*r));
 
 static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
                               const char *file, int lineno)
 {
     Z_Variant *r = (Z_Variant *)nmem_malloc(nmem, sizeof(*r));
-    oident var1;
     int i;
     int i;
-    int oid[OID_SIZE];
-
-    var1.proto = PROTO_Z3950;
-    var1.oclass = CLASS_VARSET;
-    var1.value = VAL_VAR1;
-    r->globalVariantSetId = odr_oiddup_nmem(nmem, oid_ent_to_oid(&var1, oid));
 
 
+    r->globalVariantSetId = odr_oiddup_nmem(nmem, yaz_oid_variant1());
     if (argc)
        r->triples = (Z_Triple **)nmem_malloc(nmem, sizeof(Z_Triple*) * argc);
     else
     if (argc)
        r->triples = (Z_Triple **)nmem_malloc(nmem, sizeof(Z_Triple*) * argc);
     else
index bd940d7..3757f28 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_expout.c,v 1.9 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_expout.c,v 1.10 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <yaz/log.h>
 #include <yaz/proto.h>
 
 #include <yaz/log.h>
 #include <yaz/proto.h>
+#include <yaz/oid_db.h>
+#include <yaz/snprintf.h>
 #include <idzebra/data1.h>
 
 typedef struct {
 #include <idzebra/data1.h>
 
 typedef struct {
@@ -113,31 +115,15 @@ static bool_t *f_bool(ExpHandle *eh, data1_node *c)
 static Odr_oid *f_oid(ExpHandle *eh, data1_node *c, oid_class oclass)
 {
     char oidstr[64];
 static Odr_oid *f_oid(ExpHandle *eh, data1_node *c, oid_class oclass)
 {
     char oidstr[64];
-    int oid_this[20];
-    oid_value value_for_this;
 
     c = c->child;
     if (!is_data_tag (eh, c) || c->u.data.len > 63)
        return 0;
 
     c = c->child;
     if (!is_data_tag (eh, c) || c->u.data.len > 63)
        return 0;
-    sprintf(oidstr, "%.*s", c->u.data.len, c->u.data.data);
-    value_for_this = oid_getvalbyname(oidstr);
-    if (value_for_this == VAL_NONE)
-    {
-       Odr_oid *oid = odr_getoidbystr(eh->o, oidstr);
-       assert (oid);
-       return oid;
-    }
-    else
-    {
-       struct oident ident;
+    yaz_snprintf(oidstr, sizeof(oidstr)-1, 
+                 "%.*s", c->u.data.len, c->u.data.data);
 
 
-       ident.oclass = oclass;
-       ident.proto = PROTO_Z3950;
-       ident.value = value_for_this;
-       
-       oid_ent_to_oid (&ident, oid_this);
-    }
-    return odr_oiddup (eh->o, oid_this);
+    return yaz_string_to_oid_odr(yaz_oid_std(),
+                                 CLASS_GENERAL, oidstr, eh->o);
 }
 
 static Z_IntUnit *f_intunit(ExpHandle *eh, data1_node *c)
 }
 
 static Z_IntUnit *f_intunit(ExpHandle *eh, data1_node *c)
index b92ad0a..997b9cb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_map.c,v 1.15 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_map.c,v 1.16 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <string.h>
 
 #include <yaz/log.h>
 #include <string.h>
 
 #include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
 #include <yaz/readconf.h>
 #include <yaz/tpath.h>
 #include <d1_absyn.h>
 #include <yaz/readconf.h>
 #include <yaz/tpath.h>
 #include <d1_absyn.h>
@@ -45,7 +45,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file)
        return 0;
 
     res->name = 0;
        return 0;
 
     res->name = 0;
-    res->target_absyn_ref = VAL_NONE;
+    res->oid = 0;
     res->map = 0;
     mapp = &res->map;
     res->next = 0;
     res->map = 0;
     mapp = &res->map;
     res->next = 0;
@@ -59,8 +59,9 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file)
                        file, lineno);
                continue;
            }
                        file, lineno);
                continue;
            }
-           if ((res->target_absyn_ref = oid_getvalbyname(argv[1]))
-               == VAL_NONE)
+            res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                              CLASS_RECSYN, argv[1], mem);
+           if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
                        file, lineno, argv[1]);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
                        file, lineno, argv[1]);
index a9a5ed7..05fbb76 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_marc.c,v 1.17 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_marc.c,v 1.18 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <string.h>
 
 #include <yaz/log.h>
 #include <string.h>
 
 #include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
 #include <yaz/marcdisp.h>
 #include <yaz/readconf.h>
 #include <yaz/xmalloc.h>
 #include <yaz/marcdisp.h>
 #include <yaz/readconf.h>
 #include <yaz/xmalloc.h>
@@ -47,7 +47,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file)
        return 0;
 
     res->name = 0;
        return 0;
 
     res->name = 0;
-    res->reference = VAL_NONE;
+    res->oid = 0;
     res->next = 0;
     res->length_data_entry = 4;
     res->length_starting = 5;
     res->next = 0;
     res->length_data_entry = 4;
     res->length_starting = 5;
@@ -81,7 +81,10 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file)
                        *argv);
                continue;
            }
                        *argv);
                continue;
            }
-           if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
+            res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                              CLASS_TAGSET, argv[1], 
+                                              mem);
+           if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'",
                        file, lineno, argv[1]);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'",
                        file, lineno, argv[1]);
index 8247e62..0db4c89 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_read.c,v 1.24 2007-03-20 22:07:35 adam Exp $
+/* $Id: d1_read.c,v 1.25 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -174,6 +174,7 @@ data1_node *data1_mk_root (data1_handle dh, NMEM nmem, const char *name)
 {
     data1_absyn *absyn = data1_get_absyn(dh, name, 1);
     data1_node *res;
 {
     data1_absyn *absyn = data1_get_absyn(dh, name, 1);
     data1_node *res;
+
     if (!absyn)
     {
         yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'",
     if (!absyn)
     {
         yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'",
index 244f5df..b55dfaa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_tagset.c,v 1.9 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_tagset.c,v 1.10 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <yaz/log.h>
 #include <idzebra/data1.h>
 
 #include <yaz/log.h>
 #include <idzebra/data1.h>
+#include <yaz/oid_db.h>
 
 /*
  * We'll probably want to add some sort of hashed index to these lookup-
 
 /*
  * We'll probably want to add some sort of hashed index to these lookup-
@@ -108,7 +109,7 @@ data1_tagset *data1_empty_tagset (data1_handle dh)
     data1_tagset *res =
        (data1_tagset *) nmem_malloc(data1_nmem_get (dh), sizeof(*res));
     res->name = 0;
     data1_tagset *res =
        (data1_tagset *) nmem_malloc(data1_nmem_get (dh), sizeof(*res));
     res->name = 0;
-    res->reference = VAL_NONE;
+    res->oid = 0;
     res->tags = 0;
     res->type = 0;
     res->children = 0;
     res->tags = 0;
     res->type = 0;
     res->children = 0;
@@ -211,7 +212,9 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type)
                continue;
            }
            name = argv[1];
                continue;
            }
            name = argv[1];
-           if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+            res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                              CLASS_TAGSET, name, mem);
+           if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
                        file, lineno, name);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
                        file, lineno, name);
index bc0c8dd..f3632af 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_varset.c,v 1.10 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_varset.c,v 1.11 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <string.h>
 #include <stdlib.h>
 
 #include <string.h>
 #include <stdlib.h>
 
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
 #include <yaz/log.h>
 #include <d1_absyn.h>
 
 #include <yaz/log.h>
 #include <d1_absyn.h>
 
@@ -65,7 +65,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file)
     char *argv[50],line[512];
 
     res->name = 0;
     char *argv[50],line[512];
 
     res->name = 0;
-    res->reference = VAL_NONE;
+    res->oid = 0;
     res->classes = 0;
 
     if (!(f = data1_path_fopen(dh, file, "r")))
     res->classes = 0;
 
     if (!(f = data1_path_fopen(dh, file, "r")))
@@ -142,7 +142,9 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file)
                        file, lineno);
                continue;
            }
                        file, lineno);
                continue;
            }
-           if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
+            res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+                                              CLASS_VARSET, argv[1], mem);
+           if (!res->oid)
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
                        file, lineno, argv[1]);
            {
                yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
                        file, lineno, argv[1]);
index 5e28e3b..daaa278 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: attrfind.h,v 1.3 2007-01-15 20:08:24 adam Exp $
+/* $Id: attrfind.h,v 1.4 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 2005-2007
    Index Data ApS
 
    Copyright (C) 2005-2007
    Index Data ApS
 
@@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <yaz/yconfig.h>
 #include <yaz/z-core.h>
 
 #include <yaz/yconfig.h>
 #include <yaz/z-core.h>
-#include <yaz/oid.h>
 
 YAZ_BEGIN_CDECL
 
 
 YAZ_BEGIN_CDECL
 
@@ -41,10 +40,9 @@ void attr_init_APT(AttrType *src, Z_AttributesPlusTerm *zapt, int type);
 
 void attr_init_AttrList(AttrType *src, Z_AttributeList *list, int type);
 
 
 void attr_init_AttrList(AttrType *src, Z_AttributeList *list, int type);
 
-int attr_find_ex(AttrType *src, oid_value *attributeSetP,
+int attr_find_ex(AttrType *src, const int **attribute_set_oid,
                  const char **string_value);
                  const char **string_value);
-int attr_find(AttrType *src, oid_value *attributeSetP);
-    
+int attr_find(AttrType *src, const int **attribute_set_oid);
 
 YAZ_END_CDECL
 
 
 YAZ_END_CDECL
 
index ff85ba6..f144773 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_absyn.h,v 1.11 2007-01-22 18:15:03 adam Exp $
+/* $Id: d1_absyn.h,v 1.12 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -50,7 +50,7 @@ typedef struct data1_xpelement
 struct data1_absyn
 {
     char *name;
 struct data1_absyn
 {
     char *name;
-    oid_value reference;
+    int *oid;
     data1_tagset *tagset;
     data1_varset *varset;
     data1_esetname *esetnames;
     data1_tagset *tagset;
     data1_varset *varset;
     data1_esetname *esetnames;
index 8179b44..76690ae 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: api.h,v 1.47 2007-03-14 11:48:31 adam Exp $
+/* $Id: api.h,v 1.48 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #define IDZEBRA_API_H
 
 #include <yaz/odr.h>
 #define IDZEBRA_API_H
 
 #include <yaz/odr.h>
-#include <yaz/oid.h>
 #include <yaz/proto.h>
 #include <idzebra/res.h>
 #include <idzebra/version.h>
 #include <yaz/proto.h>
 #include <idzebra/res.h>
 #include <idzebra/version.h>
@@ -56,7 +55,7 @@ typedef struct {
     int position;        /* position of record in result set (1,2,..) */
     char *buf;           /* record buffer (void pointer really) */
     int len;             /* length */
     int position;        /* position of record in result set (1,2,..) */
     char *buf;           /* record buffer (void pointer really) */
     int len;             /* length */
-    oid_value format;    /* record syntax */
+    const int *format;   /* record syntax */
     char *base; 
     zint sysno;
     int  score;
     char *base; 
     zint sysno;
     int  score;
@@ -221,7 +220,7 @@ YAZ_EXPORT
 ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                                 const char *setname,
                                 Z_RecordComposition *comp,
 ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                                 const char *setname,
                                 Z_RecordComposition *comp,
-                                oid_value input_format,
+                                const int *input_format,
                                 int num_recs,
                                 ZebraRetrievalRecord *recs);
 /** \brief Deletes one or more resultsets 
                                 int num_recs,
                                 ZebraRetrievalRecord *recs);
 /** \brief Deletes one or more resultsets 
@@ -288,7 +287,7 @@ ZEBRA_RES zebra_result_set_term_info(ZebraHandle zh, const char *setname,
 */
 YAZ_EXPORT ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream,
                                Z_AttributesPlusTerm *zapt,
 */
 YAZ_EXPORT ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream,
                                Z_AttributesPlusTerm *zapt,
-                               oid_value attributeset,
+                               const int *attributeset,
                                int *position, int *num_entries,
                                ZebraScanEntry **entries,
                                int *is_partial,
                                int *position, int *num_entries,
                                ZebraScanEntry **entries,
                                int *is_partial,
index f41a770..b12d795 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: data1.h,v 1.21 2007-01-15 20:08:24 adam Exp $
+/* $Id: data1.h,v 1.22 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <stdio.h>
 
 #include <yaz/nmem.h>
 #include <stdio.h>
 
 #include <yaz/nmem.h>
-#include <yaz/oid.h>
 #include <yaz/proto.h>
 #include <yaz/yaz-util.h>
 
 #include <yaz/proto.h>
 #include <yaz/yaz-util.h>
 
@@ -72,7 +71,7 @@ struct data1_attset_child {
 struct data1_attset
 {
     char *name;          /* symbolic name */
 struct data1_attset
 {
     char *name;          /* symbolic name */
-    oid_value reference;   /* external ID of attset */
+    int *oid;            /* attribute set OID */
     data1_att *atts;          /* attributes */
     data1_attset_child *children;  /* included attset */
     data1_attset *next;       /* next in cache */
     data1_att *atts;          /* attributes */
     data1_attset_child *children;  /* included attset */
     data1_attset *next;       /* next in cache */
@@ -112,7 +111,7 @@ typedef struct data1_mapunit
 typedef struct data1_maptab
 {
     char *name;
 typedef struct data1_maptab
 {
     char *name;
-    oid_value target_absyn_ref;
+    int *oid;  /* target abstract syntax  */
     char *target_absyn_name;
     data1_mapunit *map;
     struct data1_maptab *next;
     char *target_absyn_name;
     data1_mapunit *map;
     struct data1_maptab *next;
@@ -146,7 +145,7 @@ typedef enum data1_datatype
 typedef struct data1_marctab
 {
     char *name;
 typedef struct data1_marctab
 {
     char *name;
-    oid_value reference;
+    int *oid; /* MARC OID */
 
     char record_status[2];
     char implementation_codes[5];
 
     char record_status[2];
     char implementation_codes[5];
@@ -197,7 +196,7 @@ typedef struct data1_varclass
 typedef struct data1_varset
 {
     char *name;
 typedef struct data1_varset
 {
     char *name;
-    oid_value reference;
+    int *oid; /* variant OID */
     data1_varclass *classes;
 } data1_varset;
 
     data1_varclass *classes;
 } data1_varset;
 
@@ -230,7 +229,7 @@ struct data1_tagset
 {
     int type;                        /* type of tagset in current context */
     char *name;                      /* symbolic name */
 {
     int type;                        /* type of tagset in current context */
     char *name;                      /* symbolic name */
-    oid_value reference;
+    int *oid;                        /* variant OID */
     data1_tag *tags;                 /* tags defined by this set */
     data1_tagset *children;          /* children */
     data1_tagset *next;              /* sibling */
     data1_tag *tags;                 /* tags defined by this set */
     data1_tagset *children;          /* children */
     data1_tagset *next;              /* sibling */
@@ -542,7 +541,8 @@ YAZ_EXPORT void data1_absyn_trav (data1_handle dh, void *handle,
                                  void (*fh)(data1_handle dh,
                                             void *h, data1_absyn *a));
 
                                  void (*fh)(data1_handle dh,
                                             void *h, data1_absyn *a));
 
-YAZ_EXPORT data1_attset *data1_attset_search_id (data1_handle dh, int id);
+YAZ_EXPORT data1_attset *data1_attset_search_id (data1_handle dh,
+                                                 const int *oid);
 
 YAZ_EXPORT char *data1_getNodeValue(data1_node* node, char* pTagPath);
 YAZ_EXPORT data1_node *data1_LookupNode(data1_node* node, char* pTagPath);
 
 YAZ_EXPORT char *data1_getNodeValue(data1_node* node, char* pTagPath);
 YAZ_EXPORT data1_node *data1_LookupNode(data1_node* node, char* pTagPath);
index cd8e7a0..097af09 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: recctrl.h,v 1.33 2007-03-14 14:16:14 adam Exp $
+/* $Id: recctrl.h,v 1.34 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <sys/types.h>
 #include <yaz/proto.h>
 
 #include <sys/types.h>
 #include <yaz/proto.h>
-#include <yaz/oid.h>
 #include <yaz/odr.h>
 #include <idzebra/res.h>
 #include <idzebra/data1.h>
 #include <yaz/odr.h>
 #include <idzebra/res.h>
 #include <idzebra/data1.h>
@@ -116,7 +115,7 @@ struct recRetrieveCtrl {
     /* Input parameters ... */
     Res       res;                   /* Resource pool                     */
     ODR       odr;                    /* ODR used to create response       */
     /* Input parameters ... */
     Res       res;                   /* Resource pool                     */
     ODR       odr;                    /* ODR used to create response       */
-    oid_value input_format;           /* Preferred record syntax           */
+    const int*input_format;           /* Preferred record syntax OID       */
     Z_RecordComposition *comp;        /* formatting instructions           */
     char      *encoding;              /* preferred character encoding      */
     zint      localno;                /* local id of record                */
     Z_RecordComposition *comp;        /* formatting instructions           */
     char      *encoding;              /* preferred character encoding      */
     zint      localno;                /* local id of record                */
@@ -129,11 +128,11 @@ struct recRetrieveCtrl {
     zebra_snippets *doc_snippet;
     
     /* response */
     zebra_snippets *doc_snippet;
     
     /* response */
-    oid_value  output_format;
-    void       *rec_buf;
+    const int *output_format;               /* output format OID */
+    void *     rec_buf;
     int        rec_len;
     int        diagnostic;
     int        rec_len;
     int        diagnostic;
-    char       *addinfo;
+    char *     addinfo;
 };
 
 typedef struct recType *RecType;
 };
 
 typedef struct recType *RecType;
index e168da3..77efef6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: alvis.c,v 1.15 2007-03-19 21:50:39 adam Exp $
+/* $Id: alvis.c,v 1.16 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <yaz/diagbib1.h>
 #include <yaz/tpath.h>
 
 #include <yaz/diagbib1.h>
 #include <yaz/tpath.h>
+#include <yaz/oid_db.h>
 
 #include <libxml/xmlversion.h>
 #include <libxml/parser.h>
 
 #include <libxml/xmlversion.h>
 #include <libxml/parser.h>
@@ -729,7 +730,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
     {
        p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
     }
     {
        p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
     }
-    else if (p->input_format == VAL_NONE || p->input_format == VAL_TEXT_XML)
+    else if (!p->input_format || !oid_oidcmp(p->input_format, yaz_oid_xml()))
     {
        xmlChar *buf_out;
        int len_out;
     {
        xmlChar *buf_out;
        int len_out;
@@ -740,13 +741,13 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
         else
            xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
 
         else
            xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
 
-       p->output_format = VAL_TEXT_XML;
+       p->output_format = yaz_oid_xml();
        p->rec_len = len_out;
        p->rec_buf = odr_malloc(p->odr, p->rec_len);
        memcpy(p->rec_buf, buf_out, p->rec_len);
        xmlFree(buf_out);
     }
        p->rec_len = len_out;
        p->rec_buf = odr_malloc(p->odr, p->rec_len);
        memcpy(p->rec_buf, buf_out, p->rec_len);
        xmlFree(buf_out);
     }
-    else if (p->output_format == VAL_SUTRS)
+    else if (!oid_oidcmp(p->output_format, yaz_oid_sutrs()))
     {
        xmlChar *buf_out;
        int len_out;
     {
        xmlChar *buf_out;
        int len_out;
@@ -757,7 +758,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
         else
            xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
 
         else
            xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
 
-       p->output_format = VAL_SUTRS;
+       p->output_format = yaz_oid_sutrs();
        p->rec_len = len_out;
        p->rec_buf = odr_malloc(p->odr, p->rec_len);
        memcpy(p->rec_buf, buf_out, p->rec_len);
        p->rec_len = len_out;
        p->rec_buf = odr_malloc(p->odr, p->rec_len);
        memcpy(p->rec_buf, buf_out, p->rec_len);
index 2b55081..4fb5bb2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: attribute.c,v 1.28 2007-01-15 15:10:16 adam Exp $
+/* $Id: attribute.c,v 1.29 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <idzebra/util.h>
 #include <attrfind.h>
 #include "index.h"
 #include <idzebra/util.h>
 #include <attrfind.h>
 #include "index.h"
+#include <yaz/oid_db.h>
 
 static data1_att *getatt(data1_attset *p, int att)
 {
 
 static data1_att *getatt(data1_attset *p, int att)
 {
@@ -45,7 +46,7 @@ static data1_att *getatt(data1_attset *p, int att)
     return 0;
 }
 
     return 0;
 }
 
-static int att_getentbyatt(ZebraHandle zi, oid_value set, int att,
+static int att_getentbyatt(ZebraHandle zi, const int *set, int att,
                            const char **name)
 {
     data1_att *r;
                            const char **name)
 {
     data1_att *r;
@@ -69,7 +70,7 @@ ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
                                   int index_type,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
                                   int index_type,
-                                  oid_value curAttributeSet,
+                                  const int *curAttributeSet,
                                   int *ord)
 {
     int use_value = -1;
                                   int *ord)
 {
     int use_value = -1;
@@ -123,7 +124,7 @@ ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh,
                             Z_AttributesPlusTerm *zapt,
                             int index_type,
                             const char *xpath_use,
                             Z_AttributesPlusTerm *zapt,
                             int index_type,
                             const char *xpath_use,
-                            oid_value curAttributeSet,
+                            const int *curAttributeSet,
                             int *ord)
 {
     ZEBRA_RES res = ZEBRA_OK;
                             int *ord)
 {
     ZEBRA_RES res = ZEBRA_OK;
@@ -181,16 +182,18 @@ ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
 {
     AttrType structure;
     int structure_value;
 {
     AttrType structure;
     int structure_value;
+
     attr_init_AttrList(&structure, sortAttributes->list, 4);
 
     *numerical = 0;
     structure_value = attr_find(&structure, 0);
     if (structure_value == 109)
         *numerical = 1;
     attr_init_AttrList(&structure, sortAttributes->list, 4);
 
     *numerical = 0;
     structure_value = attr_find(&structure, 0);
     if (structure_value == 109)
         *numerical = 1;
-    
-    if (zebra_attr_list_get_ord(zh, sortAttributes->list,
-                                zinfo_index_category_sort,
-                                -1 /* any index */, VAL_BIB1, ord)== ZEBRA_OK)
+
+    if (zebra_attr_list_get_ord(
+            zh, sortAttributes->list,
+            zinfo_index_category_sort,
+            -1 /* any index */, yaz_oid_attset_bib1(), ord) == ZEBRA_OK)
         return ZEBRA_OK;
     return ZEBRA_FAIL;
 }
         return ZEBRA_OK;
     return ZEBRA_FAIL;
 }
index 32ded3e..07392a1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: index.h,v 1.196 2007-03-14 11:48:32 adam Exp $
+/* $Id: index.h,v 1.197 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -261,7 +261,7 @@ void zebra_limit_for_rset(struct zebra_limit *zl,
 struct rset_key_control *zebra_key_control_create(ZebraHandle zh);
 
 ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
 struct rset_key_control *zebra_key_control_create(ZebraHandle zh);
 
 ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
-                        oid_value attributeSet, 
+                        const int *attributeSet, 
                         NMEM stream, NMEM rset_nmem,
                         Z_SortKeySpecList *sort_sequence,
                         int num_bases, char **basenames,
                         NMEM stream, NMEM rset_nmem,
                         Z_SortKeySpecList *sort_sequence,
                         int num_bases, char **basenames,
@@ -271,7 +271,7 @@ ZEBRA_RES rpn_get_top_approx_limit(ZebraHandle zh, Z_RPNStructure *zs,
                                    zint *approx_limit);
 
 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
                                    zint *approx_limit);
 
 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                   oid_value attributeset,
+                   const int *attributeset,
                    int num_bases, char **basenames,
                    int *position, int *num_entries, ZebraScanEntry **list,
                    int *is_partial, RSET limit_set);
                    int num_bases, char **basenames,
                    int *position, int *num_entries, ZebraScanEntry **list,
                    int *is_partial, RSET limit_set);
@@ -308,11 +308,11 @@ ZEBRA_RES resultSetRank(ZebraHandle zh, ZebraSet zebraSet, RSET rset,
 void resultSetInvalidate(ZebraHandle zh);
 
 int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, 
 void resultSetInvalidate(ZebraHandle zh);
 
 int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, 
-                       zebra_snippets *hit_snippet, ODR stream,
-                       oid_value input_format, Z_RecordComposition *comp,
-                       oid_value *output_format, char **rec_bufp,
-                       int *rec_lenp, char **basenamep,
-                       char **addinfo);
+                       zebra_snippets *hit_snippet, ODR stream,
+                       const int *input_format, Z_RecordComposition *comp,
+                       const int **output_format, char **rec_bufp,
+                       int *rec_lenp, char **basenamep,
+                       char **addinfo);
 
 void extract_get_fname_tmp(ZebraHandle zh, char *fname, int no);
 
 
 void extract_get_fname_tmp(ZebraHandle zh, char *fname, int no);
 
@@ -379,14 +379,14 @@ ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh,
                             Z_AttributesPlusTerm *zapt,
                             int index_type,
                             const char *xpath_use,
                             Z_AttributesPlusTerm *zapt,
                             int index_type,
                             const char *xpath_use,
-                            oid_value curAttributeSet,
+                            const int *curAttributeSet,
                             int *ord);
 
 ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
                                   int index_type,
                             int *ord);
 
 ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
                                   int index_type,
-                                  oid_value curAttributeSet,
+                                  const int *curAttributeSet,
                                   int *ord);
 
 ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
                                   int *ord);
 
 ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
index 1832b05..ea09c31 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mod_dom.c,v 1.34 2007-04-07 22:18:46 adam Exp $
+/* $Id: mod_dom.c,v 1.35 2007-04-16 08:44:31 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -43,6 +43,7 @@
 
 #include <idzebra/util.h>
 #include <idzebra/recctrl.h>
 
 #include <idzebra/util.h>
 #include <idzebra/recctrl.h>
+#include <yaz/oid_db.h>
 
 /* DOM filter style indexing */
 #define ZEBRA_DOM_NS "http://indexdata.com/zebra-2.0"
 
 /* DOM filter style indexing */
 #define ZEBRA_DOM_NS "http://indexdata.com/zebra-2.0"
@@ -1387,7 +1388,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
     {
         p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
     }
     {
         p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
     }
-    else if (p->input_format == VAL_NONE || p->input_format == VAL_TEXT_XML)
+    else if (!p->input_format || !oid_oidcmp(p->input_format, yaz_oid_xml()))
     {
         xmlChar *buf_out;
         int len_out;
     {
         xmlChar *buf_out;
         int len_out;
@@ -1397,13 +1398,13 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
         else
             xmlDocDumpMemory(doc, &buf_out, &len_out);            
 
         else
             xmlDocDumpMemory(doc, &buf_out, &len_out);            
 
-        p->output_format = VAL_TEXT_XML;
+        p->output_format = yaz_oid_xml();
         p->rec_len = len_out;
         p->rec_buf = odr_malloc(p->odr, p->rec_len);
         memcpy(p->rec_buf, buf_out, p->rec_len);
         xmlFree(buf_out);
     }
         p->rec_len = len_out;
         p->rec_buf = odr_malloc(p->odr, p->rec_len);
         memcpy(p->rec_buf, buf_out, p->rec_len);
         xmlFree(buf_out);
     }
-    else if (p->output_format == VAL_SUTRS)
+    else if (!oid_oidcmp(p->output_format, yaz_oid_sutrs()))
     {
         xmlChar *buf_out;
         int len_out;
     {
         xmlChar *buf_out;
         int len_out;
@@ -1413,7 +1414,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
         else
             xmlDocDumpMemory(doc, &buf_out, &len_out);            
         
         else
             xmlDocDumpMemory(doc, &buf_out, &len_out);            
         
-        p->output_format = VAL_SUTRS;
+        p->output_format = yaz_oid_sutrs();
         p->rec_len = len_out;
         p->rec_buf = odr_malloc(p->odr, p->rec_len);
         memcpy(p->rec_buf, buf_out, p->rec_len);
         p->rec_len = len_out;
         p->rec_buf = odr_malloc(p->odr, p->rec_len);
         memcpy(p->rec_buf, buf_out, p->rec_len);
index 3137760..862a4f3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: recgrs.c,v 1.16 2007-03-07 21:08:36 adam Exp $
+/* $Id: recgrs.c,v 1.17 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <ctype.h>
 
 #include <yaz/log.h>
 #include <ctype.h>
 
 #include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
 #include <yaz/diagbib1.h>
 
 #include <d1_absyn.h>
 #include <yaz/diagbib1.h>
 
 #include <d1_absyn.h>
@@ -883,19 +883,10 @@ static int dumpkeys(data1_node *n, struct recExtractCtrl *p, RecWord *wrd)
 
 int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
 {
 
 int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
 {
-    oident oe;
-    int oidtmp[OID_SIZE];
     RecWord wrd;
 
     RecWord wrd;
 
-    oe.proto = PROTO_Z3950;
-    oe.oclass = CLASS_SCHEMA;
-    if (n->u.root.absyn)
-    {
-        oe.value = n->u.root.absyn->reference;
-        
-        if ((oid_ent_to_oid (&oe, oidtmp)))
-            (*p->schemaAdd)(p, oidtmp);
-    }
+    if (n->u.root.absyn && n->u.root.absyn->oid)
+        (*p->schemaAdd)(p, n->u.root.absyn->oid);
     (*p->init)(p, &wrd);
 
     /* data1_pr_tree(p->dh, n, stdout); */ 
     (*p->init)(p, &wrd);
 
     /* data1_pr_tree(p->dh, n, stdout); */ 
@@ -909,8 +900,6 @@ static int grs_extract_sub(void *clientData, struct recExtractCtrl *p,
 {
     data1_node *n;
     struct grs_read_info gri;
 {
     data1_node *n;
     struct grs_read_info gri;
-    oident oe;
-    int oidtmp[OID_SIZE];
     RecWord wrd;
 
     gri.stream = p->stream;
     RecWord wrd;
 
     gri.stream = p->stream;
@@ -921,18 +910,8 @@ static int grs_extract_sub(void *clientData, struct recExtractCtrl *p,
     n = (*grs_read)(&gri);
     if (!n)
         return RECCTRL_EXTRACT_EOF;
     n = (*grs_read)(&gri);
     if (!n)
         return RECCTRL_EXTRACT_EOF;
-    oe.proto = PROTO_Z3950;
-    oe.oclass = CLASS_SCHEMA;
-#if 0
-    if (!n->u.root.absyn)
-        return RECCTRL_EXTRACT_ERROR;
-#endif
-    if (n->u.root.absyn)
-    {
-        oe.value = n->u.root.absyn->reference;
-        if ((oid_ent_to_oid (&oe, oidtmp)))
-            (*p->schemaAdd)(p, oidtmp);
-    }
+    if (n->u.root.absyn && n->u.root.absyn->oid)
+        (*p->schemaAdd)(p, n->u.root.absyn->oid);
     data1_concat_text(p->dh, mem, n);
 
     /* ensure our data1 tree is UTF-8 */
     data1_concat_text(p->dh, mem, n);
 
     /* ensure our data1 tree is UTF-8 */
@@ -1099,8 +1078,10 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
     NMEM mem;
     struct grs_read_info gri;
     const char *tagname;
     NMEM mem;
     struct grs_read_info gri;
     const char *tagname;
+    const int *xml_oid = yaz_oid_xml();
+    const int *grs1_oid = yaz_oid_grs1();
 
 
-    int requested_schema = VAL_NONE;
+    const int *requested_schema = 0;
     data1_marctab *marctab;
     int dummy;
     
     data1_marctab *marctab;
     int dummy;
     
@@ -1162,8 +1143,14 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
        dnew->u.data.len = strlen(dnew->u.data.data);
     }
 
        dnew->u.data.len = strlen(dnew->u.data.data);
     }
 
-    if (p->input_format == VAL_TEXT_XML)
-       zebra_xml_metadata (p, top, mem);
+    if (!p->input_format)
+    {  /* SUTRS is default input_format */
+        p->input_format = yaz_oid_sutrs();
+    }
+    assert(p->input_format);
+
+    if (!oid_oidcmp(p->input_format, xml_oid))
+        zebra_xml_metadata (p, top, mem);
 
 #if 0
     data1_pr_tree (p->dh, node, stdout);
 
 #if 0
     data1_pr_tree (p->dh, node, stdout);
@@ -1173,19 +1160,18 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
         p->comp->u.complex->generic->which == Z_Schema_oid &&
         p->comp->u.complex->generic->schema.oid)
     {
         p->comp->u.complex->generic->which == Z_Schema_oid &&
         p->comp->u.complex->generic->schema.oid)
     {
-       oident *oe = oid_getentbyoid (p->comp->u.complex->generic->schema.oid);
-       if (oe)
-           requested_schema = oe->value;
+        requested_schema = p->comp->u.complex->generic->schema.oid;
     }
     /* If schema has been specified, map if possible, then check that
      * we got the right one 
      */
     }
     /* If schema has been specified, map if possible, then check that
      * we got the right one 
      */
-    if (requested_schema != VAL_NONE)
+    if (requested_schema)
     {
        yaz_log(YLOG_DEBUG, "grs_retrieve: schema mapping");
        for (map = node->u.root.absyn->maptabs; map; map = map->next)
        {
     {
        yaz_log(YLOG_DEBUG, "grs_retrieve: schema mapping");
        for (map = node->u.root.absyn->maptabs; map; map = map->next)
        {
-           if (map->target_absyn_ref == requested_schema)
+           // if (map->target_absyn_ref == requested_schema)
+           if (!oid_oidcmp(map->oid, requested_schema))
            {
                onode = node;
                if (!(node = data1_map_record(p->dh, onode, map, mem)))
            {
                onode = node;
                if (!(node = data1_map_record(p->dh, onode, map, mem)))
@@ -1197,10 +1183,10 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
                break;
            }
        }
                break;
            }
        }
-       if (node->u.root.absyn &&
-           requested_schema != node->u.root.absyn->reference)
+       if (node->u.root.absyn 
+            && oid_oidcmp(requested_schema, node->u.root.absyn->oid))
        {
        {
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
            nmem_destroy (mem);
            return 0;
        }
            nmem_destroy (mem);
            return 0;
        }
@@ -1214,7 +1200,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
     if (node->u.root.absyn)
         for (map = node->u.root.absyn->maptabs; map; map = map->next)
         {
     if (node->u.root.absyn)
         for (map = node->u.root.absyn->maptabs; map; map = map->next)
         {
-            if (map->target_absyn_ref == p->input_format)
+            if (!oid_oidcmp(map->oid, p->input_format))
             {
                 onode = node;
                 if (!(node = data1_map_record(p->dh, onode, map, mem)))
             {
                 onode = node;
                 if (!(node = data1_map_record(p->dh, onode, map, mem)))
@@ -1227,40 +1213,18 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
             }
         }
     yaz_log(YLOG_DEBUG, "grs_retrieve: schemaIdentifier");
             }
         }
     yaz_log(YLOG_DEBUG, "grs_retrieve: schemaIdentifier");
-    if (node->u.root.absyn &&
-       node->u.root.absyn->reference != VAL_NONE &&
-       p->input_format == VAL_GRS1)
+    if (node->u.root.absyn && node->u.root.absyn->oid 
+        && !oid_oidcmp(p->input_format, grs1_oid))
     {
     {
-       oident oe;
-       Odr_oid *oid;
-       int oidtmp[OID_SIZE];
-       
-       oe.proto = PROTO_Z3950;
-       oe.oclass = CLASS_SCHEMA;
-       oe.value = node->u.root.absyn->reference;
-       
-       if ((oid = oid_ent_to_oid (&oe, oidtmp)))
-       {
-           char tmp[128];
-           data1_handle dh = p->dh;
-           char *p = tmp;
-           int *ii;
-           
-           for (ii = oid; *ii >= 0; ii++)
-           {
-               if (p != tmp)
-                       *(p++) = '.';
-               sprintf(p, "%d", *ii);
-               p += strlen(p);
-           }
-           if ((dnew = data1_mk_tag_data_wd(dh, top, 
-                                             "schemaIdentifier", mem)))
-           {
-               dnew->u.data.what = DATA1I_oid;
-               dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
-               memcpy(dnew->u.data.data, tmp, p - tmp);
-               dnew->u.data.len = p - tmp;
-           }
+        char oid_str[OID_STR_MAX];
+        char *dot_str = oid_oid_to_dotstring(node->u.root.absyn->oid, oid_str);
+        
+        if (dot_str && (dnew = data1_mk_tag_data_wd(p->dh, top, 
+                                                    "schemaIdentifier", mem)))
+        {
+            dnew->u.data.what = DATA1I_oid;
+            dnew->u.data.data = (char *) nmem_strdup(mem, dot_str);
+            dnew->u.data.len = strlen(dot_str);
        }
     }
 
        }
     }
 
@@ -1279,10 +1243,12 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
     data1_pr_tree (p->dh, node, stdout);
 #endif
     yaz_log(YLOG_DEBUG, "grs_retrieve: transfer syntax mapping");
     data1_pr_tree (p->dh, node, stdout);
 #endif
     yaz_log(YLOG_DEBUG, "grs_retrieve: transfer syntax mapping");
-    switch (p->output_format = (p->input_format != VAL_NONE ?
-                               p->input_format : VAL_SUTRS))
+
+    p->output_format = p->input_format;
+
+    assert(p->input_format);
+    if (!oid_oidcmp(p->input_format, yaz_oid_xml()))
     {
     {
-    case VAL_TEXT_XML:
 #if 0
         data1_pr_tree (p->dh, node, stdout);
 #endif
 #if 0
         data1_pr_tree (p->dh, node, stdout);
 #endif
@@ -1293,97 +1259,103 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p,
 
        if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
                                              &p->rec_len)))
 
        if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
                                              &p->rec_len)))
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
-       break;
-    case VAL_GRS1:
+    }
+    else if (!oid_oidcmp(p->input_format, yaz_oid_grs1()))
+    {
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        dummy = 0;
        if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
                                          p->odr, &dummy)))
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        dummy = 0;
        if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
                                          p->odr, &dummy)))
-           p->diagnostic = 238; /* not available in requested syntax */
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
            p->rec_len = -1;
        else
            p->rec_len = -1;
-       break;
-    case VAL_EXPLAIN:
+    }
+    else if (!oid_oidcmp(p->input_format, yaz_oid_explain()))
+    {
        /* ensure our data1 tree is UTF-8 */
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        
        if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
                                               p->odr)))
        /* ensure our data1 tree is UTF-8 */
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        
        if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
                                               p->odr)))
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
            p->rec_len = -1;
        else
            p->rec_len = -1;
-       break;
-    case VAL_SUMMARY:
+    }
+    else if (!oid_oidcmp(p->input_format, yaz_oid_summary()))
+    {
        /* ensure our data1 tree is UTF-8 */
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
                                               p->odr)))
        /* ensure our data1 tree is UTF-8 */
        data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
                                               p->odr)))
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
            p->rec_len = -1;
        else
            p->rec_len = -1;
-       break;
-    case VAL_SUTRS:
+    }
+    else if (!oid_oidcmp(p->input_format, yaz_oid_sutrs()))
+    {
        if (p->encoding)
             data1_iconv (p->dh, mem, node, p->encoding,
                         data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
                                           &p->rec_len)))
        if (p->encoding)
             data1_iconv (p->dh, mem, node, p->encoding,
                         data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
                                           &p->rec_len)))
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
-       break;
-    case VAL_SOIF:
+    }
+    else if (!oid_oidcmp(p->input_format, yaz_oid_soif()))
+    {
        if (p->encoding)
             data1_iconv (p->dh, mem, node, p->encoding,
                         data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
                                            &p->rec_len)))
        if (p->encoding)
             data1_iconv (p->dh, mem, node, p->encoding,
                         data1_get_encoding(p->dh, node));
        if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
                                            &p->rec_len)))
-           p->diagnostic = 238;
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
        else
        {
            char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
            memcpy (new_buf, p->rec_buf, p->rec_len);
            p->rec_buf = new_buf;
        }
-       break;
-    default:
+    }
+    else
+    {
        if (!node->u.root.absyn)
        if (!node->u.root.absyn)
-       {
-           p->diagnostic = 238;
-           break;
-       }
-       for (marctab = node->u.root.absyn->marc; marctab;
-            marctab = marctab->next)
-           if (marctab->reference == p->input_format)
-               break;
-       if (!marctab)
-       {
-           p->diagnostic = 238;
-           break;
-       }
-       if (p->encoding)
-            data1_iconv (p->dh, mem, node, p->encoding,
-                        data1_get_encoding(p->dh, node));
-       if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
-                                       selected, &p->rec_len)))
-           p->diagnostic = 238;
-       else
-       {
-           char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
-           memcpy (new_buf, p->rec_buf, p->rec_len);
-               p->rec_buf = new_buf;
-       }
+           p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+        else
+        {
+            for (marctab = node->u.root.absyn->marc; marctab;
+                 marctab = marctab->next)
+                if (marctab->oid && !oid_oidcmp(marctab->oid, p->input_format))
+                    break;
+            if (!marctab)
+                p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+            else
+            {
+                if (p->encoding)
+                    data1_iconv (p->dh, mem, node, p->encoding,
+                                 data1_get_encoding(p->dh, node));
+                if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
+                                                    selected, &p->rec_len)))
+                    p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+                else
+                {
+                    char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
+                    memcpy (new_buf, p->rec_buf, p->rec_len);
+                    p->rec_buf = new_buf;
+                }
+            }
+        }
     }
     nmem_destroy(mem);
     return 0;
     }
     nmem_destroy(mem);
     return 0;
index b33a897..39a806e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rectext.c,v 1.4 2007-01-15 15:10:17 adam Exp $
+/* $Id: rectext.c,v 1.5 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <idzebra/util.h>
 #include <idzebra/recctrl.h>
 
 #include <idzebra/util.h>
 #include <idzebra/recctrl.h>
+#include <yaz/oid_db.h>
 
 struct filter_info {
     char *sep;
 
 struct filter_info {
     char *sep;
@@ -229,7 +230,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
             filter_ptr = p-filter_buf;
         }
     }
             filter_ptr = p-filter_buf;
         }
     }
-    p->output_format = VAL_SUTRS;
+    p->output_format = yaz_oid_sutrs();
     p->rec_buf = filter_buf;
     p->rec_len = filter_ptr; 
     return 0;
     p->rec_buf = filter_buf;
     p->rec_len = filter_ptr; 
     return 0;
index 2627998..1d4f4ab 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: retrieve.c,v 1.67 2007-03-19 21:50:39 adam Exp $
+/* $Id: retrieve.c,v 1.68 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "index.h"
 #include <yaz/diagbib1.h>
 #include <direntz.h>
 #include "index.h"
 #include <yaz/diagbib1.h>
 #include <direntz.h>
-
+#include <yaz/oid_db.h>
 
 #define ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\""
 
 
 #define ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\""
 
@@ -121,8 +121,8 @@ static int parse_zebra_elem(const char *elem,
 
 int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
                              const char *elemsetname,
 
 int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
                              const char *elemsetname,
-                             oid_value input_format,
-                             oid_value *output_format,
+                             const int *input_format,
+                             const int **output_format,
                              char **rec_bufp, int *rec_lenp)
 {
     const char *retrieval_index;
                              char **rec_bufp, int *rec_lenp)
 {
     const char *retrieval_index;
@@ -133,11 +133,12 @@ int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
     int ord;
 
     /* only accept XML and SUTRS requests */
     int ord;
 
     /* only accept XML and SUTRS requests */
-    if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+    if (oid_oidcmp(input_format, yaz_oid_xml()) 
+        && oid_oidcmp(input_format, yaz_oid_sutrs()))
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
-        *output_format = VAL_NONE;
+        *output_format = 0;
         return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
     }
     
         return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
     }
     
@@ -183,9 +184,9 @@ int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
         zebra_term_untrans(zh, index_type, dst_buf, str);
         
 
         zebra_term_untrans(zh, index_type, dst_buf, str);
         
 
-        if (input_format == VAL_TEXT_XML)
+        if (!oid_oidcmp(input_format, yaz_oid_xml()))
         {
         {
-            *output_format = VAL_TEXT_XML;
+            *output_format = yaz_oid_xml();
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\""
                          " set=\"zebra::index%s/\">\n",
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\""
                          " set=\"zebra::index%s/\">\n",
@@ -198,9 +199,9 @@ int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
             wrbuf_printf(wrbuf, "</index>\n");
             wrbuf_printf(wrbuf, "</record>\n");
         }
             wrbuf_printf(wrbuf, "</index>\n");
             wrbuf_printf(wrbuf, "</record>\n");
         }
-        else if (input_format == VAL_SUTRS)
+        else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
         {
         {
-            *output_format = VAL_SUTRS;
+            *output_format = yaz_oid_sutrs();
             
             wrbuf_printf(wrbuf, "%s %c %s\n", string_index, index_type,
                          dst_buf);
             
             wrbuf_printf(wrbuf, "%s %c %s\n", string_index, index_type,
                          dst_buf);
@@ -216,8 +217,8 @@ int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
 int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                               Record rec,
                               const char *elemsetname,
 int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                               Record rec,
                               const char *elemsetname,
-                              oid_value input_format,
-                              oid_value *output_format,
+                              const int *input_format,
+                              const int **output_format,
                               char **rec_bufp, int *rec_lenp)
 {
     const char *retrieval_index;
                               char **rec_bufp, int *rec_lenp)
 {
     const char *retrieval_index;
@@ -231,11 +232,12 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
     /* *rec_lenp = 0; */
 
     /* only accept XML and SUTRS requests */
     /* *rec_lenp = 0; */
 
     /* only accept XML and SUTRS requests */
-    if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+    if (oid_oidcmp(input_format, yaz_oid_xml())
+        && oid_oidcmp(input_format, yaz_oid_sutrs()))
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
-        *output_format = VAL_NONE;
+        *output_format = 0;
         return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
     }
 
         return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
     }
 
@@ -273,8 +275,7 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
 
     if (!zebra_rec_keys_rewind(keys))
     {
 
     if (!zebra_rec_keys_rewind(keys))
     {
-        ret_code = 
-            YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
+        ret_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
     }
     else
     {
     }
     else
     {
@@ -283,16 +284,16 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
         struct it_key key_in;
         WRBUF wrbuf = wrbuf_alloc();
     
         struct it_key key_in;
         WRBUF wrbuf = wrbuf_alloc();
     
-        if (input_format == VAL_TEXT_XML)
+        if (!oid_oidcmp(input_format, yaz_oid_xml()))
         {
         {
-            *output_format = VAL_TEXT_XML;
+            *output_format = input_format;
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\""
                          " set=\"zebra::index%s/\">\n",
                          sysno, elemsetname);
         }
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\""
                          " set=\"zebra::index%s/\">\n",
                          sysno, elemsetname);
         }
-        else if (input_format == VAL_SUTRS)
-            *output_format = VAL_SUTRS;
+        else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
+            *output_format = input_format;
 
         while (zebra_rec_keys_read(keys, &str, &slen, &key_in))
         {
 
         while (zebra_rec_keys_read(keys, &str, &slen, &key_in))
         {
@@ -323,7 +324,8 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                     zebra_term_untrans(zh, index_type, dst_buf, str);
                     if (strlen(dst_buf))
                     {
                     zebra_term_untrans(zh, index_type, dst_buf, str);
                     if (strlen(dst_buf))
                     {
-                        if (input_format == VAL_TEXT_XML){
+                        if (!oid_oidcmp(input_format, yaz_oid_xml()))
+                        {
                             wrbuf_printf(wrbuf, "  <index name=\"%s\"", 
                                          string_index);
                             
                             wrbuf_printf(wrbuf, "  <index name=\"%s\"", 
                                          string_index);
                             
@@ -335,7 +337,8 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                             wrbuf_xmlputs(wrbuf, dst_buf);
                             wrbuf_printf(wrbuf, "</index>\n");
                         }
                             wrbuf_xmlputs(wrbuf, dst_buf);
                             wrbuf_printf(wrbuf, "</index>\n");
                         }
-                        else if (input_format == VAL_SUTRS){
+                        else 
+                        {
                             wrbuf_printf(wrbuf, "%s ", string_index);
                             
                             wrbuf_printf(wrbuf, "%c", index_type);
                             wrbuf_printf(wrbuf, "%s ", string_index);
                             
                             wrbuf_printf(wrbuf, "%c", index_type);
@@ -343,8 +346,8 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                             for (i = 1; i < key_in.len; i++)
                                 wrbuf_printf(wrbuf, " " ZINT_FORMAT, 
                                              key_in.mem[i]);
                             for (i = 1; i < key_in.len; i++)
                                 wrbuf_printf(wrbuf, " " ZINT_FORMAT, 
                                              key_in.mem[i]);
-
-                        /* zebra_term_untrans(zh, index_type, dst_buf, str); */
+                            
+                            /* zebra_term_untrans(zh, index_type, dst_buf, str); */
                             wrbuf_printf(wrbuf, " %s", dst_buf);
                         
                             wrbuf_printf(wrbuf, "\n");
                             wrbuf_printf(wrbuf, " %s", dst_buf);
                         
                             wrbuf_printf(wrbuf, "\n");
@@ -354,7 +357,7 @@ int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
                 }
             }
         }
                 }
             }
         }
-        if (input_format == VAL_TEXT_XML)
+        if (!oid_oidcmp(input_format, yaz_oid_xml()))
             wrbuf_printf(wrbuf, "</record>\n");
         *rec_lenp = wrbuf_len(wrbuf);
         *rec_bufp = odr_malloc(odr, *rec_lenp);
             wrbuf_printf(wrbuf, "</record>\n");
         *rec_lenp = wrbuf_len(wrbuf);
         *rec_bufp = odr_malloc(odr, *rec_lenp);
@@ -397,10 +400,10 @@ static void retrieve_puts_int(WRBUF wrbuf, const char *name,
 }
 
 int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
 }
 
 int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
-                           const char *elemsetname,
-                           oid_value input_format,
-                           oid_value *output_format,
-                           char **rec_bufp, int *rec_lenp)
+                        const char *elemsetname,
+                        const int *input_format,
+                        const int **output_format,
+                        char **rec_bufp, int *rec_lenp)
 {
     Record rec;
     
 {
     Record rec;
     
@@ -414,17 +417,17 @@ int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
     {
         int ret = 0;
         WRBUF wrbuf = wrbuf_alloc();
     {
         int ret = 0;
         WRBUF wrbuf = wrbuf_alloc();
-        if (input_format == VAL_SUTRS)
+        if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
         {
             wrbuf_printf(wrbuf, ZINT_FORMAT, sysno);
         {
             wrbuf_printf(wrbuf, ZINT_FORMAT, sysno);
-            *output_format = VAL_SUTRS;
+            *output_format = input_format;
         } 
         } 
-        else if (input_format == VAL_TEXT_XML)
+        else if (!oid_oidcmp(input_format, yaz_oid_xml()))
         {
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\"/>\n",
                          sysno);
         {
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\"/>\n",
                          sysno);
-            *output_format = VAL_TEXT_XML;
+            *output_format = input_format;
         }
        *rec_lenp = wrbuf_len(wrbuf);
         if (*rec_lenp)
         }
        *rec_lenp = wrbuf_len(wrbuf);
         if (*rec_lenp)
@@ -472,7 +475,8 @@ int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
     }
 
     /* only accept XML and SUTRS requests from now */
     }
 
     /* only accept XML and SUTRS requests from now */
-    if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+    if (oid_oidcmp(input_format, yaz_oid_xml())
+        && oid_oidcmp(input_format, yaz_oid_sutrs()))
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
     {
         yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s", 
                 elemsetname);
@@ -487,9 +491,9 @@ int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
         WRBUF wrbuf = wrbuf_alloc();
         RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec); 
 
         WRBUF wrbuf = wrbuf_alloc();
         RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec); 
 
-        if (input_format == VAL_TEXT_XML)
+        if (!oid_oidcmp(input_format, yaz_oid_xml()))
         {
         {
-            *output_format = VAL_TEXT_XML;
+            *output_format = input_format;
             
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\"", sysno);
             
             wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
                          " sysno=\"" ZINT_FORMAT "\"", sysno);
@@ -507,9 +511,9 @@ int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
                          recordAttr->recordSize,
                          elemsetname);
         }
                          recordAttr->recordSize,
                          elemsetname);
         }
-        else if (input_format == VAL_SUTRS)
+        else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
         {
         {
-            *output_format = VAL_SUTRS;
+            *output_format = input_format;
             wrbuf_printf(wrbuf, "sysno " ZINT_FORMAT "\n", sysno);
             retrieve_puts_str(wrbuf, "base", rec->info[recInfo_databaseName]);
             retrieve_puts_str(wrbuf, "file", rec->info[recInfo_filename]);
             wrbuf_printf(wrbuf, "sysno " ZINT_FORMAT "\n", sysno);
             retrieve_puts_str(wrbuf, "base", rec->info[recInfo_databaseName]);
             retrieve_puts_str(wrbuf, "file", rec->info[recInfo_filename]);
@@ -556,8 +560,8 @@ int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
                           
 int zebra_record_fetch(ZebraHandle zh, zint sysno, int score,
                        zebra_snippets *hit_snippet, ODR odr,
                           
 int zebra_record_fetch(ZebraHandle zh, zint sysno, int score,
                        zebra_snippets *hit_snippet, ODR odr,
-                       oid_value input_format, Z_RecordComposition *comp,
-                       oid_value *output_format,
+                       const int *input_format, Z_RecordComposition *comp,
+                       const int **output_format,
                        char **rec_bufp, int *rec_lenp, char **basenamep,
                        char **addinfo)
 {
                        char **rec_bufp, int *rec_lenp, char **basenamep,
                        char **addinfo)
 {
index 1e54721..be4e765 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rpnscan.c,v 1.6 2007-03-19 21:50:39 adam Exp $
+/* $Id: rpnscan.c,v 1.7 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <attrfind.h>
 #include <charmap.h>
 #include <rset.h>
 #include <attrfind.h>
 #include <charmap.h>
 #include <rset.h>
+#include <yaz/oid_db.h>
 
 #define RPN_MAX_ORDS 32
 
 
 #define RPN_MAX_ORDS 32
 
@@ -376,7 +377,7 @@ struct scan_info {
 };
 
 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
 };
 
 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                  oid_value attributeset,
+                  const int *attributeset,
                   int num_bases, char **basenames,
                   int *position, int *num_entries, ZebraScanEntry **list,
                   int *is_partial, RSET limit_set)
                   int num_bases, char **basenames,
                   int *position, int *num_entries, ZebraScanEntry **list,
                   int *is_partial, RSET limit_set)
@@ -396,8 +397,8 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
     *list = 0;
     *is_partial = 0;
 
     *list = 0;
     *is_partial = 0;
 
-    if (attributeset == VAL_NONE)
-        attributeset = VAL_BIB1;
+    if (!attributeset)
+        attributeset = yaz_oid_attset_bib1();
 
     if (!limit_set) /* no limit set given already */
     {
 
     if (!limit_set) /* no limit set given already */
     {
@@ -426,8 +427,8 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
         }
     }
         
         }
     }
         
-    yaz_log(YLOG_DEBUG, "position = %d, num = %d set=%d",
-           *position, *num_entries, attributeset);
+    yaz_log(YLOG_DEBUG, "position = %d, num = %d",
+           *position, *num_entries);
         
     if (zebra_maps_attr(zh->reg->zebra_maps, zapt, &index_type, &search_type,
                        rank_type, &complete_flag, &sort_flag))
         
     if (zebra_maps_attr(zh->reg->zebra_maps, zapt, &index_type, &search_type,
                        rank_type, &complete_flag, &sort_flag))
index aaae58a..28a6670 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rpnsearch.c,v 1.10 2007-03-19 21:50:39 adam Exp $
+/* $Id: rpnsearch.c,v 1.11 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -703,7 +703,7 @@ void string_rel_add_char(char **term_p, const char *src, int *indx)
  */
 static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                           const char **term_sub, char *term_dict,
  */
 static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                           const char **term_sub, char *term_dict,
-                          oid_value attributeSet,
+                          const int *attributeSet,
                           int reg_type, int space_split, char *term_dst,
                           int *error_code)
 {
                           int reg_type, int space_split, char *term_dst,
                           int *error_code)
 {
@@ -897,7 +897,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 
 static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                             const char **term_sub, 
 
 static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                             const char **term_sub, 
-                            oid_value attributeSet, NMEM stream,
+                            const int *attributeSet, NMEM stream,
                             struct grep_info *grep_info,
                             int reg_type, int complete_flag,
                             int num_bases, char **basenames,
                             struct grep_info *grep_info,
                             int reg_type, int complete_flag,
                             int num_bases, char **basenames,
@@ -955,7 +955,7 @@ static ZEBRA_RES term_limits_APT(ZebraHandle zh,
 static ZEBRA_RES term_trunc(ZebraHandle zh,
                            Z_AttributesPlusTerm *zapt,
                            const char **term_sub, 
 static ZEBRA_RES term_trunc(ZebraHandle zh,
                            Z_AttributesPlusTerm *zapt,
                            const char **term_sub, 
-                           oid_value attributeSet, NMEM stream,
+                           const int *attributeSet, NMEM stream,
                            struct grep_info *grep_info,
                            int reg_type, int complete_flag,
                            int num_bases, char **basenames,
                            struct grep_info *grep_info,
                            int reg_type, int complete_flag,
                            int num_bases, char **basenames,
@@ -995,7 +995,7 @@ static ZEBRA_RES term_trunc(ZebraHandle zh,
 
 static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                             const char **term_sub, 
 
 static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                             const char **term_sub, 
-                            oid_value attributeSet, NMEM stream,
+                            const int *attributeSet, NMEM stream,
                             struct grep_info *grep_info,
                             int reg_type, int complete_flag,
                             int num_bases, char **basenames,
                             struct grep_info *grep_info,
                             int reg_type, int complete_flag,
                             int num_bases, char **basenames,
@@ -1288,7 +1288,7 @@ static ZEBRA_RES grep_info_prepare(ZebraHandle zh,
 static ZEBRA_RES term_list_trunc(ZebraHandle zh,
                                 Z_AttributesPlusTerm *zapt,
                                 const char *termz,
 static ZEBRA_RES term_list_trunc(ZebraHandle zh,
                                 Z_AttributesPlusTerm *zapt,
                                 const char *termz,
-                                oid_value attributeSet,
+                                const int *attributeSet,
                                 NMEM stream,
                                 int reg_type, int complete_flag,
                                 const char *rank_type,
                                 NMEM stream,
                                 int reg_type, int complete_flag,
                                 const char *rank_type,
@@ -1350,7 +1350,7 @@ static ZEBRA_RES term_list_trunc(ZebraHandle zh,
 
 static ZEBRA_RES rpn_search_APT_position(ZebraHandle zh,
                                          Z_AttributesPlusTerm *zapt,
 
 static ZEBRA_RES rpn_search_APT_position(ZebraHandle zh,
                                          Z_AttributesPlusTerm *zapt,
-                                         oid_value attributeSet,
+                                         const int *attributeSet,
                                          int reg_type,
                                          int num_bases, char **basenames,
                                          NMEM rset_nmem,
                                          int reg_type,
                                          int num_bases, char **basenames,
                                          NMEM rset_nmem,
@@ -1442,7 +1442,7 @@ static ZEBRA_RES rpn_search_APT_position(ZebraHandle zh,
 static ZEBRA_RES rpn_search_APT_phrase(ZebraHandle zh,
                                       Z_AttributesPlusTerm *zapt,
                                       const char *termz_org,
 static ZEBRA_RES rpn_search_APT_phrase(ZebraHandle zh,
                                       Z_AttributesPlusTerm *zapt,
                                       const char *termz_org,
-                                      oid_value attributeSet,
+                                      const int *attributeSet,
                                       NMEM stream,
                                       int reg_type, int complete_flag,
                                       const char *rank_type,
                                       NMEM stream,
                                       int reg_type, int complete_flag,
                                       const char *rank_type,
@@ -1502,7 +1502,7 @@ static ZEBRA_RES rpn_search_APT_phrase(ZebraHandle zh,
 static ZEBRA_RES rpn_search_APT_or_list(ZebraHandle zh,
                                        Z_AttributesPlusTerm *zapt,
                                        const char *termz_org,
 static ZEBRA_RES rpn_search_APT_or_list(ZebraHandle zh,
                                        Z_AttributesPlusTerm *zapt,
                                        const char *termz_org,
-                                       oid_value attributeSet,
+                                       const int *attributeSet,
                                        NMEM stream,
                                        int reg_type, int complete_flag,
                                        const char *rank_type,
                                        NMEM stream,
                                        int reg_type, int complete_flag,
                                        const char *rank_type,
@@ -1569,7 +1569,7 @@ static ZEBRA_RES rpn_search_APT_or_list(ZebraHandle zh,
 static ZEBRA_RES rpn_search_APT_and_list(ZebraHandle zh,
                                         Z_AttributesPlusTerm *zapt,
                                         const char *termz_org,
 static ZEBRA_RES rpn_search_APT_and_list(ZebraHandle zh,
                                         Z_AttributesPlusTerm *zapt,
                                         const char *termz_org,
-                                        oid_value attributeSet,
+                                        const int *attributeSet,
                                         NMEM stream,
                                         int reg_type, int complete_flag,
                                         const char *rank_type, 
                                         NMEM stream,
                                         int reg_type, int complete_flag,
                                         const char *rank_type, 
@@ -1638,7 +1638,7 @@ static ZEBRA_RES rpn_search_APT_and_list(ZebraHandle zh,
 static int numeric_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                            const char **term_sub,
                            char *term_dict,
 static int numeric_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                            const char **term_sub,
                            char *term_dict,
-                           oid_value attributeSet,
+                           const int *attributeSet,
                            struct grep_info *grep_info,
                            int *max_pos,
                            int reg_type,
                            struct grep_info *grep_info,
                            int *max_pos,
                            int reg_type,
@@ -1723,7 +1723,7 @@ static int numeric_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 
 static ZEBRA_RES numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                              const char **term_sub, 
 
 static ZEBRA_RES numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                              const char **term_sub, 
-                             oid_value attributeSet, NMEM stream,
+                             const int *attributeSet, NMEM stream,
                              struct grep_info *grep_info,
                              int reg_type, int complete_flag,
                              int num_bases, char **basenames,
                              struct grep_info *grep_info,
                              int reg_type, int complete_flag,
                              int num_bases, char **basenames,
@@ -1800,7 +1800,7 @@ static ZEBRA_RES numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 static ZEBRA_RES rpn_search_APT_numeric(ZebraHandle zh,
                                        Z_AttributesPlusTerm *zapt,
                                        const char *termz,
 static ZEBRA_RES rpn_search_APT_numeric(ZebraHandle zh,
                                        Z_AttributesPlusTerm *zapt,
                                        const char *termz,
-                                       oid_value attributeSet,
+                                       const int *attributeSet,
                                        NMEM stream,
                                        int reg_type, int complete_flag,
                                        const char *rank_type, 
                                        NMEM stream,
                                        int reg_type, int complete_flag,
                                        const char *rank_type, 
@@ -1880,7 +1880,7 @@ static ZEBRA_RES rpn_search_APT_numeric(ZebraHandle zh,
 static ZEBRA_RES rpn_search_APT_local(ZebraHandle zh,
                                      Z_AttributesPlusTerm *zapt,
                                      const char *termz,
 static ZEBRA_RES rpn_search_APT_local(ZebraHandle zh,
                                      Z_AttributesPlusTerm *zapt,
                                      const char *termz,
-                                     oid_value attributeSet,
+                                     const int *attributeSet,
                                      NMEM stream,
                                      const char *rank_type, NMEM rset_nmem,
                                      RSET *rset,
                                      NMEM stream,
                                      const char *rank_type, NMEM rset_nmem,
                                      RSET *rset,
@@ -1919,7 +1919,7 @@ static ZEBRA_RES rpn_search_APT_local(ZebraHandle zh,
 }
 
 static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 }
 
 static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
-                              oid_value attributeSet, NMEM stream,
+                              const int *attributeSet, NMEM stream,
                               Z_SortKeySpecList *sort_sequence,
                               const char *rank_type,
                               NMEM rset_nmem,
                               Z_SortKeySpecList *sort_sequence,
                               const char *rank_type,
                               NMEM rset_nmem,
@@ -1931,8 +1931,6 @@ static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
     AttrType sort_relation_type;
     Z_SortKeySpec *sks;
     Z_SortKey *sk;
     AttrType sort_relation_type;
     Z_SortKeySpec *sks;
     Z_SortKey *sk;
-    int oid[OID_SIZE];
-    oident oe;
     char termz[20];
     
     attr_init_APT(&sort_relation_type, zapt, 7);
     char termz[20];
     
     attr_init_APT(&sort_relation_type, zapt, 7);
@@ -1956,12 +1954,6 @@ static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
         i = 0;
     sprintf(termz, "%d", i);
 
         i = 0;
     sprintf(termz, "%d", i);
 
-    oe.proto = PROTO_Z3950;
-    oe.oclass = CLASS_ATTSET;
-    oe.value = attributeSet;
-    if (!oid_ent_to_oid (&oe, oid))
-        return ZEBRA_FAIL;
-
     sks = (Z_SortKeySpec *) nmem_malloc(stream, sizeof(*sks));
     sks->sortElement = (Z_SortElement *)
         nmem_malloc(stream, sizeof(*sks->sortElement));
     sks = (Z_SortKeySpec *) nmem_malloc(stream, sizeof(*sks));
     sks->sortElement = (Z_SortElement *)
         nmem_malloc(stream, sizeof(*sks->sortElement));
@@ -1972,7 +1964,7 @@ static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
     sk->u.sortAttributes = (Z_SortAttributes *)
         nmem_malloc(stream, sizeof(*sk->u.sortAttributes));
 
     sk->u.sortAttributes = (Z_SortAttributes *)
         nmem_malloc(stream, sizeof(*sk->u.sortAttributes));
 
-    sk->u.sortAttributes->id = oid;
+    sk->u.sortAttributes->id = odr_oiddup_nmem(stream, attributeSet);
     sk->u.sortAttributes->list = zapt->attributes;
 
     sks->sortRelation = (int *)
     sk->u.sortAttributes->list = zapt->attributes;
 
     sks->sortRelation = (int *)
@@ -1997,11 +1989,11 @@ static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 
 
 static int rpn_check_xpath(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 
 
 static int rpn_check_xpath(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
-                           oid_value attributeSet,
+                           const int *attributeSet,
                            struct xpath_location_step *xpath, int max,
                            NMEM mem)
 {
                            struct xpath_location_step *xpath, int max,
                            NMEM mem)
 {
-    oid_value curAttributeSet = attributeSet;
+    const int *curAttributeSet = attributeSet;
     AttrType use;
     const char *use_string = 0;
     
     AttrType use;
     const char *use_string = 0;
     
@@ -2221,7 +2213,7 @@ ZEBRA_RES rpn_search_xpath(ZebraHandle zh,
 #define MAX_XPATH_STEPS 10
 
 static ZEBRA_RES rpn_search_APT(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 #define MAX_XPATH_STEPS 10
 
 static ZEBRA_RES rpn_search_APT(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
-                               oid_value attributeSet, NMEM stream,
+                               const int *attributeSet, NMEM stream,
                                Z_SortKeySpecList *sort_sequence,
                                int num_bases, char **basenames, 
                                NMEM rset_nmem,
                                Z_SortKeySpecList *sort_sequence,
                                int num_bases, char **basenames, 
                                NMEM rset_nmem,
@@ -2346,7 +2338,7 @@ static ZEBRA_RES rpn_search_APT(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
 }
 
 static ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
 }
 
 static ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
-                                     oid_value attributeSet, 
+                                     const int *attributeSet, 
                                      NMEM stream, NMEM rset_nmem,
                                      Z_SortKeySpecList *sort_sequence,
                                      int num_bases, char **basenames,
                                      NMEM stream, NMEM rset_nmem,
                                      Z_SortKeySpecList *sort_sequence,
                                      int num_bases, char **basenames,
@@ -2386,7 +2378,7 @@ ZEBRA_RES rpn_get_top_approx_limit(ZebraHandle zh, Z_RPNStructure *zs,
 }
 
 ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
 }
 
 ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
-                        oid_value attributeSet, 
+                        const int *attributeSet, 
                         NMEM stream, NMEM rset_nmem,
                         Z_SortKeySpecList *sort_sequence,
                         int num_bases, char **basenames,
                         NMEM stream, NMEM rset_nmem,
                         Z_SortKeySpecList *sort_sequence,
                         int num_bases, char **basenames,
@@ -2423,7 +2415,7 @@ ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
 }
 
 ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
 }
 
 ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
-                              oid_value attributeSet, 
+                              const int *attributeSet, 
                               NMEM stream, NMEM rset_nmem,
                               Z_SortKeySpecList *sort_sequence,
                               int num_bases, char **basenames,
                               NMEM stream, NMEM rset_nmem,
                               Z_SortKeySpecList *sort_sequence,
                               int num_bases, char **basenames,
index 96c2592..41cad30 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: safari.c,v 1.5 2007-01-15 15:10:17 adam Exp $
+/* $Id: safari.c,v 1.6 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
 
 */
 
-
+#include <yaz/oid_db.h>
 #include <stdio.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <assert.h>
 #include <ctype.h>
@@ -262,7 +262,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
             filter_ptr = p-filter_buf;
         }
     }
             filter_ptr = p-filter_buf;
         }
     }
-    p->output_format = VAL_SUTRS;
+    p->output_format = yaz_oid_sutrs();
     p->rec_buf = filter_buf;
     p->rec_len = filter_ptr; 
     return 0;
     p->rec_buf = filter_buf;
     p->rec_len = filter_ptr; 
     return 0;
index a1bb61d..825ccad 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.252 2007-03-19 21:50:39 adam Exp $
+/* $Id: zebraapi.c,v 1.253 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "orddict.h"
 #include <charmap.h>
 #include <idzebra/api.h>
 #include "orddict.h"
 #include <charmap.h>
 #include <idzebra/api.h>
+#include <yaz/oid_db.h>
 
 #define DEFAULT_APPROX_LIMIT 2000000000
 
 
 #define DEFAULT_APPROX_LIMIT 2000000000
 
@@ -1075,7 +1076,7 @@ ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
 ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                                 const char *setname,
                                 Z_RecordComposition *comp,
 ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                                 const char *setname,
                                 Z_RecordComposition *comp,
-                                oid_value input_format, int num_recs,
+                                const int *input_format, int num_recs,
                                 ZebraRetrievalRecord *recs)
 {
     ZebraMetaRecord *poset;
                                 ZebraRetrievalRecord *recs)
 {
     ZebraMetaRecord *poset;
@@ -1119,7 +1120,7 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
            if (poset[i].term)
            {
                recs[i].errCode = 0;
            if (poset[i].term)
            {
                recs[i].errCode = 0;
-               recs[i].format = VAL_SUTRS;
+               recs[i].format = yaz_oid_sutrs();
                recs[i].len = strlen(poset[i].term);
                recs[i].buf = poset[i].term;
                recs[i].base = poset[i].db;
                recs[i].len = strlen(poset[i].term);
                recs[i].buf = poset[i].term;
                recs[i].base = poset[i].db;
@@ -1169,7 +1170,7 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                recs[i].buf = 0;  /* no record and no error issued */
                recs[i].len = 0;
                recs[i].errCode = 0;
                recs[i].buf = 0;  /* no record and no error issued */
                recs[i].len = 0;
                recs[i].errCode = 0;
-               recs[i].format = VAL_NONE;
+               recs[i].format = 0;
                recs[i].sysno = 0;
            }
        }
                recs[i].sysno = 0;
            }
        }
@@ -1197,15 +1198,17 @@ ZEBRA_RES zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
        zh->errCode = YAZ_BIB1_SCAN_MALFORMED_SCAN;
     }
     else
        zh->errCode = YAZ_BIB1_SCAN_MALFORMED_SCAN;
     }
     else
-       res = zebra_scan(zh, stream, zapt, VAL_BIB1,
+    {
+       res = zebra_scan(zh, stream, zapt, yaz_oid_attset_bib1(),
                         position, num_entries, entries, is_partial,
                         setname);
                         position, num_entries, entries, is_partial,
                         setname);
+    }
     yaz_pqf_destroy (pqf_parser);
     return res;
 }
 
 ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
     yaz_pqf_destroy (pqf_parser);
     return res;
 }
 
 ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                    oid_value attributeset,
+                    const int *attributeset,
                     int *position,
                     int *num_entries, ZebraScanEntry **entries,
                     int *is_partial,
                     int *position,
                     int *num_entries, ZebraScanEntry **entries,
                     int *is_partial,
@@ -2280,7 +2283,7 @@ ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
 
     yaz_log(log_level, "zebra_search_PQF s=%s q=%s", setname, pqf_query);
     
 
     yaz_log(log_level, "zebra_search_PQF s=%s q=%s", setname, pqf_query);
     
-    query = p_query_rpn (odr, PROTO_Z3950, pqf_query);
+    query = p_query_rpn(odr, pqf_query);
     
     if (!query)
     {
     
     if (!query)
     {
index 333b378..f726883 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebrash.c,v 1.44 2007-03-19 21:50:39 adam Exp $
+/* $Id: zebrash.c,v 1.45 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/sortspec.h>
 #include <yaz/options.h>
 #include <yaz/wrbuf.h>
 #include <yaz/sortspec.h>
 #include <yaz/options.h>
 #include <yaz/wrbuf.h>
+#include <yaz/oid_db.h>
 
 #define MAX_NO_ARGS 32
 #define MAX_OUT_BUFF 4096
 
 #define MAX_NO_ARGS 32
 #define MAX_OUT_BUFF 4096
@@ -440,17 +441,16 @@ static int cmd_show( char *args[], WRBUF outbuff)
     ODR odr;
     Z_RecordComposition *pcomp=0;
     int i;
     ODR odr;
     Z_RecordComposition *pcomp=0;
     int i;
-    oid_value format;
 
 
-    odr=odr_createmem(ODR_ENCODE);
+    odr = odr_createmem(ODR_ENCODE);
     recs= odr_malloc(odr,sizeof(ZebraRetrievalRecord)*nrecs);
     rc =z_RecordComposition(odr, &pcomp, 0,"recordComposition");
     recs= odr_malloc(odr,sizeof(ZebraRetrievalRecord)*nrecs);
     rc =z_RecordComposition(odr, &pcomp, 0,"recordComposition");
-    format=oid_getvalbyname ("xml"); /*FIXME - let the user specify*/
+
     for (i=0;i<nrecs;i++)
         recs[i].position=start+i;
 
     rc = zebra_records_retrieve (zh, odr, setname,
     for (i=0;i<nrecs;i++)
         recs[i].position=start+i;
 
     rc = zebra_records_retrieve (zh, odr, setname,
-                                pcomp, format, nrecs,recs);
+                                pcomp, yaz_oid_xml(), nrecs,recs);
     if (0==rc)
     {
         for (i=0;i<nrecs;i++)
     if (0==rc)
     {
         for (i=0;i<nrecs;i++)
index cf3a4db..dbb44ad 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebrasrv.c,v 1.12 2007-03-14 11:48:32 adam Exp $
+/* $Id: zebrasrv.c,v 1.13 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -197,8 +197,7 @@ static void search_terms(ZebraHandle zh, bend_search_rr *r)
     r->search_info->list[0]->which = Z_OtherInfo_externallyDefinedInfo;
     ext = odr_malloc (r->stream, sizeof(*ext));
     r->search_info->list[0]->information.externallyDefinedInfo = ext;
     r->search_info->list[0]->which = Z_OtherInfo_externallyDefinedInfo;
     ext = odr_malloc (r->stream, sizeof(*ext));
     r->search_info->list[0]->information.externallyDefinedInfo = ext;
-    ext->direct_reference =
-        yaz_oidval_to_z3950oid (r->stream, CLASS_USERINFO, VAL_SEARCHRES1);
+    ext->direct_reference = odr_oiddup(r->stream, yaz_oid_search_result_1());
     ext->indirect_reference = 0;
     ext->descriptor = 0;
     ext->which = Z_External_searchResult1;
     ext->indirect_reference = 0;
     ext->descriptor = 0;
     ext->which = Z_External_searchResult1;
@@ -314,7 +313,7 @@ int bend_search(void *handle, bend_search_rr *r)
 }
 
 
 }
 
 
-int bend_fetch (void *handle, bend_fetch_rr *r)
+int bend_fetch(void *handle, bend_fetch_rr *r)
 {
     ZebraHandle zh = (ZebraHandle) handle;
     ZebraRetrievalRecord retrievalRecord;
 {
     ZebraHandle zh = (ZebraHandle) handle;
     ZebraRetrievalRecord retrievalRecord;
@@ -343,7 +342,7 @@ int bend_fetch (void *handle, bend_fetch_rr *r)
        r->basename = retrievalRecord.base;
        r->record = retrievalRecord.buf;
        r->len = retrievalRecord.len;
        r->basename = retrievalRecord.base;
        r->record = retrievalRecord.buf;
        r->len = retrievalRecord.len;
-       r->output_format = retrievalRecord.format;
+       r->output_format = odr_oiddup(r->stream, retrievalRecord.format);
     }
     return 0;
 }
     }
     return 0;
 }
@@ -596,7 +595,6 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr)
                for (i = 0; notToKeep && i < notToKeep->num; i++)
                {
                    Z_External *rec = notToKeep->elements[i]->record;
                for (i = 0; notToKeep && i < notToKeep->num; i++)
                {
                    Z_External *rec = notToKeep->elements[i]->record;
-                    struct oident *oident = 0;
                     Odr_oct *opaque_recid = 0;
                    zint *sysno = 0;
                    zint sysno_tmp;
                     Odr_oct *opaque_recid = 0;
                    zint *sysno = 0;
                    zint sysno_tmp;
@@ -616,10 +614,14 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr)
                     }
                    if (rec->direct_reference)
                    {
                     }
                    if (rec->direct_reference)
                    {
-                       oident = oid_getentbyoid(rec->direct_reference);
-                       if (oident)
+                        char oid_name_str[OID_STR_MAX];
+                        const char *oid_name =
+                            yaz_oid_to_string_buf(
+                                rec->direct_reference,
+                                0, oid_name_str);
+                        if (oid_name)
                            yaz_log (YLOG_LOG, "record %d type %s", i,
                            yaz_log (YLOG_LOG, "record %d type %s", i,
-                                    oident->desc);
+                                     oid_name);
                    }
                    switch (rec->which)
                    {
                    }
                    switch (rec->which)
                    {
@@ -643,13 +645,6 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr)
                                     rec->u.octet_aligned->len,
                                     rec->u.octet_aligned->buf);
                    }
                                     rec->u.octet_aligned->len,
                                     rec->u.octet_aligned->buf);
                    }
-                    if (oident && oident->value != VAL_TEXT_XML 
-                        && oident->value != VAL_SUTRS)
-                    {
-                        rr->errcode = YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
-                        rr->errstring = "only XML update supported";
-                        break;
-                    }
                     if (rec->which == Z_External_octet)
                     {
                         enum zebra_recctrl_action_t action = action_update;
                     if (rec->which == Z_External_octet)
                     {
                         enum zebra_recctrl_action_t action = action_update;
index 9086b6c..d678e67 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zinfo.c,v 1.77 2007-02-24 16:47:16 adam Exp $
+/* $Id: zinfo.c,v 1.78 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -252,7 +252,7 @@ void zebraExplain_mergeOids (ZebraExplainInfo zei, data1_node *n,
        if (!ao)
        {
            ao = (zebAccessObject) nmem_malloc(zei->nmem, sizeof(*ao));
        if (!ao)
        {
            ao = (zebAccessObject) nmem_malloc(zei->nmem, sizeof(*ao));
-           ao->handle = NULL;
+           ao->handle = 0;
            ao->sysno = 1;
            ao->oid = oid;
            ao->next = *op;
            ao->sysno = 1;
            ao->oid = oid;
            ao->next = *op;
@@ -270,8 +270,8 @@ void zebraExplain_mergeAccessInfo(ZebraExplainInfo zei, data1_node *n,
     {
        *accessInfo = (zebAccessInfo)
            nmem_malloc(zei->nmem, sizeof(**accessInfo));
     {
        *accessInfo = (zebAccessInfo)
            nmem_malloc(zei->nmem, sizeof(**accessInfo));
-       (*accessInfo)->attributeSetIds = NULL;
-       (*accessInfo)->schemas = NULL;
+       (*accessInfo)->attributeSetIds = 0;
+       (*accessInfo)->schemas = 0;
     }
     else
     {
     }
     else
     {
@@ -356,20 +356,20 @@ ZebraExplainInfo zebraExplain_open(
     zei->updateFunc = updateFunc;
     zei->dirty = 0;
     zei->ordinalDatabase = 1;
     zei->updateFunc = updateFunc;
     zei->dirty = 0;
     zei->ordinalDatabase = 1;
-    zei->curDatabaseInfo = NULL;
+    zei->curDatabaseInfo = 0;
     zei->records = records;
     zei->nmem = nmem;
     zei->dh = dh;
     
     data1_get_absyn (zei->dh, "explain", DATA1_XPATH_INDEXING_DISABLE);
 
     zei->records = records;
     zei->nmem = nmem;
     zei->dh = dh;
     
     data1_get_absyn (zei->dh, "explain", DATA1_XPATH_INDEXING_DISABLE);
 
-    zei->attsets = NULL;
+    zei->attsets = 0;
     zei->res = res;
     zei->categoryList = (struct zebraCategoryListInfo *)
        nmem_malloc(zei->nmem, sizeof(*zei->categoryList));
     zei->categoryList->sysno = 0;
     zei->categoryList->dirty = 0;
     zei->res = res;
     zei->categoryList = (struct zebraCategoryListInfo *)
        nmem_malloc(zei->nmem, sizeof(*zei->categoryList));
     zei->categoryList->sysno = 0;
     zei->categoryList->dirty = 0;
-    zei->categoryList->data1_categoryList = NULL;
+    zei->categoryList->data1_categoryList = 0;
 
     if ( atoi(res_get_def(res, "notimestamps", "0") )== 0)
     {
 
     if ( atoi(res_get_def(res, "notimestamps", "0") )== 0)
     {
@@ -436,9 +436,9 @@ ZebraExplainInfo zebraExplain_open(
        }
        for(; np; np = np->next)
        {
        }
        for(; np; np = np->next)
        {
-           data1_node *node_name = NULL;
-           data1_node *node_id = NULL;
-           data1_node *node_aid = NULL;
+           data1_node *node_name = 0;
+           data1_node *node_id = 0;
+           data1_node *node_aid = 0;
            data1_node *np2;
            if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "database"))
                continue;
            data1_node *np2;
            if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "database"))
                continue;
@@ -459,7 +459,7 @@ ZebraExplainInfo zebraExplain_open(
                nmem_malloc(zei->nmem, sizeof(**zdip));
             (*zdip)->readFlag = 1;
             (*zdip)->dirty = 0;
                nmem_malloc(zei->nmem, sizeof(**zdip));
             (*zdip)->readFlag = 1;
             (*zdip)->dirty = 0;
-           (*zdip)->data1_database = NULL;
+           (*zdip)->data1_database = 0;
            (*zdip)->recordCount = 0;
            (*zdip)->recordBytes = 0;
            zebraExplain_mergeAccessInfo (zei, 0, &(*zdip)->accessInfo);
            (*zdip)->recordCount = 0;
            (*zdip)->recordBytes = 0;
            zebraExplain_mergeAccessInfo (zei, 0, &(*zdip)->accessInfo);
@@ -477,7 +477,7 @@ ZebraExplainInfo zebraExplain_open(
                                                        node_aid->u.data.len);
            (*zdip)->attributeDetails->readFlag = 1;
            (*zdip)->attributeDetails->dirty = 0;
                                                        node_aid->u.data.len);
            (*zdip)->attributeDetails->readFlag = 1;
            (*zdip)->attributeDetails->dirty = 0;
-           (*zdip)->attributeDetails->SUInfo = NULL;
+           (*zdip)->attributeDetails->SUInfo = 0;
 
            zdip = &(*zdip)->next;
        }
 
            zdip = &(*zdip)->next;
        }
@@ -501,7 +501,7 @@ ZebraExplainInfo zebraExplain_open(
            assert (np && np->which == DATA1N_data);
            zei->runNumber = atoi_zn(np->u.data.data, np->u.data.len);
             yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
            assert (np && np->which == DATA1N_data);
            zei->runNumber = atoi_zn(np->u.data.data, np->u.data.len);
             yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
-           *zdip = NULL;
+           *zdip = 0;
        }
        rec_free(&trec);
     }
        }
        rec_free(&trec);
     }
@@ -509,7 +509,7 @@ ZebraExplainInfo zebraExplain_open(
     {
        data1_node *node_tgtinfo;
 
     {
        data1_node *node_tgtinfo;
 
-       *zdip = NULL;
+       *zdip = 0;
        if (writeFlag)
        {
            char *sgml_buf;
        if (writeFlag)
        {
            char *sgml_buf;
@@ -603,12 +603,12 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei,
                                  "attrlist");
     for (np = node_list->child; np; np = np->next)
     {
                                  "attrlist");
     for (np = node_list->child; np; np = np->next)
     {
-       data1_node *node_str = NULL;
-       data1_node *node_ordinal = NULL;
-       data1_node *node_type = NULL;
-       data1_node *node_cat = NULL;
-        data1_node *node_doc_occurrences = NULL;
-        data1_node *node_term_occurrences = NULL;
+       data1_node *node_str = 0;
+       data1_node *node_ordinal = 0;
+       data1_node *node_type = 0;
+       data1_node *node_cat = 0;
+        data1_node *node_doc_occurrences = 0;
+        data1_node *node_term_occurrences = 0;
        data1_node *np2;
 
        if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "attr"))
        data1_node *np2;
 
        if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "attr"))
@@ -703,7 +703,7 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei,
                                         node_ordinal->u.data.len);
         zsuip = &(*zsuip)->next;
     }
                                         node_ordinal->u.data.len);
         zsuip = &(*zsuip)->next;
     }
-    *zsuip = NULL;
+    *zsuip = 0;
     zad->readFlag = 0;
     rec_free(&rec);
 }
     zad->readFlag = 0;
     rec_free(&rec);
 }
@@ -963,7 +963,7 @@ int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database,
     zdi->attributeDetails->readFlag = 0;
     zdi->attributeDetails->sysno = 0;
     zdi->attributeDetails->dirty = 1;
     zdi->attributeDetails->readFlag = 0;
     zdi->attributeDetails->sysno = 0;
     zdi->attributeDetails->dirty = 1;
-    zdi->attributeDetails->SUInfo = NULL;
+    zdi->attributeDetails->SUInfo = 0;
     zdi->attributeDetails->data1_tree =
        data1_read_sgml (zei->dh, zei->nmem,
                         "<explain><attributeDetails>AttributeDetails\n"
     zdi->attributeDetails->data1_tree =
        data1_read_sgml (zei->dh, zei->nmem,
                         "<explain><attributeDetails>AttributeDetails\n"
@@ -996,7 +996,7 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei,
        "TargetInfo",
        "DatabaseInfo",
        "AttributeDetails",
        "TargetInfo",
        "DatabaseInfo",
        "AttributeDetails",
-       NULL
+       0
     };
 
     assert (zcl);
     };
 
     assert (zcl);
@@ -1235,11 +1235,10 @@ static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei,
     Record drec;
     data1_node *node_root, *node_attinfo, *node_attributes, *node_atttype;
     data1_node *node_values;
     Record drec;
     data1_node *node_root, *node_attinfo, *node_attributes, *node_atttype;
     data1_node *node_values;
-    struct oident *entp;
-    struct data1_attset *attset = NULL;
-    
-    if ((entp = oid_getentbyoid (o->oid)))
-       attset = data1_attset_search_id (zei->dh, entp->value);
+    struct data1_attset *attset = 0;
+
+    if (o->oid)
+       attset = data1_attset_search_id (zei->dh, o->oid);
            
 #if ZINFO_DEBUG
     yaz_log(YLOG_LOG, "zebraExplain_writeAttributeSet %s",
            
 #if ZINFO_DEBUG
     yaz_log(YLOG_LOG, "zebraExplain_writeAttributeSet %s",
@@ -1522,7 +1521,7 @@ zebAccessObject zebraExplain_announceOid (ZebraExplainInfo zei,
     if (!ao)
     {
        ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao));
     if (!ao)
     {
        ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao));
-       ao->handle = NULL;
+       ao->handle = 0;
        ao->sysno = 0;
        ao->oid = odr_oiddup_nmem (zei->nmem, oid);
        ao->next = *op;
        ao->sysno = 0;
        ao->oid = odr_oiddup_nmem (zei->nmem, oid);
        ao->next = *op;
@@ -1531,23 +1530,6 @@ zebAccessObject zebraExplain_announceOid (ZebraExplainInfo zei,
     return ao;
 }
 
     return ao;
 }
 
-void zebraExplain_addAttributeSet (ZebraExplainInfo zei, int set)
-{
-    oident oe;
-    int oid[OID_SIZE];
-
-    oe.proto = PROTO_Z3950;
-    oe.oclass = CLASS_ATTSET;
-    oe.value = (enum oid_value) set;
-
-    if (oid_ent_to_oid (&oe, oid))
-    {
-       zebraExplain_announceOid (zei, &zei->accessInfo->attributeSetIds, oid);
-       zebraExplain_announceOid (zei, &zei->curDatabaseInfo->
-                                 accessInfo->attributeSetIds, oid);
-    }
-}
-
 struct zebSUInfoB *zebraExplain_add_sui_info(ZebraExplainInfo zei,
                                              zinfo_index_category_t cat,
                                              int index_type)
 struct zebSUInfoB *zebraExplain_add_sui_info(ZebraExplainInfo zei,
                                              zinfo_index_category_t cat,
                                              int index_type)
index a81f4d8..fb997da 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zsets.c,v 1.120 2007-03-20 22:07:35 adam Exp $
+/* $Id: zsets.c,v 1.121 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -100,7 +100,6 @@ static ZEBRA_RES resultSetSearch(ZebraHandle zh, NMEM nmem, NMEM rset_nmem,
                                  Z_RPNQuery *rpn, ZebraSet sset)
 {
     RSET rset = 0;
                                  Z_RPNQuery *rpn, ZebraSet sset)
 {
     RSET rset = 0;
-    oident *attrset;
     Z_SortKeySpecList *sort_sequence;
     int sort_status, i;
     ZEBRA_RES res = ZEBRA_OK;
     Z_SortKeySpecList *sort_sequence;
     int sort_status, i;
     ZEBRA_RES res = ZEBRA_OK;
@@ -114,11 +113,9 @@ static ZEBRA_RES resultSetSearch(ZebraHandle zh, NMEM nmem, NMEM rset_nmem,
     for (i = 0; i<sort_sequence->num_specs; i++)
         sort_sequence->specs[i] = 0;
     
     for (i = 0; i<sort_sequence->num_specs; i++)
         sort_sequence->specs[i] = 0;
     
-    attrset = oid_getentbyoid (rpn->attributeSetId);
-
     rpn_get_top_approx_limit(zh, rpn->RPNStructure, &sset->approx_limit);
 
     rpn_get_top_approx_limit(zh, rpn->RPNStructure, &sset->approx_limit);
 
-    res = rpn_search_top(zh, rpn->RPNStructure, attrset->value,
+    res = rpn_search_top(zh, rpn->RPNStructure, rpn->attributeSetId,
                         nmem, rset_nmem,
                         sort_sequence,
                         sset->num_bases, sset->basenames,
                         nmem, rset_nmem,
                         sort_sequence,
                         sset->num_bases, sset->basenames,
index bf44b57..20930d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t16.c,v 1.9 2007-01-15 15:10:20 adam Exp $
+/* $Id: t16.c,v 1.10 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -33,7 +33,7 @@ const char *myrec[] = {
 #define NUMBER_TO_FETCH_MAX 1000
 
 static ZEBRA_RES fetch_first(ZebraHandle zh, const char *element_set,
 #define NUMBER_TO_FETCH_MAX 1000
 
 static ZEBRA_RES fetch_first(ZebraHandle zh, const char *element_set,
-                             oid_value format, ODR odr,
+                             const int * format, ODR odr,
                              const char **rec_buf, size_t *rec_len)
 {
     ZebraRetrievalRecord retrievalRecord[1];
                              const char **rec_buf, size_t *rec_len)
 {
     ZebraRetrievalRecord retrievalRecord[1];
@@ -61,7 +61,7 @@ static ZEBRA_RES fetch_first(ZebraHandle zh, const char *element_set,
 }
 
 static ZEBRA_RES fetch_first_compare(ZebraHandle zh, const char *element_set,
 }
 
 static ZEBRA_RES fetch_first_compare(ZebraHandle zh, const char *element_set,
-                                     oid_value format, const char *cmp_rec)
+                                     const int *format, const char *cmp_rec)
 {
     const char *rec_buf = 0;
     size_t rec_len = 0;
 {
     const char *rec_buf = 0;
     size_t rec_len = 0;
@@ -105,33 +105,33 @@ static void tst(int argc, char **argv)
     YAZ_CHECK_EQ(res, ZEBRA_OK);
     YAZ_CHECK_EQ(hits, 1);
     
     YAZ_CHECK_EQ(res, ZEBRA_OK);
     YAZ_CHECK_EQ(hits, 1);
     
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_xml(),
                                      "mismatch"), ZEBRA_FAIL);
 
                                      "mismatch"), ZEBRA_FAIL);
 
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_SUTRS,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_sutrs(),
                                      myrec[0]), ZEBRA_OK);
 
                                      myrec[0]), ZEBRA_OK);
 
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_xml(),
                                      myrec[0]), ZEBRA_OK);
 
                                      myrec[0]), ZEBRA_OK);
 
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_SUTRS,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", yaz_oid_sutrs(),
                                      "2"), ZEBRA_OK);
 
                                      "2"), ZEBRA_OK);
 
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_TEXT_XML,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", yaz_oid_xml(),
                                      zebra_xml_sysno), ZEBRA_OK);
     
                                      zebra_xml_sysno), ZEBRA_OK);
     
-    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta", VAL_TEXT_XML,
+    YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta", yaz_oid_xml(),
                                      zebra_xml_meta), ZEBRA_OK);
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::title:p", 
                                      zebra_xml_meta), ZEBRA_OK);
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::title:p", 
-                                     VAL_TEXT_XML,
+                                     yaz_oid_xml(),
                                      zebra_xml_index_title_p), ZEBRA_OK);
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::nonexistent", 
                                      zebra_xml_index_title_p), ZEBRA_OK);
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::nonexistent", 
-                                     VAL_TEXT_XML, ""), ZEBRA_OK);
+                                     yaz_oid_xml(), ""), ZEBRA_OK);
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::nonexistent", 
     
     YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::nonexistent", 
-                                     VAL_TEXT_XML, ""), ZEBRA_OK);
+                                     yaz_oid_xml(), ""), ZEBRA_OK);
     
     YAZ_CHECK(tl_close_down(zh, zs));
 }
     
     YAZ_CHECK(tl_close_down(zh, zs));
 }
index d39a6e5..50657ba 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t4.c,v 1.22 2007-01-15 15:10:20 adam Exp $
+/* $Id: t4.c,v 1.23 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -96,7 +96,7 @@ static void tst(int argc, char **argv)
            retrievalRecord[j].position = j+1;
 
         ret = zebra_records_retrieve(zh, odr_output, setname, 0,
            retrievalRecord[j].position = j+1;
 
         ret = zebra_records_retrieve(zh, odr_output, setname, 0,
-                                    VAL_TEXT_XML, number_to_fetch,
+                                    yaz_oid_xml(), number_to_fetch,
                                     retrievalRecord);
        if (ret != ZEBRA_OK)
        {
                                     retrievalRecord);
        if (ret != ZEBRA_OK)
        {
index ad878d6..52c7ca7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: testlib.c,v 1.42 2007-01-15 15:10:20 adam Exp $
+/* $Id: testlib.c,v 1.43 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <assert.h>
 #include <yaz/log.h>
 #include <yaz/pquery.h>
 #include <assert.h>
 #include <yaz/log.h>
 #include <yaz/pquery.h>
+#include <yaz/oid_db.h>
 #include <idzebra/api.h>
 #include "testlib.h"
 
 #include <idzebra/api.h>
 #include "testlib.h"
 
@@ -323,7 +324,7 @@ int tl_ranking_query(ZebraHandle zh, char *query,
 
     odr_output = odr_createmem(ODR_ENCODE);    
     rc = zebra_records_retrieve(zh, odr_output, setname, 0,
 
     odr_output = odr_createmem(ODR_ENCODE);    
     rc = zebra_records_retrieve(zh, odr_output, setname, 0,
-                                VAL_TEXT_XML, exphits, retrievalRecord);
+                                yaz_oid_xml(), exphits, retrievalRecord);
     if (rc != ZEBRA_OK)
         ret = 0;
     else if (!strstr(retrievalRecord[0].buf, firstrec))
     if (rc != ZEBRA_OK)
         ret = 0;
     else if (!strstr(retrievalRecord[0].buf, firstrec))
index cc35b20..1d3fcba 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: testlib.h,v 1.24 2007-01-15 20:08:26 adam Exp $
+/* $Id: testlib.h,v 1.25 2007-04-16 08:44:32 adam Exp $
    Copyright (C) 1995-2007
    Index Data ApS
 
    Copyright (C) 1995-2007
    Index Data ApS
 
@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/log.h>
 #include <idzebra/api.h>
 #include <yaz/test.h>
 #include <yaz/log.h>
 #include <idzebra/api.h>
 #include <yaz/test.h>
+#include <yaz/oid_db.h>
 
 /** 
  * tl_start_up : Does all the usual start functions
 
 /** 
  * tl_start_up : Does all the usual start functions
index b7f26ab..631e35d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: attrfind.c,v 1.2 2007-01-15 15:10:26 adam Exp $
+/* $Id: attrfind.c,v 1.3 2007-04-16 08:44:33 adam Exp $
    Copyright (C) 2005-2007
    Index Data ApS
 
    Copyright (C) 2005-2007
    Index Data ApS
 
@@ -42,7 +42,7 @@ void attr_init_AttrList(AttrType *src, Z_AttributeList *list, int type)
     src->minor = 0;
 }
 
     src->minor = 0;
 }
 
-int attr_find_ex(AttrType *src, oid_value *attributeSetP, 
+int attr_find_ex(AttrType *src, const int **attribute_set_oid,
                 const char **string_value)
 {
     int num_attributes;
                 const char **string_value)
 {
     int num_attributes;
@@ -59,25 +59,15 @@ int attr_find_ex(AttrType *src, oid_value *attributeSetP,
             {
             case Z_AttributeValue_numeric:
                 ++(src->major);
             {
             case Z_AttributeValue_numeric:
                 ++(src->major);
-                if (element->attributeSet && attributeSetP)
-                {
-                    oident *attrset;
-
-                    attrset = oid_getentbyoid(element->attributeSet);
-                    *attributeSetP = attrset->value;
-                }
+                if (element->attributeSet && attribute_set_oid)
+                    *attribute_set_oid = element->attributeSet;
                 return *element->value.numeric;
                 break;
             case Z_AttributeValue_complex:
                 if (src->minor >= element->value.complex->num_list)
                     break;
                 return *element->value.numeric;
                 break;
             case Z_AttributeValue_complex:
                 if (src->minor >= element->value.complex->num_list)
                     break;
-                if (element->attributeSet && attributeSetP)
-                {
-                    oident *attrset;
-                    
-                    attrset = oid_getentbyoid(element->attributeSet);
-                    *attributeSetP = attrset->value;
-                }
+                if (element->attributeSet && attribute_set_oid)
+                    *attribute_set_oid = element->attributeSet;
                 if (element->value.complex->list[src->minor]->which ==  
                     Z_StringOrNumeric_numeric)
                 {
                 if (element->value.complex->list[src->minor]->which ==  
                     Z_StringOrNumeric_numeric)
                 {
@@ -106,9 +96,9 @@ int attr_find_ex(AttrType *src, oid_value *attributeSetP,
     return -1;
 }
 
     return -1;
 }
 
-int attr_find(AttrType *src, oid_value *attributeSetP)
+int attr_find(AttrType *src, const int **attribute_set_id)
 {
 {
-    return attr_find_ex(src, attributeSetP, 0);
+    return attr_find_ex(src, attribute_set_id, 0);
 }
 
 
 }