+int z_ByDatabase(ODR o, Z_ByDatabase **p, int opt, const char *name)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p), 0))
+ return opt && odr_ok(o);
+ return
+ z_DatabaseName(o, &(*p)->db, 1, 0) &&
+ odr_implicit(o, odr_integer, &(*p)->num, ODR_CONTEXT, 1, 1) &&
+ z_OtherInformation(o, &(*p)->otherDbInfo, 1, 0) &&
+ odr_sequence_end(o);
+}
+
+int z_ByDatabaseList(ODR o, Z_ByDatabaseList **p, int opt, const char *name)
+{
+ if (!odr_initmember(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ if (odr_sequence_of(o, (Odr_fun)z_ByDatabase, &(*p)->elements,
+ &(*p)->num_elements, 0))
+ return 1;
+ *p = 0;
+ return opt && odr_ok(o);
+}
+
+int z_ScanOccurrences(ODR o, Z_ScanOccurrences **p, int opt, const char *name)
+{
+ Odr_arm arm[] =
+ {
+ {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global,
+ (Odr_fun)odr_integer, 0},
+ {ODR_EXPLICIT, ODR_CONTEXT, 3, Z_ScanOccurrences_byDatabase,
+ (Odr_fun)z_ByDatabaseList, 0},
+ {-1, -1, -1, -1, 0, 0}
+ };
+
+ if (!odr_initmember(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
+ return 1;
+ *p = 0;
+ return opt && odr_ok(o);
+}
+
+int z_OccurrenceByAttributesElem(ODR o, Z_OccurrenceByAttributesElem **p,
+ int opt, const char *name)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p), 0))
+ return opt && odr_ok(o);
+ return
+ odr_explicit(o, z_AttributeList, &(*p)->attributes, ODR_CONTEXT,
+ 1, 1) &&
+ z_ScanOccurrences(o, &(*p)->occurrences, 1, 0) &&
+ z_OtherInformation(o, &(*p)->otherOccurInfo, 1, 0) &&
+ odr_sequence_end(o);
+}
+
+int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt, const char *name)
+{
+ if (!odr_initmember(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ if (!odr_sequence_of(o, (Odr_fun)z_OccurrenceByAttributesElem,
+ &(*p)->elements, &(*p)->num_elements, 0))
+ return 1;
+ *p = 0;
+ return opt && odr_ok(o);
+}
+
+int z_TermInfo(ODR o, Z_TermInfo **p, int opt, const char *name)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p), 0))
+ return opt && odr_ok(o);
+ return
+ (willow_scan ?
+ odr_implicit(o, z_Term, &(*p)->term, ODR_CONTEXT, 1, 0) :
+ z_Term(o, &(*p)->term, 0, 0)) &&
+ odr_implicit(o, z_InternationalString, &(*p)->displayTerm, ODR_CONTEXT,
+ 0, 1) &&
+ z_AttributeList(o, &(*p)->suggestedAttributes, 1, 0) &&
+ odr_implicit(o, z_AlternativeTerm, &(*p)->alternativeTerm,
+ ODR_CONTEXT, 4, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->globalOccurrences, ODR_CONTEXT,
+ 2, 1) &&
+ odr_implicit(o, z_OccurrenceByAttributes, &(*p)->byAttributes,
+ ODR_CONTEXT, 3, 1) &&
+ z_OtherInformation(o, &(*p)->otherTermInfo, 1, 0) &&
+ odr_sequence_end(o);
+}
+
+int z_Entry(ODR o, Z_Entry **p, int opt, const char *name)
+{
+ static Odr_arm arm[] =
+ {
+ {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo,
+ (Odr_fun)z_TermInfo, 0},
+ {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic,
+ (Odr_fun)z_DiagRec, 0},
+ {-1, -1, -1, -1, 0, 0}
+ };
+
+ if (o->direction == ODR_DECODE)
+ *p = (Z_Entry *)odr_malloc(o, sizeof(**p));
+ else if (!*p)
+ return opt;
+
+ if (odr_choice(o, arm, &(*p)->u, &(*p)->which, 0))
+ return 1;
+ *p = 0;
+ return opt && odr_ok(o);
+}
+
+int z_ListEntries (ODR o, Z_ListEntries **p, int opt, const char *name)
+{
+ if (!odr_sequence_begin (o, p, sizeof(**p), 0))
+ return opt && odr_ok (o);
+ return
+ odr_implicit_settag (o, ODR_CONTEXT, 1) &&
+ (odr_sequence_of(o, (Odr_fun) z_Entry, &(*p)->entries,
+ &(*p)->num_entries, 0) || odr_ok(o)) &&
+ odr_implicit_settag (o, ODR_CONTEXT, 2) &&
+ (odr_sequence_of(o, (Odr_fun) z_DiagRec,
+ &(*p)->nonsurrogateDiagnostics,
+ &(*p)->num_nonsurrogateDiagnostics, 0)
+ || odr_ok(o)) &&
+ odr_sequence_end (o);
+}
+
+int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt, const char *name)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p), 0))
+ return opt && odr_ok(o);
+ willow_scan = 0;
+ return
+ z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
+ odr_implicit_settag(o, ODR_CONTEXT, 3) &&
+ odr_sequence_of(o, z_DatabaseName, &(*p)->databaseNames,
+ &(*p)->num_databaseNames, 0) &&
+ odr_oid(o, &(*p)->attributeSet, 1, 0) &&
+ (z_AttributesPlusTerm(o, &(*p)->termListAndStartPoint, 1, 0) ?
+ ((*p)->termListAndStartPoint ? 1 :
+ z_WillowAttributesPlusTerm(o, &(*p)->termListAndStartPoint, 0, 0))
+ : 0) &&
+ odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 5, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->numberOfTermsRequested,
+ ODR_CONTEXT, 6, 0) &&
+ odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse,
+ ODR_CONTEXT, 7, 1) &&
+ z_OtherInformation(o, &(*p)->otherInfo, 1, "otherInfo") &&
+ odr_sequence_end(o);
+}
+
+int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt, const char *name)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p), 0))
+ return opt && odr_ok(o);
+ return
+ z_ReferenceId(o, &(*p)->referenceId, 1, 0) &&
+ odr_implicit(o, odr_integer, &(*p)->stepSize, ODR_CONTEXT, 3, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->scanStatus, ODR_CONTEXT, 4, 0) &&
+ odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned,
+ ODR_CONTEXT, 5, 0) &&
+ odr_implicit(o, odr_integer, &(*p)->positionOfTerm,
+ ODR_CONTEXT, 6, 1) &&
+ odr_implicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) &&
+ odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) &&
+ z_OtherInformation(o, &(*p)->otherInfo, 1, 0) &&
+ odr_sequence_end(o);
+}
+