X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=data1%2Fd1_absyn.c;h=d737d35df8c93ba4e25c3ac4774f5ef12ad33b1a;hp=feff7cefd8488ad7ac1184b8ee66be3ea9c46c72;hb=d513d15e315601b730b0b3a6126c3163d00223fb;hpb=f5fb1bd0a0df8a28471285cdf622897f4c2391b3 diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index feff7ce..d737d35 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,8 +1,5 @@ -/* $Id: d1_absyn.c,v 1.30 2006-09-29 10:02:45 adam Exp $ - Copyright (C) 1995-2006 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -20,13 +17,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include #include -#include +#include #include #include #include @@ -250,13 +250,13 @@ data1_attset *data1_attset_search_name (data1_handle dh, const char *name) return 0; } -data1_attset *data1_attset_search_id (data1_handle dh, int id) +data1_attset *data1_attset_search_id(data1_handle dh, const Odr_oid *oid) { 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; } @@ -659,15 +659,19 @@ int read_absyn_line(FILE *f, int *lineno, char *line, int len, return argc; } -data1_marctab *data1_absyn_getmarctab(data1_handle dh, data1_absyn *absyn) +data1_marctab *data1_absyn_getmarctab(data1_handle dh, data1_node *root) { - return absyn->marc; + if (root->u.root.absyn) + return root->u.root.absyn->marc; + return 0; } -YAZ_EXPORT data1_element *data1_absyn_getelements(data1_handle dh, - data1_absyn *absyn) +data1_element *data1_absyn_getelements(data1_handle dh, + data1_node *root) { - return absyn->main_elements; + if (root->u.root.absyn) + return root->u.root.absyn->main_elements; + return 0; } static data1_absyn *data1_read_absyn(data1_handle dh, const char *file, @@ -696,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->reference = VAL_NONE; + res->oid = 0; res->tagset = 0; res->encoding = 0; res->xpath_indexing = @@ -860,9 +864,10 @@ static data1_absyn *data1_read_absyn(data1_handle dh, const char *file, data1_xpelement *xp_ele = 0; data1_xpelement *last_match = 0; - if (argc < 3) + if (argc != 3) { - yaz_log(YLOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to %s", + file, lineno, cmd); continue; } @@ -1018,7 +1023,10 @@ static data1_absyn *data1_read_absyn(data1_handle dh, const char *file, 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); @@ -1198,9 +1206,11 @@ static data1_absyn *data1_read_absyn(data1_handle dh, const char *file, *systagsp = 0; return res; } + /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab