Modified Data1-system to use nmem
[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.5  1995-09-29 17:11:55  quinn
8  * Smallish
9  *
10  * Revision 1.4  1995/09/27  15:02:43  quinn
11  * Modified function heads & prototypes.
12  *
13  * Revision 1.3  1995/06/02  09:49:15  quinn
14  * Adding access control
15  *
16  * Revision 1.2  1995/06/01  14:34:53  quinn
17  * Work
18  *
19  * Revision 1.1  1995/06/01  11:22:17  quinn
20  * Resource control
21  *
22  *
23  */
24
25 #include <proto.h>
26
27 /* -------------------- Resource 1 ------------------------- */
28
29 int z_Estimate1(ODR o, Z_Estimate1 **p, int opt)
30 {
31     if (!odr_sequence_begin(o, p, sizeof(**p)))
32         return opt && odr_ok(o);
33     return
34         odr_implicit(o, odr_integer, &(*p)->type, ODR_CONTEXT, 1, 0) &&
35         odr_implicit(o, odr_integer, &(*p)->value, ODR_CONTEXT, 2, 0) &&
36         odr_implicit(o, odr_integer, &(*p)->currencyCode, ODR_CONTEXT, 3, 1) &&
37         odr_sequence_end(o);
38 }
39
40 int z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt)
41 {
42     if (!odr_sequence_begin(o, p, sizeof(**p)))
43         return opt && odr_ok(o);
44     return
45         odr_implicit_settag(o, ODR_CONTEXT, 1) &&
46         odr_sequence_of(o, z_Estimate1, &(*p)->estimates,
47             &(*p)->num_estimates) &&
48         odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 0) &&
49         odr_sequence_end(o);
50 }
51
52 /* -------------------- Resource 2 ------------------------- */
53
54 int z_StringOrNumeric(ODR, Z_StringOrNumeric **, int);
55 int z_IntUnit(ODR, Z_IntUnit **, int);
56
57 int z_Estimate2(ODR o, Z_Estimate2 **p, int opt)
58 {
59     if (!odr_sequence_begin(o, p, sizeof(**p)))
60         return opt && odr_ok(o);
61     return
62         odr_explicit(o, z_StringOrNumeric, &(*p)->type, ODR_CONTEXT, 1, 0) &&
63         odr_implicit(o, z_IntUnit, &(*p)->value, ODR_CONTEXT, 2, 0) &&
64         odr_sequence_end(o);
65 }
66
67 int z_ResourceReport2(ODR o, Z_ResourceReport2 **p, int opt)
68 {
69 if (!odr_sequence_begin(o, p, sizeof(**p)))
70     return opt && odr_ok(o);
71 return
72     odr_implicit_settag(o, ODR_CONTEXT, 1) &&
73     (odr_sequence_of(o, z_Estimate2, &(*p)->estimates,
74         &(*p)->num_estimates) || odr_ok(o)) &&
75     odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 1) &&
76     odr_sequence_end(o);
77 }
78
79