X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flogrpn.c;h=cd8de78fa85b21bf8f12b4a152f43dd02e1483a9;hb=80fee38926477efd73c739731c5670d59c5d1bf7;hp=fa9a2ea92d067f5c6a964afcc44369303ba153de;hpb=7a4064cd15f6c6b34c1180e1bc51f0d0e90da320;p=yaz-moved-to-github.git diff --git a/src/logrpn.c b/src/logrpn.c index fa9a2ea..cd8de78 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS - * All rights reserved. - * - * $Id: logrpn.c,v 1.16 2007-04-12 13:52:57 adam Exp $ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data + * See the file LICENSE for details. */ /** @@ -181,7 +179,7 @@ static void attrStr (int type, int value, char *str) * zlog_attributes: print attributes of term */ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, - const int *ast, int loglevel) + const Odr_oid *ast, int loglevel) { int of, i; char str[80]; @@ -208,7 +206,8 @@ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, yaz_log (loglevel, "%*.0s%s %s", depth, "", attset_name, str); break; case Z_AttributeValue_complex: - yaz_log (loglevel, "%*.0s%s attributeType=%d complex", + yaz_log (loglevel, "%*.0s%s attributeType=" ODR_INT_PRINTF + " complex", depth, "", attset_name, *element->attributeType); for (i = 0; ivalue.complex->num_list; i++) { @@ -218,7 +217,8 @@ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, element->value.complex->list[i]->u.string); else if (element->value.complex->list[i]->which == Z_StringOrNumeric_numeric) - yaz_log (loglevel, "%*.0s numeric: '%d'", depth, "", + yaz_log (loglevel, "%*.0s numeric: '" ODR_INT_PRINTF + " '", depth, "", *element->value.complex->list[i]->u.numeric); } break; @@ -268,7 +268,7 @@ static char *prox_unit_name(Z_ProximityOperator *op) } static void zlog_structure(Z_RPNStructure *zs, int depth, - const int *ast, int loglevel) + const Odr_oid *ast, int loglevel) { if (zs->which == Z_RPNStructure_complex) { @@ -281,7 +281,8 @@ static void zlog_structure(Z_RPNStructure *zs, int depth, yaz_log (loglevel, "%*.0s %s", depth, "", complex_op_name(op) ); break; case Z_Operator_prox: - yaz_log (loglevel, "%*.0s prox excl=%s dist=%d order=%s " + yaz_log (loglevel, "%*.0s prox excl=%s dist=" ODR_INT_PRINTF + " order=%s " "rel=%s unit=%s", depth, "", op->u.prox->exclusion ? (*op->u.prox->exclusion ? "T" : "F") : "N", @@ -315,7 +316,8 @@ static void zlog_structure(Z_RPNStructure *zs, int depth, zapt->term->u.characterString); break; case Z_Term_numeric: - yaz_log (loglevel, "%*.0s term '%d' (numeric)", depth, "", + yaz_log (loglevel, "%*.0s term '" ODR_INT_PRINTF + "' (numeric)", depth, "", *zapt->term->u.numeric); break; case Z_Term_null: @@ -349,7 +351,7 @@ void log_rpn_query(Z_RPNQuery *rpn) } void log_scan_term_level(int loglevel, - Z_AttributesPlusTerm *zapt, const int *ast) + Z_AttributesPlusTerm *zapt, const Odr_oid *ast) { int depth = 0; if (!loglevel) @@ -364,7 +366,7 @@ void log_scan_term_level(int loglevel, zlog_attributes(zapt, depth+2, ast, loglevel); } -void log_scan_term(Z_AttributesPlusTerm *zapt, const int *ast) +void log_scan_term(Z_AttributesPlusTerm *zapt, const Odr_oid *ast) { log_scan_term_level (YLOG_LOG, zapt, ast); } @@ -396,28 +398,10 @@ void yaz_log_zquery (Z_Query *q) yaz_log_zquery_level(YLOG_LOG, q); } -void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags) -{ - /* we only dump the first diag - that keeps the log cleaner. */ - wrbuf_printf(b," ERROR "); - if (diags[0]->which != Z_DiagRec_defaultFormat) - wrbuf_printf(b,"(diag not in default format?)"); - else - { - Z_DefaultDiagFormat *e=diags[0]->u.defaultFormat; - if (e->condition) - wrbuf_printf(b, "%d ",*e->condition); - else - wrbuf_printf(b, "?? "); - if ((e->which==Z_DefaultDiagFormat_v2Addinfo) && (e->u.v2Addinfo)) - wrbuf_printf(b,"%s ",e->u.v2Addinfo); - else if ((e->which==Z_DefaultDiagFormat_v3Addinfo) && (e->u.v3Addinfo)) - wrbuf_printf(b,"%s ",e->u.v3Addinfo); - } -} /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab