Logo Search packages:      
Sourcecode: yaz version File versions

YAZ_EXPORT void ccl_pquery ( WRBUF  w,
struct ccl_rpn_node p 
)

Pretty-print CCL RPN node tree to WRBUF

Definition at line 222 of file cclptree.c.

References ccl_rpn_attr::kind, ccl_rpn_node::kind, ccl_rpn_attr::next, ccl_rpn_attr::numeric, ccl_rpn_attr::set, ccl_rpn_node::setname, ccl_rpn_attr::str, ccl_rpn_node::t, ccl_rpn_attr::type, ccl_rpn_node::u, and ccl_rpn_attr::value.

{
    struct ccl_rpn_attr *att;
    const char *cp;
      
    switch (p->kind)
    {
    case CCL_RPN_AND:
    case CCL_RPN_OR:
    case CCL_RPN_NOT:
    case CCL_RPN_PROX:
      ccl_pquery_complex (w, p);
            break;
    case CCL_RPN_SET:
            wrbuf_puts (w, "@set ");
            wrbuf_puts (w, p->u.setname);
            wrbuf_puts (w, " ");
            break;
    case CCL_RPN_TERM:
      for (att = p->u.t.attr_list; att; att = att->next)
            {
                  char tmpattr[128];
                  wrbuf_puts (w, "@attr ");
                  if (att->set)
                  {
                        wrbuf_puts (w, att->set);
                        wrbuf_puts (w, " ");
                  }
                  switch(att->kind)
                  {
                  case CCL_RPN_ATTR_NUMERIC:
                        sprintf(tmpattr, "%d=%d ", att->type, att->value.numeric);
                        wrbuf_puts (w, tmpattr);
                        break;
                  case CCL_RPN_ATTR_STRING:
                        sprintf(tmpattr, "%d=", att->type);
                        wrbuf_puts (w, tmpattr);
                        wrbuf_puts(w, att->value.str);
                        wrbuf_puts (w, " ");
                        break;
                  }
            }
            for (cp = p->u.t.term; *cp; cp++)
            {
                  if (*cp == ' ' || *cp == '\\')
                        wrbuf_putc (w, '\\');
                  wrbuf_putc (w, *cp);
            }
            wrbuf_puts (w, " ");
            break;
    }
}


Generated by  Doxygen 1.6.0   Back to index