2 * Copyright (c) 1995, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1998-02-11 11:53:32 adam
8 * Changed code so that it compiles as C++.
10 * Revision 1.2 1998/02/10 15:31:46 adam
11 * Implemented date and time structure. Changed the Update Extended
14 * Revision 1.1 1995/10/12 10:34:37 quinn
22 int z_OccurValues(ODR o, Z_OccurValues **p, int opt)
24 if (!odr_sequence_begin(o, p, sizeof(**p)))
25 return opt && odr_ok(o);
27 odr_implicit(o, odr_integer, &(*p)->start, ODR_CONTEXT, 1, 0) &&
28 odr_implicit(o, odr_integer, &(*p)->howMany, ODR_CONTEXT, 2, 1) &&
32 int z_Occurrences(ODR o, Z_Occurrences **p, int opt)
34 static Odr_arm arm[] =
36 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Occurrences_all, (Odr_fun)odr_null},
37 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Occurrences_last, (Odr_fun)odr_null},
38 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Occurrences_values, (Odr_fun)z_OccurValues},
42 if (o->direction == ODR_DECODE)
43 *p = (Z_Occurrences *)odr_malloc(o, sizeof(**p));
46 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
49 return opt && odr_ok(o);
52 int z_SpecificTag(ODR o, Z_SpecificTag **p, int opt)
54 if (!odr_sequence_begin(o, p, sizeof(**p)))
55 return opt && odr_ok(o);
57 odr_implicit(o, odr_oid, &(*p)->schemaId, ODR_CONTEXT, 0, 1) &&
58 odr_implicit(o, odr_integer, &(*p)->tagType, ODR_CONTEXT, 1, 1) &&
59 odr_explicit(o, z_StringOrNumeric, &(*p)->tagValue, ODR_CONTEXT,
61 odr_explicit(o, z_Occurrences, &(*p)->occurrences, ODR_CONTEXT, 3, 1) &&
65 int z_ETagUnit(ODR o, Z_ETagUnit **p, int opt)
67 static Odr_arm arm[] =
69 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ETagUnit_specificTag, (Odr_fun)z_SpecificTag},
70 {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ETagUnit_wildThing, (Odr_fun)z_Occurrences},
71 {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ETagUnit_wildPath, (Odr_fun)odr_null},
75 if (o->direction == ODR_DECODE)
76 *p = (Z_ETagUnit *)odr_malloc(o, sizeof(**p));
79 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
82 return opt && odr_ok(o);
85 int z_ETagPath(ODR o, Z_ETagPath **p, int opt)
87 if (o->direction == ODR_DECODE)
88 *p = (Z_ETagPath *)odr_malloc(o, sizeof(**p));
91 if (odr_sequence_of(o, (Odr_fun)z_ETagUnit, &(*p)->tags, &(*p)->num_tags))
94 return opt && odr_ok(o);
97 int z_SimpleElement(ODR o, Z_SimpleElement **p, int opt)
99 if (!odr_sequence_begin(o, p, sizeof(**p)))
100 return opt && odr_ok(o);
102 odr_implicit(o, z_ETagPath, &(*p)->path, ODR_CONTEXT, 1, 0) &&
103 odr_implicit(o, z_Variant, &(*p)->variantRequest, ODR_CONTEXT,
108 int z_CompoPrimitives(ODR o, Z_CompoPrimitives **p, int opt)
110 if (o->direction == ODR_DECODE)
111 *p = (Z_CompoPrimitives *)odr_malloc(o, sizeof(**p));
114 if (odr_sequence_of(o, z_InternationalString, &(*p)->primitives,
115 &(*p)->num_primitives))
118 return opt && odr_ok(o);
121 int z_CompoSpecs(ODR o, Z_CompoSpecs **p, int opt)
123 if (o->direction == ODR_DECODE)
124 *p = (Z_CompoSpecs *)odr_malloc(o, sizeof(**p));
127 if (odr_sequence_of(o, (Odr_fun)z_SimpleElement, &(*p)->specs, &(*p)->num_specs))
130 return opt && odr_ok(o);
133 int z_CompositeElement(ODR o, Z_CompositeElement **p, int opt)
135 static Odr_arm arm[] =
137 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_CompoElement_primitives,
138 (Odr_fun)z_CompoPrimitives},
139 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_CompoElement_specs,
140 (Odr_fun)z_CompoSpecs},
144 if (!odr_sequence_begin(o, p, sizeof(**p)))
145 return opt && odr_ok(o);
147 odr_constructed_begin(o, &(*p)->elementList, ODR_CONTEXT, 1) &&
148 odr_choice(o, arm, &(*p)->elementList, &(*p)->which) &&
149 odr_constructed_end(o) &&
150 odr_implicit(o, z_ETagPath, &(*p)->deliveryTag, ODR_CONTEXT, 2, 0) &&
151 odr_implicit(o, z_Variant, &(*p)->variantRequest, ODR_CONTEXT, 3, 1) &&
155 int z_ElementRequest(ODR o, Z_ElementRequest **p, int opt)
157 static Odr_arm arm[] =
159 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ERequest_simpleElement,
160 (Odr_fun)z_SimpleElement},
161 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ERequest_compositeElement,
162 (Odr_fun)z_CompositeElement},
166 if (o->direction == ODR_DECODE)
167 *p = (Z_ElementRequest *)odr_malloc(o, sizeof(**p));
170 if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
173 return opt && odr_ok(o);
176 int z_Espec1(ODR o, Z_Espec1 **p, int opt)
178 if (!odr_sequence_begin(o, p, sizeof(**p)))
179 return opt && odr_ok(o);
181 odr_implicit_settag(o, ODR_CONTEXT, 1) &&
182 (odr_sequence_of(o, z_InternationalString, &(*p)->elementSetNames,
183 &(*p)->num_elementSetNames) || odr_ok(o)) &&
184 odr_implicit(o, odr_oid, &(*p)->defaultVariantSetId, ODR_CONTEXT,
186 odr_implicit(o, z_Variant, &(*p)->defaultVariantRequest, ODR_CONTEXT,
188 odr_implicit(o, odr_integer, &(*p)->defaultTagType, ODR_CONTEXT,
190 odr_implicit_settag(o, ODR_CONTEXT, 5) &&
191 (odr_sequence_of(o, (Odr_fun)z_ElementRequest, &(*p)->elements,
192 &(*p)->num_elements) || odr_ok(o)) &&