Fix.
[yaz-moved-to-github.git] / asn / prt-univ.c
1 /*
2  * Copyright (c) 1998, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: prt-univ.c,v $
7  * Revision 1.1  1998-03-20 14:46:06  adam
8  * Added UNIverse Resource Reports.
9  *
10  */
11
12 #include <proto.h>
13
14 /* YC 0.1 Fri Mar 20 14:28:54 CET 1998 */
15 /* Module-C: ResourceReport-Format-Universe-1 */
16
17 int z_UniverseReportHits (ODR o, Z_UniverseReportHits **p, int opt)
18 {
19         if (!odr_sequence_begin (o, p, sizeof(**p)))
20                 return opt && odr_ok (o);
21         return
22                 z_StringOrNumeric(o, &(*p)->database, 0) &&
23                 z_StringOrNumeric(o, &(*p)->hits, 0) &&
24                 odr_sequence_end (o);
25 }
26
27 int z_UniverseReportDuplicate (ODR o, Z_UniverseReportDuplicate **p, int opt)
28 {
29         if (!odr_sequence_begin (o, p, sizeof(**p)))
30                 return opt && odr_ok (o);
31         return
32                 z_StringOrNumeric(o, &(*p)->hitno, 0) &&
33                 odr_sequence_end (o);
34 }
35
36 int z_UniverseReport (ODR o, Z_UniverseReport **p, int opt)
37 {
38         static Odr_arm arm[] = {
39                 {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_UniverseReport_databaseHits,
40                 (Odr_fun) z_UniverseReportHits},
41                 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_UniverseReport_duplicate,
42                 (Odr_fun) z_UniverseReportDuplicate},
43                 {-1, -1, -1, -1, (Odr_fun) 0}
44         };
45         if (!odr_sequence_begin (o, p, sizeof(**p)))
46                 return opt && odr_ok (o);
47         return
48                 odr_integer(o, &(*p)->totalHits, 0) &&
49                 odr_choice (o, arm, &(*p)->u, &(*p)->which) &&
50                 odr_sequence_end (o);
51 }
52