X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Flogrpn.c;h=379dad0928a856032d9152b3fca717d30d3670ca;hp=1a37e0f99ad2f66ce2e638d873f07df2b052c159;hb=8cb8947e3a7bff4dbf8f124871cb4905df1adce7;hpb=e5c44d40aa8c2f5ab2dc7ad1e0b15d67eaca78c1 diff --git a/src/logrpn.c b/src/logrpn.c index 1a37e0f..379dad0 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -1,12 +1,14 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ - /** * \file logrpn.c * \brief Implements Z39.50 Query Printing */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -48,7 +50,7 @@ static void attrStr(Odr_int type, Odr_int value, char *str) if (rstr) sprintf(str, "relation=%s", rstr); else - sprintf(str, "relation=%d", value); + sprintf(str, "relation=" ODR_INT_PRINTF, value); break; case 3: switch (value) @@ -170,9 +172,10 @@ static void attrStr(Odr_int type, Odr_int value, char *str) break; } if (*str) - sprintf(str + strlen(str), " (%d=%d)", type, value); + sprintf(str + strlen(str), " (" ODR_INT_PRINTF "=" ODR_INT_PRINTF")", + type, value); else - sprintf(str, "%d=%d", type, value); + sprintf(str, ODR_INT_PRINTF "=" ODR_INT_PRINTF, type, value); } /* @@ -184,7 +187,7 @@ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, int of, i; char str[80]; int num_attributes = t->attributes->num_attributes; - + for (of = 0; of < num_attributes; of++) { char attset_name_buf[OID_STR_MAX]; @@ -198,7 +201,7 @@ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, } if (!attset_name) attset_name = ""; - switch (element->which) + switch (element->which) { case Z_AttributeValue_numeric: attrStr(*element->attributeType, @@ -246,7 +249,7 @@ static char *complex_op_name(Z_Operator *op) } } -static char *prox_unit_name(Z_ProximityOperator *op) +char *yaz_prox_unit_name(Z_ProximityOperator *op) { if (op->which!=Z_ProximityOperator_known) return "private"; @@ -267,7 +270,7 @@ static char *prox_unit_name(Z_ProximityOperator *op) } } -static void zlog_structure(Z_RPNStructure *zs, int depth, +static void zlog_structure(Z_RPNStructure *zs, int depth, const Odr_oid *ast, int loglevel) { if (zs->which == Z_RPNStructure_complex) @@ -285,11 +288,11 @@ static void zlog_structure(Z_RPNStructure *zs, int depth, " order=%s " "rel=%s unit=%s", depth, "", op->u.prox->exclusion ? - (*op->u.prox->exclusion ? "T" : "F") : "N", + (*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) ); + yaz_prox_unit_name(op->u.prox) ); break; default: yaz_log(loglevel, "%*.0s unknown complex", depth, ""); @@ -297,7 +300,7 @@ static void zlog_structure(Z_RPNStructure *zs, int depth, } zlog_structure(zs->u.complex->s1, depth+2, ast, loglevel); zlog_structure(zs->u.complex->s2, depth+2, ast, loglevel); - } + } else if (zs->which == Z_RPNStructure_simple) { if (zs->u.simple->which == Z_Operand_APT) @@ -350,13 +353,13 @@ void log_rpn_query(Z_RPNQuery *rpn) log_rpn_query_level(YLOG_LOG, rpn); } -void log_scan_term_level(int loglevel, +void log_scan_term_level(int loglevel, Z_AttributesPlusTerm *zapt, const Odr_oid *ast) { int depth = 0; if (!loglevel) return; - if (zapt->term->which == Z_Term_general) + if (zapt->term->which == Z_Term_general) { yaz_log(loglevel, "%*.0s term '%.*s' (general)", depth, "", zapt->term->u.general->len, zapt->term->u.general->buf); @@ -374,7 +377,7 @@ void log_scan_term(Z_AttributesPlusTerm *zapt, const Odr_oid *ast) void yaz_log_zquery_level(int loglevel, Z_Query *q) { if (!loglevel) - return; + return; switch (q->which) { case Z_Query_type_1: case Z_Query_type_101: