/*
- * Copyright (c) 1995-1997, Index Data.
+ * Copyright (c) 1995-1998, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_marc.c,v $
- * Revision 1.8 1997-09-17 12:10:37 adam
+ * Revision 1.12 1998-02-23 10:57:09 adam
+ * Take care of integer data nodes as well in conversion.
+ *
+ * Revision 1.11 1998/02/11 11:53:35 adam
+ * Changed code so that it compiles as C++.
+ *
+ * Revision 1.10 1997/09/30 11:50:04 adam
+ * Added handler data1_get_map_buf that is used by data1_nodetomarc.
+ *
+ * Revision 1.9 1997/09/24 13:35:45 adam
+ * Added two members to data1_marctab to ease reading of weird MARC records.
+ *
+ * Revision 1.8 1997/09/17 12:10:37 adam
* YAZ version 1.4.
*
* Revision 1.7 1997/09/05 09:50:57 adam
{
FILE *f;
NMEM mem = data1_nmem_get (dh);
- data1_marctab *res = nmem_malloc(mem, sizeof(*res));
+ data1_marctab *res = (data1_marctab *)nmem_malloc(mem, sizeof(*res));
char line[512], *argv[50];
int argc;
strcpy(res->implementation_codes, " ");
res->indicator_length = 2;
res->identifier_length = 2;
+ res->force_indicator_length = -1;
+ res->force_identifier_length = -1;
strcpy(res->user_systems, "z ");
while ((argc = readconf_line(f, line, 512, argv, 50)))
}
strncpy(res->future_use, argv[1], 2);
}
+ else if (!strcmp(argv[0], "force-indicator-length"))
+ {
+ if (argc != 2)
+ {
+ logf(LOG_WARN, "%s: Bad future-use");
+ continue;
+ }
+ res->force_indicator_length = atoi(argv[1]);
+ }
+ else if (!strcmp(argv[0], "force-identifier-length"))
+ {
+ if (argc != 2)
+ {
+ logf(LOG_WARN, "%s: Bad future-use");
+ continue;
+ }
+ res->force_identifier_length = atoi(argv[1]);
+ }
else
logf(LOG_WARN, "%s: Bad directive '%s'", file, argv[0]);
while (n->which != DATA1N_data && n->child)
n = n->child;
- if (n->which != DATA1N_data || n->u.data.what != DATA1I_text)
+ if (n->which != DATA1N_data ||
+ (n->u.data.what != DATA1I_text && n->u.data.what != DATA1I_num))
{
r = "[Structured/included data]";
*len = strlen(r);
char *op;
data1_node *field, *subf;
+ logf (LOG_DEBUG, "nodetomarc");
for (field = n->child; field; field = field->next)
{
if (field->which != DATA1N_tag)
}
if (!*buf)
- *buf = xmalloc(*size = len);
+ *buf = (char *)xmalloc(*size = len);
else if (*size <= len)
- *buf = xrealloc(*buf, *size = len);
+ *buf = (char *)xrealloc(*buf, *size = len);
op = *buf;
memint (op, len, 5);
int selected, int *len)
{
int *size;
- char **buf = data1_get_read_buf (dh, &size);
+ char **buf = data1_get_map_buf (dh, &size);
*len = nodetomarc(p, n, selected, buf, size);
return *buf;