2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.6 1997-09-17 12:19:11 adam
8 * Zebra version corresponds to YAZ version 1.4.
9 * Changed Zebra server so that it doesn't depend on global common_resource.
11 * Revision 1.5 1997/09/05 15:30:08 adam
12 * Changed prototype for chr_map_input - added const.
13 * Added support for C++, headers uses extern "C" for public definitions.
15 * Revision 1.4 1996/10/29 14:06:48 adam
16 * Include zebrautl.h instead of alexutil.h.
18 * Revision 1.3 1996/05/09 07:28:54 quinn
19 * Work towards phrases and multiple registers
21 * Revision 1.2 1995/11/15 19:13:07 adam
22 * Work on record management.
25 * This interface is used by other modules (the Z-server in particular)
26 * to normalize the attributes given in queries.
36 static void att_loadset(void *p, const char *n, const char *name)
41 if (!(cnew = data1_read_attset(zi->dh, (char*) name)))
43 logf(LOG_WARN|LOG_ERRNO, "%s", name);
46 cnew->next = zi->registered_sets;
47 zi->registered_sets = cnew;
50 static void load_atts(ZServerInfo *zi)
52 res_trav(zi->res, "attset", zi, att_loadset);
55 static data1_att *getatt(data1_attset *p, int att)
59 for (; p; p = p->next)
62 for (a = p->atts; a; a = a->next)
65 /* scan included sets */
66 if (p->children && (a = getatt(p->children, att)))
72 int att_getentbyatt(ZServerInfo *zi, attent *res, oid_value set, int att)
77 if (!zi->registered_sets)
79 for (p = zi->registered_sets; p; p = p->next)
80 if (p->reference == set && (r = getatt(p, att)))
84 res->attset_ordinal = r->parent->ordinal;
85 res->local_attributes = r->locals;