pazpar2  1.14.1
marchash.h
Go to the documentation of this file.
1 /* This file is part of Pazpar2.
2  Copyright (C) Index Data
3 
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8 
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 #ifndef MARCHASH_H
21 #define MARCHASH_H
22 
23 #define MARCHASH_MASK 127
24 
25 struct marchash
26 {
28  NMEM nmem;
29 };
30 
31 struct marcfield
32 {
33  char key[4];
34  char *val;
36  struct marcfield *next;
37 };
38 
40 {
41  char key;
42  char *val;
43  struct marcsubfield *next;
44 };
45 
46 struct marchash *marchash_create (NMEM nmem);
47 void marchash_ingest_marcxml (struct marchash *marchash, xmlNodePtr rec_node);
49  const char *key, const char *value);
50 struct marcsubfield *marchash_add_subfield (struct marchash *marchash, struct marcfield *field, const char key, const char *value);
51 struct marcfield *marchash_get_field (struct marchash *marchash, const char *key, struct marcfield *last);
52 struct marcsubfield *marchash_get_subfield (char key, struct marcfield *field, struct marcsubfield *last);
53 
54 char *marchash_catenate_subfields(struct marcfield *field,
55  const char *delim, NMEM nmem);
56 
57 #endif
58 /*
59  * Local variables:
60  * c-basic-offset: 4
61  * c-file-style: "Stroustrup"
62  * indent-tabs-mode: nil
63  * End:
64  * vim: shiftwidth=4 tabstop=8 expandtab
65  */
#define MARCHASH_MASK
Definition: marchash.h:23
char * marchash_catenate_subfields(struct marcfield *field, const char *delim, NMEM nmem)
Definition: marchash.c:243
struct marcsubfield * marchash_add_subfield(struct marchash *marchash, struct marcfield *field, const char key, const char *value)
Definition: marchash.c:179
struct marcsubfield * marchash_get_subfield(char key, struct marcfield *field, struct marcsubfield *last)
Definition: marchash.c:225
struct marcfield * marchash_get_field(struct marchash *marchash, const char *key, struct marcfield *last)
Definition: marchash.c:208
struct marcfield * marchash_add_field(struct marchash *marchash, const char *key, const char *value)
Definition: marchash.c:141
struct marchash * marchash_create(NMEM nmem)
Definition: marchash.c:75
void marchash_ingest_marcxml(struct marchash *marchash, xmlNodePtr rec_node)
Definition: marchash.c:84
struct marcfield * next
Definition: marchash.h:36
char * val
Definition: marchash.h:34
struct marcsubfield * subfields
Definition: marchash.h:35
char key[4]
Definition: marchash.h:33
struct marcfield * table[MARCHASH_MASK+1]
Definition: marchash.h:27
NMEM nmem
Definition: marchash.h:28
char key
Definition: marchash.h:41
struct marcsubfield * next
Definition: marchash.h:43
char * val
Definition: marchash.h:42