projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Several updates for the changes of hit count datatype from int
[idzebra-moved-to-github.git]
/
recctrl
/
marcread.c
diff --git
a/recctrl/marcread.c
b/recctrl/marcread.c
index
a651e05
..
2c24daa
100644
(file)
--- a/
recctrl/marcread.c
+++ b/
recctrl/marcread.c
@@
-1,6
+1,6
@@
-/* $Id: marcread.c,v 1.25 2004-09-27 10:44:50 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
- Index Data Aps
+/* $Id: marcread.c,v 1.30 2005-01-15 19:38:32 adam Exp $
+ Copyright (C) 1995-2005
+ Index Data ApS
This file is part of the Zebra server.
This file is part of the Zebra server.
@@
-24,10
+24,9
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include <assert.h>
-#include <yaz/log.h>
#include <yaz/yaz-util.h>
#include <yaz/marcdisp.h>
#include <yaz/yaz-util.h>
#include <yaz/marcdisp.h>
-#include "grsread.h"
+#include <idzebra/recgrs.h>
#include "marcomp.h"
#include "inline.h"
#include "marcomp.h"
#include "inline.h"
@@
-63,14
+62,14
@@
static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml)
record_length = atoi_n (buf, 5);
if (record_length < 25)
{
record_length = atoi_n (buf, 5);
if (record_length < 25)
{
- logf (LOG_WARN, "MARC record length < 25, is %d", record_length);
+ yaz_log (YLOG_WARN, "MARC record length < 25, is %d", record_length);
return NULL;
}
/* read remaining part - attempt to read one byte furhter... */
read_bytes = (*p->readf)(p->fh, buf+5, record_length-4);
if (read_bytes < record_length-5)
{
return NULL;
}
/* read remaining part - attempt to read one byte furhter... */
read_bytes = (*p->readf)(p->fh, buf+5, record_length-4);
if (read_bytes < record_length-5)
{
- logf (LOG_WARN, "Couldn't read whole MARC record");
+ yaz_log (YLOG_WARN, "Couldn't read whole MARC record");
return NULL;
}
if (read_bytes == record_length - 4)
return NULL;
}
if (read_bytes == record_length - 4)
@@
-85,7
+84,7
@@
static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml)
res_root = data1_mk_root (p->dh, p->mem, absynName);
if (!res_root)
{
res_root = data1_mk_root (p->dh, p->mem, absynName);
if (!res_root)
{
- yaz_log (LOG_WARN, "cannot read MARC without an abstract syntax");
+ yaz_log (YLOG_WARN, "cannot read MARC without an abstract syntax");
return 0;
}
if (marc_xml)
return 0;
}
if (marc_xml)
@@
-101,7
+100,7
@@
static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml)
else
res_top = data1_mk_tag (p->dh, p->mem, absynName, 0, res_root);
else
res_top = data1_mk_tag (p->dh, p->mem, absynName, 0, res_root);
- if ((marctab = res_root->u.root.absyn->marc))
+ if ((marctab = data1_absyn_getmarctab(p->dh, res_root->u.root.absyn)))
{
memcpy(marctab->leader, buf, 24);
memcpy(marctab->implementation_codes, buf+6, 4);
{
memcpy(marctab->leader, buf, 24);
memcpy(marctab->implementation_codes, buf+6, 4);
@@
-376,7
+375,7
@@
static inline_subfield *cat_inline_subfield(mc_subfield *psf, WRBUF buf,
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name);
+ yaz_log(YLOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name);
#endif
pisf = found->next;
}
#endif
pisf = found->next;
}
@@
-440,7
+439,7
@@
static void cat_inline_field(mc_field *pf, WRBUF buf, data1_node *subfield)
int i;
if ((i=inline_parse(pif, psubf->u.tag.tag, get_data(psubf, &len)))<0)
{
int i;
if ((i=inline_parse(pif, psubf->u.tag.tag, get_data(psubf, &len)))<0)
{
- logf(LOG_WARN, "inline subfield ($%s): parse error",
+ yaz_log(YLOG_WARN, "inline subfield ($%s): parse error",
psubf->u.tag.tag);
inline_destroy_field(pif);
return;
psubf->u.tag.tag);
inline_destroy_field(pif);
return;
@@
-482,14
+481,14
@@
static void cat_inline_field(mc_field *pf, WRBUF buf, data1_node *subfield)
}
else
{
}
else
{
- logf(LOG_WARN, "In-line field %s missed -- indicators do not match", pif->name);
+ yaz_log(YLOG_WARN, "In-line field %s missed -- indicators do not match", pif->name);
}
}
}
inline_destroy_field(pif);
}
#if MARCOMP_DEBUG
}
}
}
inline_destroy_field(pif);
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_inline_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_inline_field(): got buffer {%s}", buf);
#endif
}
#endif
}
@@
-534,7
+533,7
@@
static data1_node *cat_subfield(mc_subfield *psf, WRBUF buf,
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag);
+ yaz_log(YLOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag);
#endif
subfield = found->next;
}
#endif
subfield = found->next;
}
@@
-610,7
+609,7
@@
static data1_node *cat_field(struct grs_read_info *p, mc_field *pf,
wrbuf_puts(buf, "");
}
#if MARCOMP_DEBUG
wrbuf_puts(buf, "");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf);
#endif
return field->next;
}
#endif
return field->next;
}
@@
-628,7
+627,7
@@
static data1_node *cat_field(struct grs_read_info *p, mc_field *pf,
))
{
#if MARCOMP_DEBUG
))
{
#if MARCOMP_DEBUG
- logf(LOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag);
+ yaz_log(YLOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag);
#endif
return field->next;
}
#endif
return field->next;
}
@@
-641,7
+640,7
@@
static data1_node *cat_field(struct grs_read_info *p, mc_field *pf,
cat_subfield(pf->list, buf, subfield);
#if MARCOMP_DEBUG
cat_subfield(pf->list, buf, subfield);
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf);
#endif
return field->next;
#endif
return field->next;
@@
-653,7
+652,7
@@
static int is_empty(char *s)
for (p = s; *p; p++)
{
for (p = s; *p; p++)
{
- if (!isspace(*p))
+ if (!isspace(*(unsigned char *)p))
return 0;
}
return 1;
return 0;
}
return 1;
@@
-662,7
+661,7
@@
static int is_empty(char *s)
static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt,
data1_node *root)
{
static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt,
data1_node *root)
{
- data1_marctab *marctab = root->u.root.absyn->marc;
+ data1_marctab *marctab = data1_absyn_getmarctab(p->dh, root->u.root.absyn);
data1_node *top = root->child;
data1_node *field;
mc_context *c;
data1_node *top = root->child;
data1_node *field;
mc_context *c;
@@
-683,13
+682,13
@@
static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt,
}
buf = wrbuf_alloc();
#if MARCOMP_DEBUG
}
buf = wrbuf_alloc();
#if MARCOMP_DEBUG
- logf(LOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt);
+ yaz_log(YLOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt);
#endif
if (!yaz_matchstr(pf->name, "ldr"))
{
data1_node *new;
#if MARCOMP_DEBUG
#endif
if (!yaz_matchstr(pf->name, "ldr"))
{
data1_node *new;
#if MARCOMP_DEBUG
- logf(LOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions",
+ yaz_log(YLOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions",
pf->interval.start, pf->interval.end);
#endif
new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top);
pf->interval.start, pf->interval.end);
#endif
new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top);
@@
-707,7
+706,7
@@
static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt,
data1_node *new;
char *pb;
#if MARCOMP_DEBUG
data1_node *new;
char *pb;
#if MARCOMP_DEBUG
- logf(LOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag);
+ yaz_log(YLOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag);
#endif
wrbuf_rewind(buf);
wrbuf_puts(buf, "");
#endif
wrbuf_rewind(buf);
wrbuf_puts(buf, "");
@@
-743,7
+742,7
@@
data1_node *grs_read_marcxml(struct grs_read_info *p)
if (!root)
return 0;
if (!root)
return 0;
- for (e=root->u.root.absyn->main_elements; e; e=e->next)
+ for (e = data1_absyn_getelements(p->dh, root->u.root.absyn); e; e=e->next)
{
data1_tag *tag = e->tag;
{
data1_tag *tag = e->tag;
@@
-762,7
+761,7
@@
data1_node *grs_read_marc(struct grs_read_info *p)
if (!root)
return 0;
if (!root)
return 0;
- for (e=root->u.root.absyn->main_elements; e; e=e->next)
+ for (e = data1_absyn_getelements(p->dh, root->u.root.absyn); e; e=e->next)
{
data1_tag *tag = e->tag;
{
data1_tag *tag = e->tag;