YAZ  5.23.1
z-opac.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/z-opac.h>
11 
12 int z_OPACRecord(ODR o, Z_OPACRecord **p, int opt, const char *name)
13 {
14  if (!odr_sequence_begin(o, p, sizeof(**p), name))
15  return odr_missing(o, opt, name) && odr_ok (o);
16  return
18  &(*p)->bibliographicRecord, ODR_CONTEXT, 1, 1, "bibliographicRecord") &&
20  (odr_sequence_of(o, (Odr_fun) z_HoldingsRecord, &(*p)->holdingsData,
21  &(*p)->num_holdingsData, "holdingsData") || odr_ok(o)) &&
23 }
24 
25 int z_HoldingsRecord(ODR o, Z_HoldingsRecord **p, int opt, const char *name)
26 {
27  static Odr_arm arm[] = {
29  (Odr_fun) z_External, "marcHoldingsRecord"},
31  (Odr_fun) z_HoldingsAndCircData, "holdingsAndCirc"},
32  {-1, -1, -1, -1, (Odr_fun) 0, 0}
33  };
34  if (!odr_initmember(o, p, sizeof(**p)))
35  return odr_missing(o, opt, name);
36  if (odr_choice(o, arm, &(*p)->u, &(*p)->which, name))
37  return 1;
38  if (o->direction == ODR_DECODE)
39  *p = 0;
40  return odr_missing(o, opt, name);
41 }
42 
44 {
45  if (!odr_sequence_begin(o, p, sizeof(**p), name))
46  return odr_missing(o, opt, name) && odr_ok (o);
47  return
49  &(*p)->typeOfRecord, ODR_CONTEXT, 1, 1, "typeOfRecord") &&
51  &(*p)->encodingLevel, ODR_CONTEXT, 2, 1, "encodingLevel") &&
53  &(*p)->format, ODR_CONTEXT, 3, 1, "format") &&
55  &(*p)->receiptAcqStatus, ODR_CONTEXT, 4, 1, "receiptAcqStatus") &&
57  &(*p)->generalRetention, ODR_CONTEXT, 5, 1, "generalRetention") &&
59  &(*p)->completeness, ODR_CONTEXT, 6, 1, "completeness") &&
61  &(*p)->dateOfReport, ODR_CONTEXT, 7, 1, "dateOfReport") &&
63  &(*p)->nucCode, ODR_CONTEXT, 8, 1, "nucCode") &&
65  &(*p)->localLocation, ODR_CONTEXT, 9, 1, "localLocation") &&
67  &(*p)->shelvingLocation, ODR_CONTEXT, 10, 1, "shelvingLocation") &&
69  &(*p)->callNumber, ODR_CONTEXT, 11, 1, "callNumber") &&
71  &(*p)->shelvingData, ODR_CONTEXT, 12, 1, "shelvingData") &&
73  &(*p)->copyNumber, ODR_CONTEXT, 13, 1, "copyNumber") &&
75  &(*p)->publicNote, ODR_CONTEXT, 14, 1, "publicNote") &&
77  &(*p)->reproductionNote, ODR_CONTEXT, 15, 1, "reproductionNote") &&
79  &(*p)->termsUseRepro, ODR_CONTEXT, 16, 1, "termsUseRepro") &&
81  &(*p)->enumAndChron, ODR_CONTEXT, 17, 1, "enumAndChron") &&
83  (odr_sequence_of(o, (Odr_fun) z_Volume, &(*p)->volumes,
84  &(*p)->num_volumes, "volumes") || odr_ok(o)) &&
86  (odr_sequence_of(o, (Odr_fun) z_CircRecord, &(*p)->circulationData,
87  &(*p)->num_circulationData, "circulationData") || odr_ok(o)) &&
89 }
90 
91 int z_Volume(ODR o, Z_Volume **p, int opt, const char *name)
92 {
93  if (!odr_sequence_begin(o, p, sizeof(**p), name))
94  return odr_missing(o, opt, name) && odr_ok (o);
95  return
97  &(*p)->enumeration, ODR_CONTEXT, 1, 1, "enumeration") &&
99  &(*p)->chronology, ODR_CONTEXT, 2, 1, "chronology") &&
101  &(*p)->enumAndChron, ODR_CONTEXT, 3, 1, "enumAndChron") &&
102  odr_sequence_end(o);
103 }
104 
105 int z_CircRecord(ODR o, Z_CircRecord **p, int opt, const char *name)
106 {
107  if (!odr_sequence_begin(o, p, sizeof(**p), name))
108  return odr_missing(o, opt, name) && odr_ok (o);
109  return
111  &(*p)->availableNow, ODR_CONTEXT, 1, 0, "availableNow") &&
113  &(*p)->availablityDate, ODR_CONTEXT, 2, 1, "availablityDate") &&
115  &(*p)->availableThru, ODR_CONTEXT, 3, 1, "availableThru") &&
117  &(*p)->restrictions, ODR_CONTEXT, 4, 1, "restrictions") &&
119  &(*p)->itemId, ODR_CONTEXT, 5, 1, "itemId") &&
121  &(*p)->renewable, ODR_CONTEXT, 6, 0, "renewable") &&
123  &(*p)->onHold, ODR_CONTEXT, 7, 0, "onHold") &&
125  &(*p)->enumAndChron, ODR_CONTEXT, 8, 1, "enumAndChron") &&
127  &(*p)->midspine, ODR_CONTEXT, 9, 1, "midspine") &&
129  &(*p)->temporaryLocation, ODR_CONTEXT, 10, 1, "temporaryLocation") &&
130  odr_sequence_end(o);
131 }
#define odr_ok(o)
Definition: odr.h:215
int z_CircRecord(ODR o, Z_CircRecord **p, int opt, const char *name)
Definition: z-opac.c:105
int z_Volume(ODR o, Z_Volume **p, int opt, const char *name)
Definition: z-opac.c:91
int z_HoldingsAndCircData(ODR o, Z_HoldingsAndCircData **p, int opt, const char *name)
Definition: z-opac.c:43
#define odr_implicit_tag(o, t, p, cl, tg, opt, name)
Definition: odr.h:192
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
#define Z_HoldingsRecord_marcHoldingsRecord
Definition: z-opac.h:47
char * name
Definition: initopt.c:18
int z_HoldingsRecord(ODR o, Z_HoldingsRecord **p, int opt, const char *name)
Definition: z-opac.c:25
#define Z_HoldingsRecord_holdingsAndCirc
Definition: z-opac.h:48
int z_External(ODR o, Z_External **p, int opt, const char *name)
codec for BER EXTERNAL
Definition: prt-ext.c:95
int odr_initmember(ODR o, void *p, int size)
Definition: odr_tag.c:44
int direction
Definition: odr.h:126
int odr_bool(ODR o, Odr_bool **p, int opt, const char *name)
Definition: odr_bool.c:21
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num, const char *name)
Definition: odr_seq.c:134
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int which
Definition: odr.h:142
Definition: odr.h:137
int z_OPACRecord(ODR o, Z_OPACRecord **p, int opt, const char *name)
Definition: z-opac.c:12
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
ASN.1 Module RecordSyntax-opac.
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
int z_InternationalString(ODR o, Z_InternationalString **p, int opt, const char *name)
Definition: z-core.c:1598
#define ODR_CONTEXT
Definition: odr.h:67
#define ODR_DECODE
Definition: odr.h:95
int odr_implicit_settag(ODR o, int zclass, int tag)
Definition: odr_tag.c:32