Read works. Forward missing (but safe to commit, as not used from anywhere)
[idzebra-moved-to-github.git] / data1 / d1_map.c
index f8a160b..151b3c4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_map.c,v 1.2 2002-10-22 13:19:50 adam Exp $
+/* $Id: d1_map.c,v 1.5 2004-09-28 10:43:37 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -28,8 +28,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <yaz/log.h>
 #include <yaz/readconf.h>
 #include <yaz/tpath.h>
-#include <data1.h>
-#include <d1_map.h>
+#include <d1_absyn.h>
 
 data1_maptab *data1_read_maptab (data1_handle dh, const char *file)
 {
@@ -278,8 +277,27 @@ static int map_children(data1_handle dh, data1_node *n, data1_maptab *map,
                    {
                        if (!cur || mt->new_field || !tagmatch(cur, mt))
                        {
-                           cur = data1_mk_node2 (dh, mem, DATA1N_tag, pn);
-                           cur->u.tag.tag = mt->value.string;
+                            if (mt->which == D1_MAPTAG_string)
+                            {
+                                cur = data1_mk_node2 (dh, mem, DATA1N_tag, pn);
+                                cur->u.tag.tag = mt->value.string;
+                            }
+                            else if (mt->which == D1_MAPTAG_numeric)
+                            {
+                                data1_tag *tag =
+                                    data1_gettagbynum(
+                                        dh,
+                                        pn->root->u.root.absyn->tagset,
+                                        mt->type,
+                                        mt->value.numeric);
+
+                                if (tag && tag->names->name)
+                                {
+                                    cur = data1_mk_tag (
+                                        dh, mem, tag->names->name, 0, pn);
+                                    
+                                }
+                            }
                        }
                        
                        if (mt->next)