IDZEBRA  2.0.54
marcomp.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) 2004-2013 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;
34  } interval;
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;
45 } mc_subfield;
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;
61  } interval;
62  struct mc_subfield *list;
63 } mc_field;
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 */
90 } mc_errcode;
91 
92 typedef struct mc_context
93 {
94  int offset;
95 
96  int crrval;
98 
100 
101  int len;
102  const char *data;
103 } mc_context;
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