YAZ  5.23.1
z-uifr1.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-uifr1.h>
11 
12 int z_SearchInfoReport_s(ODR o, Z_SearchInfoReport_s **p, int opt, const char *name)
13 {
14  if (!odr_sequence_begin(o, p, sizeof(**p), name))
15  return odr_missing(o, opt, name) && odr_ok (o);
16  return
18  &(*p)->subqueryId, ODR_CONTEXT, 1, 1, "subqueryId") &&
20  &(*p)->fullQuery, ODR_CONTEXT, 2, 0, "fullQuery") &&
22  &(*p)->subqueryExpression, ODR_CONTEXT, 3, 1, "subqueryExpression") &&
24  &(*p)->subqueryInterpretation, ODR_CONTEXT, 4, 1, "subqueryInterpretation") &&
26  &(*p)->subqueryRecommendation, ODR_CONTEXT, 5, 1, "subqueryRecommendation") &&
28  &(*p)->subqueryCount, ODR_CONTEXT, 6, 1, "subqueryCount") &&
30  &(*p)->subqueryWeight, ODR_CONTEXT, 7, 1, "subqueryWeight") &&
32  &(*p)->resultsByDB, ODR_CONTEXT, 8, 1, "resultsByDB") &&
34 }
35 
36 int z_SearchInfoReport(ODR o, Z_SearchInfoReport **p, int opt, const char *name)
37 {
38  if (!odr_initmember(o, p, sizeof(**p)))
39  return odr_missing(o, opt, name);
40  if (odr_sequence_of(o, (Odr_fun) z_SearchInfoReport_s, &(*p)->elements,
41  &(*p)->num, name))
42  return 1;
43  if (o->direction == ODR_DECODE)
44  *p = 0;
45  return odr_missing(o, opt, name);
46 }
47 
48 int z_ResultsByDB_sList(ODR o, Z_ResultsByDB_sList **p, int opt, const char *name)
49 {
50  if (!odr_initmember(o, p, sizeof(**p)))
51  return odr_missing(o, opt, name);
52  if (odr_sequence_of(o, (Odr_fun) z_DatabaseName, &(*p)->elements,
53  &(*p)->num, name))
54  return 1;
55  if (o->direction == ODR_DECODE)
56  *p = 0;
57  return odr_missing(o, opt, name);
58 }
59 
60 int z_ResultsByDB_s(ODR o, Z_ResultsByDB_s **p, int opt, const char *name)
61 {
62  static Odr_arm arm[] = {
64  (Odr_fun) odr_null, "all"},
66  (Odr_fun) z_ResultsByDB_sList, "list"},
67  {-1, -1, -1, -1, (Odr_fun) 0, 0}
68  };
69  if (!odr_sequence_begin(o, p, sizeof(**p), name))
70  return odr_missing(o, opt, name) && odr_ok (o);
71  return
72  odr_constructed_begin(o, &(*p)->u, ODR_CONTEXT, 1, "databases") &&
73  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
76  &(*p)->count, ODR_CONTEXT, 2, 1, "count") &&
78  &(*p)->resultSetName, ODR_CONTEXT, 3, 1, "resultSetName") &&
80 }
81 
82 int z_ResultsByDB(ODR o, Z_ResultsByDB **p, int opt, const char *name)
83 {
84  if (!odr_initmember(o, p, sizeof(**p)))
85  return odr_missing(o, opt, name);
86  if (odr_sequence_of(o, (Odr_fun) z_ResultsByDB_s, &(*p)->elements,
87  &(*p)->num, name))
88  return 1;
89  if (o->direction == ODR_DECODE)
90  *p = 0;
91  return odr_missing(o, opt, name);
92 }
93 
95 {
96  if (!odr_sequence_begin(o, p, sizeof(**p), name))
97  return odr_missing(o, opt, name) && odr_ok (o);
98  return
100  &(*p)->queryTerm, ODR_CONTEXT, 1, 0, "queryTerm") &&
102  &(*p)->termComment, ODR_CONTEXT, 2, 1, "termComment") &&
103  odr_sequence_end(o);
104 }
105 
106 int z_QueryExpression(ODR o, Z_QueryExpression **p, int opt, const char *name)
107 {
108  static Odr_arm arm[] = {
110  (Odr_fun) z_QueryExpressionTerm, "term"},
112  (Odr_fun) z_Query, "query"},
113  {-1, -1, -1, -1, (Odr_fun) 0, 0}
114  };
115  if (!odr_initmember(o, p, sizeof(**p)))
116  return odr_missing(o, opt, name);
117  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
118  return 1;
119  if (o->direction == ODR_DECODE)
120  *p = 0;
121  return odr_missing(o, opt, name);
122 }
#define odr_ok(o)
Definition: odr.h:215
#define odr_explicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:195
#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
int z_QueryExpression(ODR o, Z_QueryExpression **p, int opt, const char *name)
Definition: z-uifr1.c:106
int z_SearchInfoReport(ODR o, Z_SearchInfoReport **p, int opt, const char *name)
Definition: z-uifr1.c:36
int odr_constructed_begin(ODR o, void *xxp, int zclass, int tag, const char *name)
Definition: odr_cons.c:24
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
int z_QueryExpressionTerm(ODR o, Z_QueryExpressionTerm **p, int opt, const char *name)
Definition: z-uifr1.c:94
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 odr_bool(ODR o, Odr_bool **p, int opt, const char *name)
Definition: odr_bool.c:21
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
#define Z_QueryExpression_query
Definition: z-uifr1.h:91
#define ODR_EXPLICIT
Definition: odr.h:60
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 z_Query(ODR o, Z_Query **p, int opt, const char *name)
Definition: z-core.c:207
int which
Definition: odr.h:142
Definition: odr.h:137
int odr_null(ODR o, Odr_null **p, int opt, const char *name)
Definition: odr_null.c:19
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 z_ResultsByDB_sList(ODR o, Z_ResultsByDB_sList **p, int opt, const char *name)
Definition: z-uifr1.c:48
#define Z_ResultsByDB_s_list
Definition: z-uifr1.h:69
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
int z_SearchInfoReport_s(ODR o, Z_SearchInfoReport_s **p, int opt, const char *name)
Definition: z-uifr1.c:12
#define Z_QueryExpression_term
Definition: z-uifr1.h:90
#define Z_ResultsByDB_s_all
Definition: z-uifr1.h:68
int z_ResultsByDB(ODR o, Z_ResultsByDB **p, int opt, const char *name)
Definition: z-uifr1.c:82
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
int z_ResultsByDB_s(ODR o, Z_ResultsByDB_s **p, int opt, const char *name)
Definition: z-uifr1.c:60
int z_Term(ODR o, Z_Term **p, int opt, const char *name)
Definition: z-core.c:329
int odr_constructed_end(ODR o)
Definition: odr_cons.c:148
#define ODR_CONTEXT
Definition: odr.h:67
int z_IntUnit(ODR o, Z_IntUnit **p, int opt, const char *name)
Definition: z-core.c:1570
#define ODR_DECODE
Definition: odr.h:95
int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt, const char *name)
Definition: z-core.c:1513
ASN.1 Module UserInfoFormat-searchResult-1.