/*
- * Copyright (c) 1995-1999, Index Data.
+ * Copyright (c) 1995-2002, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Log: d1_prtree.c,v $
- * Revision 1.5 1999-01-25 13:49:47 adam
- * Made data1_pr_tree make better printing of data1 buffers.
- *
- * Revision 1.4 1998/05/18 13:07:06 adam
- * Changed the way attribute sets are handled by the retriaval module.
- * Extended Explain conversion / schema.
- * Modified server and client to work with ASN.1 compiled protocol handlers.
- *
- * Revision 1.3 1998/02/27 14:05:34 adam
- * Added printing of integer nodes.
- *
- * Revision 1.2 1997/11/06 11:36:44 adam
- * Implemented variant match on simple elements -data1 tree and Espec-1.
- *
- * Revision 1.1 1997/10/27 14:04:07 adam
- * New debug utility, data1_pr_tree, that dumps a data1 tree.
- *
+ * $Id: d1_prtree.c,v 1.10 2002-09-24 13:58:13 adam Exp $
*/
-#include <log.h>
-#include <data1.h>
+#include <yaz/log.h>
+#include <yaz/data1.h>
static void pr_string (FILE *out, const char *str, int len)
{
{
int c = str[i];
if (c < 32 || c >126)
- fprintf (out, "\\x%02x", c);
+ fprintf (out, "\\x%02x", c & 255);
else
fputc (c, out);
}
fprintf (out, "%*s", level, "");
switch (n->which)
{
- case DATA1N_root:
- fprintf (out, "root abstract syntax=%s\n", n->u.root.type);
- break;
+ case DATA1N_root:
+ fprintf (out, "root abstract syntax=%s\n", n->u.root.type);
+ break;
case DATA1N_tag:
- fprintf (out, "tag type=%s\n", n->u.tag.tag);
+ fprintf (out, "tag type=%s sel=%d\n", n->u.tag.tag,
+ n->u.tag.node_selected);
+ if (n->u.tag.attributes)
+ {
+ data1_xattr *xattr = n->u.tag.attributes;
+ fprintf (out, "%*s attr", level, "");
+ for (; xattr; xattr = xattr->next)
+ fprintf (out, " %s=%s ", xattr->name, xattr->value);
+ fprintf (out, "\n");
+ }
break;
case DATA1N_data:
- fprintf (out, "data type=");
+ case DATA1N_comment:
+ if (n->which == DATA1N_data)
+ fprintf (out, "data type=");
+ else
+ fprintf (out, "comment type=");
switch (n->u.data.what)
{
case DATA1I_inctxt:
break;
}
break;
+ case DATA1N_preprocess:
+ fprintf (out, "preprocess target=%s\n", n->u.preprocess.target);
+ if (n->u.preprocess.attributes)
+ {
+ data1_xattr *xattr = n->u.preprocess.attributes;
+ fprintf (out, "%*s attr", level, "");
+ for (; xattr; xattr = xattr->next)
+ fprintf (out, " %s=%s ", xattr->name, xattr->value);
+ fprintf (out, "\n");
+ }
+ break;
case DATA1N_variant:
fprintf (out, "variant\n");
#if 0