Updated information about YAZ.
[yaz-moved-to-github.git] / asn / prt-univ.c
1 /*
2  * Copyright (c) 1998-1999, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: prt-univ.c,v $
7  * Revision 1.3  1999-11-30 13:47:11  adam
8  * Improved installation. Moved header files to include/yaz.
9  *
10  * Revision 1.2  1999/04/20 09:56:48  adam
11  * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
12  * Modified all encoders/decoders to reflect this change.
13  *
14  * Revision 1.1  1998/03/20 14:46:06  adam
15  * Added UNIverse Resource Reports.
16  *
17  */
18
19 #include <yaz/proto.h>
20
21 int z_UniverseReportHits (ODR o, Z_UniverseReportHits **p, int opt,
22                           const char *name)
23 {
24     if (!odr_sequence_begin (o, p, sizeof(**p), 0))
25         return opt && odr_ok (o);
26     return
27         z_StringOrNumeric(o, &(*p)->database, 0, 0) &&
28         z_StringOrNumeric(o, &(*p)->hits, 0, 0) &&
29         odr_sequence_end (o);
30 }
31
32 int z_UniverseReportDuplicate (ODR o, Z_UniverseReportDuplicate **p, int opt,
33                                const char *name)
34 {
35     if (!odr_sequence_begin (o, p, sizeof(**p), 0))
36         return opt && odr_ok (o);
37     return
38         z_StringOrNumeric(o, &(*p)->hitno, 0, 0) &&
39         odr_sequence_end (o);
40 }
41
42 int z_UniverseReport (ODR o, Z_UniverseReport **p, int opt, const char *name)
43 {
44     static Odr_arm arm[] = {
45         {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_UniverseReport_databaseHits,
46          (Odr_fun) z_UniverseReportHits, 0},
47         {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_UniverseReport_duplicate,
48          (Odr_fun) z_UniverseReportDuplicate, 0},
49         {-1, -1, -1, -1, (Odr_fun) 0, 0}
50     };
51     if (!odr_sequence_begin (o, p, sizeof(**p), 0))
52         return opt && odr_ok (o);
53     return
54         odr_integer(o, &(*p)->totalHits, 0, 0) &&
55         odr_choice (o, arm, &(*p)->u, &(*p)->which, 0) &&
56         odr_sequence_end (o);
57 }
58