Fix.
[yaz-moved-to-github.git] / asn / prt-rsc.c
1 /*
2  * Copyright (c) 1995, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: prt-rsc.c,v $
7  * Revision 1.6  1998-02-11 11:53:32  adam
8  * Changed code so that it compiles as C++.
9  *
10  * Revision 1.5  1995/09/29 17:11:55  quinn
11  * Smallish
12  *
13  * Revision 1.4  1995/09/27  15:02:43  quinn
14  * Modified function heads & prototypes.
15  *
16  * Revision 1.3  1995/06/02  09:49:15  quinn
17  * Adding access control
18  *
19  * Revision 1.2  1995/06/01  14:34:53  quinn
20  * Work
21  *
22  * Revision 1.1  1995/06/01  11:22:17  quinn
23  * Resource control
24  *
25  *
26  */
27
28 #include <proto.h>
29
30 /* -------------------- Resource 1 ------------------------- */
31
32 int z_Estimate1(ODR o, Z_Estimate1 **p, int opt)
33 {
34     if (!odr_sequence_begin(o, p, sizeof(**p)))
35         return opt && odr_ok(o);
36     return
37         odr_implicit(o, odr_integer, &(*p)->type, ODR_CONTEXT, 1, 0) &&
38         odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 2, 0) &&
39         odr_implicit(o, odr_integer, &(*p)->currencyCode, ODR_CONTEXT, 3, 1) &&
40         odr_sequence_end(o);
41 }
42
43 int z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt)
44 {
45     if (!odr_sequence_begin(o, p, sizeof(**p)))
46         return opt && odr_ok(o);
47     return
48         odr_implicit_settag(o, ODR_CONTEXT, 1) &&
49         odr_sequence_of(o, (Odr_fun)z_Estimate1, &(*p)->estimates,
50             &(*p)->num_estimates) &&
51         odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 0) &&
52         odr_sequence_end(o);
53 }
54
55 /* -------------------- Resource 2 ------------------------- */
56
57 int z_StringOrNumeric(ODR, Z_StringOrNumeric **, int);
58 int z_IntUnit(ODR, Z_IntUnit **, int);
59
60 int z_Estimate2(ODR o, Z_Estimate2 **p, int opt)
61 {
62     if (!odr_sequence_begin(o, p, sizeof(**p)))
63         return opt && odr_ok(o);
64     return
65         odr_explicit(o, z_StringOrNumeric, &(*p)->type, ODR_CONTEXT, 1, 0) &&
66         odr_implicit(o, z_IntUnit, &(*p)->value, ODR_CONTEXT, 2, 0) &&
67         odr_sequence_end(o);
68 }
69
70 int z_ResourceReport2(ODR o, Z_ResourceReport2 **p, int opt)
71 {
72 if (!odr_sequence_begin(o, p, sizeof(**p)))
73     return opt && odr_ok(o);
74 return
75     odr_implicit_settag(o, ODR_CONTEXT, 1) &&
76     (odr_sequence_of(o, (Odr_fun)z_Estimate2, &(*p)->estimates,
77         &(*p)->num_estimates) || odr_ok(o)) &&
78     odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 1) &&
79     odr_sequence_end(o);
80 }
81
82