YAZ  5.34.0
Macros | Functions | Variables
read-marc.c File Reference

Little toy-thing to read MARC records from a fixed array. More...

#include <yaz/wrbuf.h>
#include <yaz/marcdisp.h>
#include <yaz/odr.h>
#include <yaz/log.h>
#include "ztest.h"
#include <stdlib.h>

Go to the source code of this file.

Macros

#define NO_MARC_RECORDS   23
 
#define PZ_CBEGIN   "<pz:cluster xmlns:pz=\"http://www.indexdata.com/pazpar2/1.0\">\n"
 
#define PZ_CEND   "</pz:cluster>\n"
 
#define PZ_BEGIN   "<record xmlns=\"http://www.indexdata.com/pazpar2/1.0\">\n"
 
#define PZ_END   "</record>\n"
 
#define PZ_METADATA(x, y)   " <metadata type=\"" #x "\">" y "</metadata>\n"
 

Functions

char * dummy_marc_record (int num, ODR odr)
 
static char * dummy_pz2_record (int num, ODR odr)
 
char * dummy_xml_record (int num, ODR odr, const char *esn)
 
char * dummy_json_record (int num, ODR odr, const char *esn)
 

Variables

char * marc_records [NO_MARC_RECORDS]
 
static char * marc_record0
 

Detailed Description

Little toy-thing to read MARC records from a fixed array.

Definition in file read-marc.c.

Macro Definition Documentation

◆ NO_MARC_RECORDS

#define NO_MARC_RECORDS   23

Definition at line 34 of file read-marc.c.

◆ PZ_BEGIN

#define PZ_BEGIN   "<record xmlns=\"http://www.indexdata.com/pazpar2/1.0\">\n"

Definition at line 1553 of file read-marc.c.

◆ PZ_CBEGIN

#define PZ_CBEGIN   "<pz:cluster xmlns:pz=\"http://www.indexdata.com/pazpar2/1.0\">\n"

Definition at line 1551 of file read-marc.c.

◆ PZ_CEND

#define PZ_CEND   "</pz:cluster>\n"

Definition at line 1552 of file read-marc.c.

◆ PZ_END

#define PZ_END   "</record>\n"

Definition at line 1554 of file read-marc.c.

◆ PZ_METADATA

#define PZ_METADATA (   x,
  y 
)    " <metadata type=\"" #x "\">" y "</metadata>\n"

Definition at line 1555 of file read-marc.c.

Function Documentation

◆ dummy_json_record()

char* dummy_json_record ( int  num,
ODR  odr,
const char *  esn 
)

◆ dummy_marc_record()

char* dummy_marc_record ( int  num,
ODR  odr 
)

Definition at line 1536 of file read-marc.c.

References marc_record0, marc_records, NO_MARC_RECORDS, and odr_strdup().

Referenced by dummy_json_record(), dummy_xml_record(), and ztest_fetch().

◆ dummy_pz2_record()

static char* dummy_pz2_record ( int  num,
ODR  odr 
)
static

Definition at line 1557 of file read-marc.c.

References odr_strdup(), PZ_BEGIN, PZ_CBEGIN, PZ_CEND, PZ_END, and PZ_METADATA.

Referenced by dummy_xml_record().

◆ dummy_xml_record()

char* dummy_xml_record ( int  num,
ODR  odr,
const char *  esn 
)

Variable Documentation

◆ marc_record0

char* marc_record0
static
Initial value:
=
"00366nam a220016"
"98a 450000100130"
"0000003000400013"
"0050017000170080"
"0410003401000170"
"0179040001300075"
"0500012000881000"
"0170010024500300"
"0117260001200147"
"2630009001593000"
"01100168" "\x1E" " 1122"
"4466 " "\x1E" "DLC" "\x1E" "000000"
"00000000.0" "\x1E" "91071"
"0c19910701nju "
" 00010 en"
"g " "\x1E" " " "\x1F" "aDLC" "\x1F" "cDLC"
"" "\x1E" "00" "\x1F" "a123-\xC3\x98" "x" "\x1E" "10" "\x1F" ""
"aJack Collins" "\x1E" "10"
"" "\x1F" "aHow to program"
" a computer" "\x1E" "1 " "\x1F" "a"
"Penguin" "\x1E" " " "\x1F" "a8710"
"" "\x1E" " " "\x1F" "ap. cm." "\x1E" " " "\x1F" "a"
" 11224466 " "\x1E" "" "\x1D" ""

Definition at line 1509 of file read-marc.c.

Referenced by dummy_marc_record().

◆ marc_records

char* marc_records[NO_MARC_RECORDS]

Definition at line 36 of file read-marc.c.

Referenced by dummy_marc_record().