b9aaaaf70c03c9d81f029e03c761eb84cddb932e
[yaz-moved-to-github.git] / z39.50 / zes-pset.c
1 /* YC 0.2 Tue Feb 29 16:45:07 CET 2000 */
2 /* Module-C: ESFormat-PersistentResultSet */
3
4 #include <yaz/zes-pset.h>
5
6 int z_PRPersistentResultSetEsRequest (ODR o, Z_PRPersistentResultSetEsRequest **p, int opt, const char *name)
7 {
8         if (!odr_sequence_begin (o, p, sizeof(**p), name))
9                 return opt && odr_ok (o);
10         return
11                 odr_implicit_tag (o, odr_null,
12                         &(*p)->toKeep, ODR_CONTEXT, 1, 0, "toKeep") &&
13                 odr_explicit_tag (o, z_PROriginPartNotToKeep,
14                         &(*p)->notToKeep, ODR_CONTEXT, 2, 1, "notToKeep") &&
15                 odr_sequence_end (o);
16 }
17
18 int z_PRPersistentResultSetTaskPackage (ODR o, Z_PRPersistentResultSetTaskPackage **p, int opt, const char *name)
19 {
20         if (!odr_sequence_begin (o, p, sizeof(**p), name))
21                 return opt && odr_ok (o);
22         return
23                 odr_implicit_tag (o, odr_null,
24                         &(*p)->originPart, ODR_CONTEXT, 1, 0, "originPart") &&
25                 odr_explicit_tag (o, z_PRTargetPart,
26                         &(*p)->targetPart, ODR_CONTEXT, 2, 1, "targetPart") &&
27                 odr_sequence_end (o);
28 }
29
30 int z_PRPersistentResultSet (ODR o, Z_PRPersistentResultSet **p, int opt, const char *name)
31 {
32         static Odr_arm arm[] = {
33                 {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PRPersistentResultSet_esRequest,
34                 (Odr_fun) z_PRPersistentResultSetEsRequest, "esRequest"},
35                 {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PRPersistentResultSet_taskPackage,
36                 (Odr_fun) z_PRPersistentResultSetTaskPackage, "taskPackage"},
37                 {-1, -1, -1, -1, (Odr_fun) 0, 0}
38         };
39         if (!odr_initmember(o, p, sizeof(**p)))
40                 return opt && odr_ok(o);
41         if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
42                 return 1;
43         *p = 0;
44         return opt && odr_ok(o);
45 }
46
47 int z_PROriginPartNotToKeep (ODR o, Z_PROriginPartNotToKeep **p, int opt, const char *name)
48 {
49         if (!odr_sequence_begin (o, p, sizeof(**p), name))
50                 return opt && odr_ok (o);
51         return
52                 odr_implicit_tag (o, z_InternationalString,
53                         &(*p)->originSuppliedResultSet, ODR_CONTEXT, 1, 1, "originSuppliedResultSet") &&
54                 odr_implicit_tag (o, odr_integer,
55                         &(*p)->replaceOrAppend, ODR_CONTEXT, 2, 1, "replaceOrAppend") &&
56                 odr_sequence_end (o);
57 }
58
59 int z_PRTargetPart (ODR o, Z_PRTargetPart **p, int opt, const char *name)
60 {
61         if (!odr_sequence_begin (o, p, sizeof(**p), name))
62                 return opt && odr_ok (o);
63         return
64                 odr_implicit_tag (o, z_InternationalString,
65                         &(*p)->targetSuppliedResultSet, ODR_CONTEXT, 1, 1, "targetSuppliedResultSet") &&
66                 odr_implicit_tag (o, odr_integer,
67                         &(*p)->numberOfRecords, ODR_CONTEXT, 2, 1, "numberOfRecords") &&
68                 odr_sequence_end (o);
69 }