-static void wrbuf_structure (WRBUF b, Z_RPNStructure *zs, enum oid_value ast)
-{
- int i;
- if (zs->which == Z_RPNStructure_complex)
- {
- Z_Operator *op = zs->u.complex->roperator;
- wrbuf_printf(b, "@%s ", complex_op_name(op) );
- if (op->which== Z_Operator_prox)
- {
- wrbuf_printf(b, "(excl=%s dist=%d order=%s "
- "rel=%s unit=%s) ",
- op->u.prox->exclusion ?
- (*op->u.prox->exclusion ? "T" : "F") : "N",
- *op->u.prox->distance,
- *op->u.prox->ordered ? "T" : "F",
- relToStr(*op->u.prox->relationType),
- prox_unit_name(op->u.prox) );
- }
- wrbuf_structure (b,zs->u.complex->s1, ast);
- wrbuf_structure (b,zs->u.complex->s2, ast);
- }
- else if (zs->which == Z_RPNStructure_simple)
- {
- if (zs->u.simple->which == Z_Operand_APT)
- {
- Z_AttributesPlusTerm *zapt = zs->u.simple->u.attributesPlusTerm;
- int num_attributes = zapt->attributes->num_attributes;
- for (i=0;i<num_attributes;i++)
- wrbuf_attr(b,zapt->attributes->attributes[i]);
-
- switch (zapt->term->which)
- {
- case Z_Term_general:
- wrbuf_printf(b, "'%.*s' ",
- zapt->term->u.general->len,
- zapt->term->u.general->buf);
- break;
- case Z_Term_characterString:
- wrbuf_printf(b, "\"%s\" ", zapt->term->u.characterString);
- break;
- case Z_Term_numeric:
- wrbuf_printf(b, "%d ", *zapt->term->u.numeric);
- break;
- case Z_Term_null:
- wrbuf_printf(b, "(null) ");
- break;
- default:
- wrbuf_printf(b, "(unknown term type %d) ", zapt->term->which);
- }
- }
- else if (zs->u.simple->which == Z_Operand_resultSetId)
- {
- wrbuf_printf(b, "@set '%s' ", zs->u.simple->u.resultSetId);
- }
- else
- wrbuf_printf (b, "(unknown simple structure)");
- }
- else
- wrbuf_puts(b, "(unknown structure)");
-}
-