IDZEBRA  2.2.7
marcomp.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
4 Zebra 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 Zebra 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 #ifndef MARCOMP_H
20 #define MARCOMP_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef struct mc_subfield
27 {
28  char *name;
29  char *prefix;
30  char *suffix;
31  struct {
32  int start;
33  int end;
35  int which;
36  union {
37 #define MC_SF 1
38 #define MC_SFGROUP 2
39 #define MC_SFVARIANT 3
40  struct mc_field *in_line;
41  struct mc_subfield *child;
42  } u;
43  struct mc_subfield *next;
46 
47 #define SZ_FNAME 3
48 #define SZ_IND 1
49 #define SZ_SFNAME 1
50 #define SZ_PREFIX 1
51 #define SZ_SUFFIX 1
52 
53 typedef struct mc_field
54 {
55  char *name;
56  char *ind1;
57  char *ind2;
58  struct {
59  int start;
60  int end;
62  struct mc_subfield *list;
64 
65 typedef enum
66 {
67  NOP,
78 } mc_token;
79 
80 typedef enum
81 {
82  EMCOK = 0, /* first always, mondatory */
89  EMCEND /* last always, mondatory */
91 
92 typedef struct mc_context
93 {
94  int offset;
95 
96  int crrval;
98 
100 
101  int len;
102  const char *data;
104 
105 mc_context *mc_mk_context(const char *s);
107 
109 void mc_destroy_field(mc_field *p);
110 void mc_pr_field(mc_field *p, int offset);
111 
115 void mc_pr_subfields(mc_subfield *p, int offset);
116 
118 const char *mc_error(mc_errcode no);
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif
125 /*
126  * Local variables:
127  * c-basic-offset: 4
128  * c-file-style: "Stroustrup"
129  * indent-tabs-mode: nil
130  * End:
131  * vim: shiftwidth=4 tabstop=8 expandtab
132  */
133 
void mc_destroy_field(mc_field *p)
Definition: marcomp.c:204
mc_field * mc_getfield(mc_context *c)
Definition: marcomp.c:214
const char * mc_error(mc_errcode no)
Definition: marcomp.c:59
struct mc_context mc_context
mc_subfield * mc_getsubfields(mc_context *c, mc_subfield *parent)
Definition: marcomp.c:320
void mc_destroy_subfield(mc_subfield *p)
Definition: marcomp.c:275
mc_errcode mc_errno(mc_context *c)
Definition: marcomp.c:55
struct mc_subfield mc_subfield
void mc_destroy_context(mc_context *c)
Definition: marcomp.c:86
struct mc_field mc_field
void mc_pr_subfields(mc_subfield *p, int offset)
void mc_pr_field(mc_field *p, int offset)
mc_token
Definition: marcomp.h:66
@ RINLINE
Definition: marcomp.h:74
@ RGROUP
Definition: marcomp.h:72
@ LINLINE
Definition: marcomp.h:73
@ LINTERVAL
Definition: marcomp.h:76
@ RVARIANT
Definition: marcomp.h:70
@ RINTERVAL
Definition: marcomp.h:77
@ LVARIANT
Definition: marcomp.h:69
@ LGROUP
Definition: marcomp.h:71
@ SUBFIELD
Definition: marcomp.h:75
@ NOP
Definition: marcomp.h:67
@ REGULAR
Definition: marcomp.h:68
mc_errcode
Definition: marcomp.h:81
@ EMCSFVAR
Definition: marcomp.h:87
@ EMCSF
Definition: marcomp.h:85
@ EMCSFGROUP
Definition: marcomp.h:86
@ EMCSFINLINE
Definition: marcomp.h:88
@ EMCEND
Definition: marcomp.h:89
@ EMCNOMEM
Definition: marcomp.h:83
@ EMCOK
Definition: marcomp.h:82
@ EMCF
Definition: marcomp.h:84
void mc_destroy_subfields_recursive(mc_subfield *p)
Definition: marcomp.c:296
mc_context * mc_mk_context(const char *s)
Definition: marcomp.c:66
int len
Definition: marcomp.h:101
const char * data
Definition: marcomp.h:102
int offset
Definition: marcomp.h:94
mc_errcode errcode
Definition: marcomp.h:99
int crrval
Definition: marcomp.h:96
mc_token crrtok
Definition: marcomp.h:97
char * ind1
Definition: marcomp.h:56
struct mc_subfield * list
Definition: marcomp.h:62
int start
Definition: marcomp.h:59
char * ind2
Definition: marcomp.h:57
int end
Definition: marcomp.h:60
char * name
Definition: marcomp.h:55
struct mc_field::@17 interval
struct mc_field * in_line
Definition: marcomp.h:40
int end
Definition: marcomp.h:33
struct mc_subfield::@15 interval
char * prefix
Definition: marcomp.h:29
union mc_subfield::@16 u
struct mc_subfield * child
Definition: marcomp.h:41
int which
Definition: marcomp.h:35
char * name
Definition: marcomp.h:28
struct mc_subfield * parent
Definition: marcomp.h:44
char * suffix
Definition: marcomp.h:30
int start
Definition: marcomp.h:32
struct mc_subfield * next
Definition: marcomp.h:43