2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1999-11-30 13:47:11 adam
8 * Improved installation. Moved header files to include/yaz.
10 * Revision 1.5 1999/04/20 09:56:47 adam
11 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
12 * Modified all encoders/decoders to reflect this change.
14 * Revision 1.4 1998/02/11 11:53:32 adam
15 * Changed code so that it compiles as C++.
17 * Revision 1.3 1998/01/05 09:04:57 adam
18 * Fixed bugs in encoders/decoders - Not operator (!) missing.
20 * Revision 1.2 1997/04/30 08:52:02 quinn
23 * Revision 1.1 1996/10/10 11:52:18 quinn
24 * Added SearchResult additionalInfo
29 #include <yaz/proto.h>
31 int z_ResultsByDBList (ODR o, Z_ResultsByDBList **p, int opt, const char *name)
33 if (!odr_initmember (o, p, sizeof(**p)))
34 return opt && odr_ok(o);
35 if (odr_sequence_of (o, z_DatabaseName, &(*p)->elements,
39 return opt && odr_ok(o);
42 int z_ResultsByDB_elem (ODR o, Z_ResultsByDB_elem **p, int opt,
45 static Odr_arm arm[] = {
46 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ResultsByDB_all,
47 (Odr_fun)odr_null, 0},
48 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ResultsByDB_list,
49 (Odr_fun)z_ResultsByDBList, 0},
50 {-1, -1, -1, -1, 0, 0}
52 if (!odr_sequence_begin (o, p, sizeof(**p), 0))
53 return opt && odr_ok (o);
55 odr_constructed_begin (o, &(*p)->u, ODR_CONTEXT, 1, 0) &&
56 odr_choice (o, arm, &(*p)->u, &(*p)->which, 0) &&
57 odr_constructed_end (o) &&
58 odr_implicit (o, odr_integer,
59 &(*p)->count, ODR_CONTEXT, 2, 1) &&
60 odr_implicit (o, z_InternationalString,
61 &(*p)->resultSetName, ODR_CONTEXT, 3, 1) &&
65 int z_ResultsByDB (ODR o, Z_ResultsByDB **p, int opt, const char *name)
67 if (!odr_initmember (o, p, sizeof(**p)))
68 return opt && odr_ok(o);
69 if (odr_sequence_of (o, (Odr_fun)z_ResultsByDB_elem, &(*p)->elements,
73 return opt && odr_ok(o);
76 int z_QueryExpressionTerm (ODR o, Z_QueryExpressionTerm **p, int opt,
79 if (!odr_sequence_begin (o, p, sizeof(**p), 0))
80 return opt && odr_ok (o);
82 odr_explicit (o, z_Term,
83 &(*p)->queryTerm, ODR_CONTEXT, 1, 0) &&
84 odr_implicit (o, z_InternationalString,
85 &(*p)->termComment, ODR_CONTEXT, 2, 1) &&
89 int z_QueryExpression (ODR o, Z_QueryExpression **p, int opt,
92 static Odr_arm arm[] = {
93 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_QueryExpression_term,
94 (Odr_fun)z_QueryExpressionTerm, 0},
95 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_QueryExpression_query,
97 {-1, -1, -1, -1, 0, 0}
99 if (!odr_initmember(o, p, sizeof(**p)))
100 return opt && odr_ok(o);
101 if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
104 return opt && odr_ok(o);
107 int z_SearchInfoReport_elem (ODR o, Z_SearchInfoReport_elem **p, int opt,
110 if (!odr_sequence_begin (o, p, sizeof(**p), 0))
111 return opt && odr_ok (o);
113 odr_implicit (o, z_InternationalString,
114 &(*p)->subqueryId, ODR_CONTEXT, 1, 1) &&
115 odr_implicit (o, odr_bool,
116 &(*p)->fullQuery, ODR_CONTEXT, 2, 0) &&
117 odr_explicit (o, z_QueryExpression,
118 &(*p)->subqueryExpression, ODR_CONTEXT, 3, 1) &&
119 odr_explicit (o, z_QueryExpression,
120 &(*p)->subqueryInterpretation, ODR_CONTEXT, 4, 1) &&
121 odr_explicit (o, z_QueryExpression,
122 &(*p)->subqueryRecommendation, ODR_CONTEXT, 5, 1) &&
123 odr_implicit (o, odr_integer,
124 &(*p)->subqueryCount, ODR_CONTEXT, 6, 1) &&
125 odr_implicit (o, z_IntUnit,
126 &(*p)->subqueryWeight, ODR_CONTEXT, 7, 1) &&
127 odr_implicit (o, z_ResultsByDB,
128 &(*p)->resultsByDB, ODR_CONTEXT, 8, 1) &&
129 odr_sequence_end (o);
132 int z_SearchInfoReport (ODR o, Z_SearchInfoReport **p, int opt,
135 if (!odr_initmember (o, p, sizeof(**p)))
136 return opt && odr_ok(o);
137 if (odr_sequence_of (o, (Odr_fun)z_SearchInfoReport_elem, &(*p)->elements,
141 return opt && odr_ok(o);