YAZ  5.23.1
z-facet-1.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/z-facet-1.h>
11 
12 int z_FacetList(ODR o, Z_FacetList **p, int opt, const char *name)
13 {
14  if (!odr_initmember(o, p, sizeof(**p)))
15  return odr_missing(o, opt, name);
16  if (odr_sequence_of(o, (Odr_fun) z_FacetField, &(*p)->elements,
17  &(*p)->num, name))
18  return 1;
19  if (o->direction == ODR_DECODE)
20  *p = 0;
21  return odr_missing(o, opt, name);
22 }
23 
24 int z_FacetField(ODR o, Z_FacetField **p, int opt, const char *name)
25 {
26  if (!odr_sequence_begin(o, p, sizeof(**p), name))
27  return odr_missing(o, opt, name) && odr_ok (o);
28  return
30  &(*p)->attributes, ODR_CONTEXT, 1, 0, "attributes") &&
32  (odr_sequence_of(o, (Odr_fun) z_FacetTerm, &(*p)->terms,
33  &(*p)->num_terms, "terms") || odr_ok(o)) &&
35 }
36 
37 int z_FacetTerm(ODR o, Z_FacetTerm **p, int opt, const char *name)
38 {
39  if (!odr_sequence_begin(o, p, sizeof(**p), name))
40  return odr_missing(o, opt, name) && odr_ok (o);
41  return
42  z_Term(o, &(*p)->term, 0, "term") &&
43  odr_integer(o, &(*p)->count, 0, "count") &&
45 }
#define odr_ok(o)
Definition: odr.h:215
int z_AttributeList(ODR o, Z_AttributeList **p, int opt, const char *name)
Definition: z-core.c:316
int z_FacetList(ODR o, Z_FacetList **p, int opt, const char *name)
Definition: z-facet-1.c:12
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
char * name
Definition: initopt.c:18
ASN.1 Module UserInfoFormat-facet-1.
int z_FacetField(ODR o, Z_FacetField **p, int opt, const char *name)
Definition: z-facet-1.c:24
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
int direction
Definition: odr.h:126
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
int z_FacetTerm(ODR o, Z_FacetTerm **p, int opt, const char *name)
Definition: z-facet-1.c:37
int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num, const char *name)
Definition: odr_seq.c:134
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int opt
Definition: initopt.c:19
int z_Term(ODR o, Z_Term **p, int opt, const char *name)
Definition: z-core.c:329
#define ODR_CONTEXT
Definition: odr.h:67
#define ODR_DECODE
Definition: odr.h:95
int odr_implicit_settag(ODR o, int zclass, int tag)
Definition: odr_tag.c:32