2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.5 1997-09-05 15:30:08 adam
8 * Changed prototype for chr_map_input - added const.
9 * Added support for C++, headers uses extern "C" for public definitions.
11 * Revision 1.4 1996/10/29 14:06:48 adam
12 * Include zebrautl.h instead of alexutil.h.
14 * Revision 1.3 1996/05/09 07:28:54 quinn
15 * Work towards phrases and multiple registers
17 * Revision 1.2 1995/11/15 19:13:07 adam
18 * Work on record management.
21 * This interface is used by other modules (the Z-server in particular)
22 * to normalize the attributes given in queries.
29 #include <d1_attset.h>
31 #include "attribute.h"
33 static int initialized = 0;
35 static data1_attset *registered_sets = 0;
37 static void att_loadset(const char *n, const char *name)
41 if (!(cnew = data1_read_attset((char*) name)))
43 logf(LOG_WARN|LOG_ERRNO, "%s", name);
46 cnew->next = registered_sets;
47 registered_sets = cnew;
50 static void load_atts()
52 res_trav(common_resource, "attset", 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 attent *att_getentbyatt(oid_value set, int att)
83 for (p = registered_sets; p; p = p->next)
84 if (p->reference == set && (r = getatt(p, att)))
88 res.attset_ordinal = r->parent->ordinal;
89 res.local_attributes = r->locals;