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