projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add part of Facet API
[yaz-moved-to-github.git]
/
src
/
querytowrbuf.c
diff --git
a/src/querytowrbuf.c
b/src/querytowrbuf.c
index
a120e88
..
3caf21b
100644
(file)
--- a/
src/querytowrbuf.c
+++ b/
src/querytowrbuf.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-39,46
+39,44
@@
static void yaz_attribute_element_to_wrbuf(WRBUF b,
const Z_AttributeElement *element)
{
int i;
const Z_AttributeElement *element)
{
int i;
- char oid_name_str[OID_STR_MAX];
- const char *setname = 0;
- char *sep = " "; /* optional space after attrset name */
+
+ wrbuf_puts(b, "@attr ");
if (element->attributeSet)
{
if (element->attributeSet)
{
- setname = yaz_oid_to_string_buf(element->attributeSet,
- 0, oid_name_str);
- }
- if (!setname)
- {
- setname = "";
- sep = "";
+ char oid_name_str[OID_STR_MAX];
+ const char *setname = yaz_oid_to_string_buf(element->attributeSet,
+ 0, oid_name_str);
+ if (setname)
+ {
+ wrbuf_puts(b, setname);
+ wrbuf_puts(b, " ");
+ }
}
}
+ wrbuf_printf(b, ODR_INT_PRINTF "=", *element->attributeType);
switch (element->which)
{
case Z_AttributeValue_numeric:
switch (element->which)
{
case Z_AttributeValue_numeric:
- wrbuf_printf(b,"@attr %s%s%d=%d ", setname, sep,
- *element->attributeType, *element->value.numeric);
+ wrbuf_printf(b, ODR_INT_PRINTF, *element->value.numeric);
break;
case Z_AttributeValue_complex:
break;
case Z_AttributeValue_complex:
- wrbuf_printf(b,"@attr %s%s\"%d=", setname, sep,
- *element->attributeType);
for (i = 0; i<element->value.complex->num_list; i++)
{
if (i)
for (i = 0; i<element->value.complex->num_list; i++)
{
if (i)
- wrbuf_printf(b,",");
+ wrbuf_printf(b, ",");
if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_string)
if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_string)
- wrbuf_printf (b, "%s",
- element->value.complex->list[i]->u.string);
+ wrbuf_printf(b, "%s",
+ element->value.complex->list[i]->u.string);
else if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_numeric)
else if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_numeric)
- wrbuf_printf (b, "%d",
- *element->value.complex->list[i]->u.numeric);
+ wrbuf_printf(b, ODR_INT_PRINTF,
+ *element->value.complex->list[i]->u.numeric);
}
}
- wrbuf_printf(b, "\" ");
break;
default:
break;
default:
- wrbuf_printf (b, "@attr 1=unknown ");
+ wrbuf_printf (b, "@attr 1=unknown");
}
}
+ wrbuf_puts(b, " ");
}
static const char *complex_op_name(const Z_Operator *op)
}
static const char *complex_op_name(const Z_Operator *op)
@@
-117,7
+115,8
@@
static void yaz_apt_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt)
strlen(zapt->term->u.characterString));
break;
case Z_Term_numeric:
strlen(zapt->term->u.characterString));
break;
case Z_Term_numeric:
- wrbuf_printf(b, "@term numeric %d ", *zapt->term->u.numeric);
+ wrbuf_printf(b, "@term numeric " ODR_INT_PRINTF " ",
+ *zapt->term->u.numeric);
break;
case Z_Term_null:
wrbuf_printf(b, "@term null x");
break;
case Z_Term_null:
wrbuf_printf(b, "@term null x");
@@
-142,7
+141,8
@@
static void yaz_rpnstructure_to_wrbuf(WRBUF b, const Z_RPNStructure *zs)
else
wrbuf_putc(b, '0');
else
wrbuf_putc(b, '0');
- wrbuf_printf(b, " %d %d %d ", *op->u.prox->distance,
+ wrbuf_printf(b, " " ODR_INT_PRINTF " %d "
+ ODR_INT_PRINTF " ", *op->u.prox->distance,
*op->u.prox->ordered,
*op->u.prox->relationType);
*op->u.prox->ordered,
*op->u.prox->relationType);
@@
-158,7
+158,7
@@
static void yaz_rpnstructure_to_wrbuf(WRBUF b, const Z_RPNStructure *zs)
wrbuf_printf(b, "%d", op->u.prox->which);
}
if (op->u.prox->u.known)
wrbuf_printf(b, "%d", op->u.prox->which);
}
if (op->u.prox->u.known)
- wrbuf_printf(b, " %d ", *op->u.prox->u.known);
+ wrbuf_printf(b, " " ODR_INT_PRINTF " ", *op->u.prox->u.known);
else
wrbuf_printf(b, " 0 ");
}
else
wrbuf_printf(b, " 0 ");
}
@@
-230,7
+230,7
@@
void yaz_scan_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt,
yaz_apt_to_wrbuf(b, zapt);
}
yaz_apt_to_wrbuf(b, zapt);
}
-void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags)
+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 ");
{
/* we only dump the first diag - that keeps the log cleaner. */
wrbuf_printf(b," ERROR ");
@@
-240,7
+240,7
@@
void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags)
{
Z_DefaultDiagFormat *e=diags[0]->u.defaultFormat;
if (e->condition)
{
Z_DefaultDiagFormat *e=diags[0]->u.defaultFormat;
if (e->condition)
- wrbuf_printf(b, "%d ",*e->condition);
+ wrbuf_printf(b, ODR_INT_PRINTF " ",*e->condition);
else
wrbuf_printf(b, "?? ");
if ((e->which==Z_DefaultDiagFormat_v2Addinfo) && (e->u.v2Addinfo))
else
wrbuf_printf(b, "?? ");
if ((e->which==Z_DefaultDiagFormat_v2Addinfo) && (e->u.v2Addinfo))
@@
-253,6
+253,7
@@
void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab