- logf (LOG_DEBUG, "data1_search_tag %s", tag);
- for (; n; n = n->next)
- if (n->which == DATA1N_tag && n->u.tag.tag &&
- !yaz_matchstr (tag, n->u.tag.tag))
- {
- logf (LOG_DEBUG, " found");
- return n;
- }
- logf (LOG_DEBUG, " not found");
- return 0;
-}
-
-static data1_node *data1_add_tag (data1_handle dh, data1_node *at,
- const char *tag, NMEM nmem)
-{
- data1_node *partag = get_parent_tag(dh, at);
- data1_node *res = data1_mk_node_type (dh, nmem, DATA1N_tag);
- data1_element *e = NULL;
-
- res->parent = at;
- res->u.tag.tag = data1_insert_string (dh, res, nmem, tag);
-
- if (partag)
- e = partag->u.tag.element;
- res->u.tag.element =
- data1_getelementbytagname (dh, at->root->u.root.absyn,
- e, res->u.tag.tag);
- res->root = at->root;
- if (!at->child)
- at->child = res;
- else
- {
- assert (at->last_child);
- at->last_child->next = res;
- }
- at->last_child = res;
- return res;
-}
-
-static data1_node *data1_make_tag (data1_handle dh, data1_node *at,
- const char *tag, NMEM nmem)
-{
- data1_node *node = data1_search_tag (dh, at->child, tag);
- if (!node)
- node = data1_add_tag (dh, at, tag, nmem);
- else
- node->child = node->last_child = NULL;
- return node;
-}
-
-static data1_node *data1_add_tagdata_int (data1_handle dh, data1_node *at,
- const char *tag, int num,
- NMEM nmem)
-{
- data1_node *node_data;
-
- node_data = data1_add_taggeddata (dh, at->root, at, tag, nmem);
- if (!node_data)
- return 0;
- node_data->u.data.what = DATA1I_num;
- node_data->u.data.data = node_data->lbuf;
- sprintf (node_data->u.data.data, "%d", num);
- node_data->u.data.len = strlen (node_data->u.data.data);
- return node_data;