YAZ  5.23.1
dummy-opac.c
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data
3  * See the file LICENSE for details.
4  */
8 #if HAVE_CONFIG_H
9 #include <config.h>
10 #endif
11 
12 #include <yaz/wrbuf.h>
13 #include <yaz/marcdisp.h>
14 #include <yaz/odr.h>
15 
16 #include "ztest.h"
17 
18 Z_OPACRecord *dummy_opac(int num, ODR odr, const char *marc_input)
19 {
20  Z_OPACRecord *rec;
21  int i;
22  rec = (Z_OPACRecord *) odr_malloc(odr, sizeof(*rec));
23  rec->bibliographicRecord =
24  z_ext_record_usmarc(odr, marc_input, strlen(marc_input));
25  rec->num_holdingsData = 1;
26  rec->holdingsData = (Z_HoldingsRecord **)
27  odr_malloc(odr, sizeof(*rec->holdingsData));
28  for (i = 0; i < rec->num_holdingsData; i++)
29  {
31  odr_malloc(odr, sizeof(*hr));
33  odr_malloc(odr, sizeof(*hc));
34 
35  rec->holdingsData[i] = hr;
37  hr->u.holdingsAndCirc = hc;
38 
39  hc->typeOfRecord = "u";
40 
41  hc->encodingLevel = "u";
42 
43  hc->format = 0; /* OPT */
44  hc->receiptAcqStatus = "0";
45  hc->generalRetention = 0; /* OPT */
46  hc->completeness = 0; /* OPT */
47  hc->dateOfReport = "000000";
48  hc->nucCode = "s-FM/GC";
49  hc->localLocation =
50  "Main or Science/Business Reading Rms - STORED OFFSITE";
51  hc->shelvingLocation = 0; /* OPT */
52  hc->callNumber = "MLCM 89/00602 (N)";
53  hc->shelvingData = "FT MEADE";
54  hc->copyNumber = "Copy 1";
55  hc->publicNote = 0; /* OPT */
56  hc->reproductionNote = 0; /* OPT */
57  hc->termsUseRepro = 0; /* OPT */
58  hc->enumAndChron = 0; /* OPT */
59 
60  hc->num_volumes = 0;
61  hc->volumes = 0;
62 
63  hc->num_circulationData = 1;
64  hc->circulationData = (Z_CircRecord **)
65  odr_malloc(odr, sizeof(*hc->circulationData));
66  hc->circulationData[0] = (Z_CircRecord *)
67  odr_malloc(odr, sizeof(**hc->circulationData));
68 
69  hc->circulationData[0]->availableNow = odr_booldup(odr, 1);
70  hc->circulationData[0]->availablityDate = 0;
71  hc->circulationData[0]->availableThru = 0;
72  hc->circulationData[0]->restrictions = 0;
73  hc->circulationData[0]->itemId = "1226176";
74  hc->circulationData[0]->renewable = odr_booldup(odr, 0);
75  hc->circulationData[0]->onHold = odr_booldup(odr, 0);
76  hc->circulationData[0]->enumAndChron = 0;
77  hc->circulationData[0]->midspine = 0;
79  }
80  return rec;
81 }
82 /*
83  * Local variables:
84  * c-basic-offset: 4
85  * c-file-style: "Stroustrup"
86  * indent-tabs-mode: nil
87  * End:
88  * vim: shiftwidth=4 tabstop=8 expandtab
89  */
90 
Z_InternationalString * typeOfRecord
Definition: z-opac.h:53
Header for ODR (Open Data Representation)
MARC conversion.
Z_InternationalString * availablityDate
Definition: z-opac.h:84
Z_InternationalString * enumAndChron
Definition: z-opac.h:69
Header for WRBUF (growing buffer)
Z_InternationalString * shelvingData
Definition: z-opac.h:64
Z_InternationalString * copyNumber
Definition: z-opac.h:65
Odr_bool * availableNow
Definition: z-opac.h:83
Odr_bool * renewable
Definition: z-opac.h:88
Z_InternationalString * localLocation
Definition: z-opac.h:61
Z_InternationalString * nucCode
Definition: z-opac.h:60
Z_InternationalString * shelvingLocation
Definition: z-opac.h:62
#define Z_HoldingsRecord_holdingsAndCirc
Definition: z-opac.h:48
Z_InternationalString * generalRetention
Definition: z-opac.h:57
Odr_bool * onHold
Definition: z-opac.h:89
Z_InternationalString * format
Definition: z-opac.h:55
Z_InternationalString * reproductionNote
Definition: z-opac.h:67
void * odr_malloc(ODR o, size_t size)
Definition: odr_mem.c:31
union Z_HoldingsRecord::@106 u
Z_InternationalString * restrictions
Definition: z-opac.h:86
Z_InternationalString * itemId
Definition: z-opac.h:87
Z_External * bibliographicRecord
Definition: z-opac.h:37
Z_InternationalString * publicNote
Definition: z-opac.h:66
Z_InternationalString * dateOfReport
Definition: z-opac.h:59
Z_HoldingsAndCircData * holdingsAndCirc
Definition: z-opac.h:46
Internal header for yaz-ztest.
Z_InternationalString * termsUseRepro
Definition: z-opac.h:68
Z_InternationalString * availableThru
Definition: z-opac.h:85
Z_InternationalString * temporaryLocation
Definition: z-opac.h:92
Definition: odr.h:124
Z_InternationalString * callNumber
Definition: z-opac.h:63
Z_InternationalString * encodingLevel
Definition: z-opac.h:54
Z_External * z_ext_record_usmarc(ODR o, const char *buf, int len)
encodes EXTERNAL USMARC/MARC21 record
Definition: prt-ext.c:378
Z_HoldingsRecord ** holdingsData
Definition: z-opac.h:39
Z_InternationalString * receiptAcqStatus
Definition: z-opac.h:56
int num_holdingsData
Definition: z-opac.h:38
Z_OPACRecord * dummy_opac(int num, ODR odr, const char *marc_input)
Definition: dummy-opac.c:18
Z_Volume ** volumes
Definition: z-opac.h:71
Z_InternationalString * completeness
Definition: z-opac.h:58
Z_InternationalString * enumAndChron
Definition: z-opac.h:90
Z_CircRecord ** circulationData
Definition: z-opac.h:73
Z_InternationalString * midspine
Definition: z-opac.h:91
Odr_bool * odr_booldup(ODR o, Odr_bool v)
Definition: odr_mem.c:56