Bump copyright year
[yaz-moved-to-github.git] / ztest / dummy-opac.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2010 Index Data
3  * See the file LICENSE for details.
4  */
5
6 /** \file
7  * \brief Little toy-thing to genearate an OPAC record with some values
8  */
9
10 #include <ctype.h>
11 #include <yaz/wrbuf.h>
12 #include <yaz/marcdisp.h>
13 #include <yaz/odr.h>
14
15 #include "ztest.h"
16
17 Z_OPACRecord *dummy_opac(int num, ODR odr, const char *marc_input)
18 {
19     Z_OPACRecord *rec;
20     int i;
21     rec = (Z_OPACRecord *) odr_malloc(odr, sizeof(*rec));
22     rec->bibliographicRecord =
23         z_ext_record_usmarc(odr, marc_input, strlen(marc_input));
24     rec->num_holdingsData = 1;
25     rec->holdingsData = (Z_HoldingsRecord **)
26         odr_malloc(odr, sizeof(*rec->holdingsData));
27     for (i = 0; i < rec->num_holdingsData; i++)
28     {
29         Z_HoldingsRecord *hr = (Z_HoldingsRecord *)
30             odr_malloc(odr, sizeof(*hr));
31         Z_HoldingsAndCircData *hc = (Z_HoldingsAndCircData *)
32             odr_malloc(odr, sizeof(*hc));
33         
34         rec->holdingsData[i] = hr;
35         hr->which = Z_HoldingsRecord_holdingsAndCirc;
36         hr->u.holdingsAndCirc = hc;
37             
38         hc->typeOfRecord = "u";
39
40         hc->encodingLevel = "u";
41
42         hc->format = 0; /* OPT */
43         hc->receiptAcqStatus = "0";
44         hc->generalRetention = 0; /* OPT */
45         hc->completeness = 0; /* OPT */
46         hc->dateOfReport = "000000";
47         hc->nucCode = "s-FM/GC";
48         hc->localLocation = 
49             "Main or Science/Business Reading Rms - STORED OFFSITE";
50         hc->shelvingLocation = 0; /* OPT */
51         hc->callNumber = "MLCM 89/00602 (N)";
52         hc->shelvingData = "FT MEADE";
53         hc->copyNumber = "Copy 1";
54         hc->publicNote = 0; /* OPT */
55         hc->reproductionNote = 0; /* OPT */
56         hc->termsUseRepro = 0; /* OPT */
57         hc->enumAndChron = 0; /* OPT */
58
59         hc->num_volumes = 0;
60         hc->volumes = 0;
61
62         hc->num_circulationData = 1;
63         hc->circulationData = (Z_CircRecord **)
64              odr_malloc(odr, sizeof(*hc->circulationData));
65         hc->circulationData[0] = (Z_CircRecord *)
66              odr_malloc(odr, sizeof(**hc->circulationData));
67
68         hc->circulationData[0]->availableNow = odr_booldup(odr, 1);
69         hc->circulationData[0]->availablityDate = 0;
70         hc->circulationData[0]->availableThru = 0;
71         hc->circulationData[0]->restrictions = 0;
72         hc->circulationData[0]->itemId = "1226176";
73         hc->circulationData[0]->renewable = odr_booldup(odr, 0);
74         hc->circulationData[0]->onHold = odr_booldup(odr, 0);
75         hc->circulationData[0]->enumAndChron = 0;
76         hc->circulationData[0]->midspine = 0;
77         hc->circulationData[0]->temporaryLocation = 0;
78     }
79     return rec;
80 }
81 /*
82  * Local variables:
83  * c-basic-offset: 4
84  * c-file-style: "Stroustrup"
85  * indent-tabs-mode: nil
86  * End:
87  * vim: shiftwidth=4 tabstop=8 expandtab
88  */
89