/*
- * Copyright (c) 1995-1999, Index Data.
+ * Copyright (c) 1995-2000, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_map.c,v $
- * Revision 1.15 1999-08-27 09:40:32 adam
+ * Revision 1.21 2002-05-07 11:02:56 adam
+ * data1 backwards compatibility
+ *
+ * Revision 1.20 2002/05/03 13:48:27 adam
+ * data1 cleanup
+ *
+ * Revision 1.19 2002/04/04 20:49:46 adam
+ * New functions yaz_is_abspath, yaz_path_fopen_base
+ *
+ * Revision 1.18 2000/11/29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.17 1999/11/30 13:47:12 adam
+ * Improved installation. Moved header files to include/yaz.
+ *
+ * Revision 1.16 1999/10/21 12:06:29 adam
+ * Retrieval module no longer uses ctype.h - functions.
+ *
+ * Revision 1.15 1999/08/27 09:40:32 adam
* Renamed logf function to yaz_log. Removed VC++ project files.
*
* Revision 1.14 1998/10/13 16:09:50 adam
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <oid.h>
-#include <log.h>
-#include <readconf.h>
-
-#include <tpath.h>
-#include <data1.h>
-#include <d1_map.h>
+#include <yaz/oid.h>
+#include <yaz/log.h>
+#include <yaz/readconf.h>
+#include <yaz/tpath.h>
+#include <yaz/data1.h>
+#include <yaz/d1_map.h>
data1_maptab *data1_read_maptab (data1_handle dh, const char *file)
{
data1_mapunit **mapp;
int local_numeric = 0;
- if (!(f = yaz_path_fopen(data1_get_tabpath(dh), file, "r")))
+ if (!(f = data1_path_fopen(dh, file, "r")))
{
yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
if (ep)
ep++;
- if ((np = sscanf(path, "(%d,%[^)]):%[^/]", &type, valstr,
+ if ((np = sscanf(path, "(%d,%511[^)]):%511[^/]", &type, valstr,
parm)) < 2)
{
yaz_log(LOG_WARN, "%s:%d: Syntax error in map "
(*mtp)->new_field = 1;
else
(*mtp)->new_field = 0;
- if ((type != 3 || local_numeric) && isdigit(*valstr))
+ if ((type != 3 || local_numeric) && d1_isdigit(*valstr))
{
(*mtp)->which = D1_MAPTAG_numeric;
(*mtp)->value.numeric = atoi(valstr);
{
if (!cur || mt->new_field || !tagmatch(cur, mt))
{
- cur = data1_mk_node (dh, mem);
- cur->which = DATA1N_tag;
- cur->u.tag.element = 0;
+ cur = data1_mk_node2 (dh, mem, DATA1N_tag, pn);
cur->u.tag.tag = mt->value.string;
- cur->u.tag.node_selected = 0;
- cur->parent = pn;
- cur->root = pn->root;
- if (!pn->child)
- pn->child = cur;
- if (pn->last_child)
- pn->last_child->next = cur;
- pn->last_child = cur;
}
if (mt->next)
data1_node *data1_map_record (data1_handle dh, data1_node *n,
data1_maptab *map, NMEM m)
{
- data1_node *res = data1_mk_node(dh, m);
+ data1_node *res = data1_mk_node2 (dh, m, DATA1N_root, 0);
res->which = DATA1N_root;
res->u.root.type = map->target_absyn_name;
yaz_log(LOG_WARN, "%s: Failed to load target absyn '%s'",
map->name, map->target_absyn_name);
}
- res->parent = 0;
- res->root = res;
-
if (map_children(dh, n, map, res, m) < 0)
{
data1_free_tree(dh, res);