summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
092628f)
PQF decoding: attribute values that contain any non-digits are
treated as string attributes (previously decoding only checked
for leading character ([0-9]).
PQF encoding: attribute string values are not surrounded by
double-quotes.
if (li->lex_len >= sizeof(buf)-1)
return 0;
if (li->lex_len >= sizeof(buf)-1)
return 0;
- memcpy (buf, li->lex_buf, li->lex_len);
+ memcpy(buf, li->lex_buf, li->lex_len);
buf[li->lex_len] = '\0';
return yaz_string_to_oid_odr(yaz_oid_std(), CLASS_ATTSET, buf, o);
}
buf[li->lex_len] = '\0';
return yaz_string_to_oid_odr(yaz_oid_std(), CLASS_ATTSET, buf, o);
}
{
size_t len=strlen(src);
{
size_t len=strlen(src);
- if (li->lex_len == len+off && !memcmp (li->lex_buf+off, src, len-off))
+ if (li->lex_len == len+off && !memcmp(li->lex_buf+off, src, len-off))
if (**qptr == '\0')
return 0;
li->lex_len = 0;
if (**qptr == '\0')
return 0;
li->lex_len = 0;
- if ((sep_match = strchr (li->left_sep, **qptr)))
+ if ((sep_match = strchr(li->left_sep, **qptr)))
{
sep_char = li->right_sep[sep_match - li->left_sep];
++(*qptr);
}
li->lex_buf = *qptr;
{
sep_char = li->right_sep[sep_match - li->left_sep];
++(*qptr);
}
li->lex_buf = *qptr;
- if (**qptr == li->escape_char && isdigit (((const unsigned char *) *qptr)[1]))
+ if (**qptr == li->escape_char && isdigit(((const unsigned char *) *qptr)[1]))
{
++(li->lex_len);
++(*qptr);
{
++(li->lex_len);
++(*qptr);
if (sep_char == ' ' &&
li->lex_len >= 1 && li->lex_buf[0] == li->escape_char)
{
if (sep_char == ' ' &&
li->lex_len >= 1 && li->lex_buf[0] == li->escape_char)
{
- if (compare_term (li, "and", 1))
+ if (compare_term(li, "and", 1))
- if (compare_term (li, "or", 1))
+ if (compare_term(li, "or", 1))
- if (compare_term (li, "not", 1))
+ if (compare_term(li, "not", 1))
- if (compare_term (li, "attr", 1))
+ if (compare_term(li, "attr", 1))
- if (compare_term (li, "set", 1))
+ if (compare_term(li, "set", 1))
- if (compare_term (li, "attrset", 1))
+ if (compare_term(li, "attrset", 1))
- if (compare_term (li, "prox", 1))
+ if (compare_term(li, "prox", 1))
- if (compare_term (li, "term", 1))
+ if (compare_term(li, "term", 1))
return 'y';
}
return 't';
return 'y';
}
return 't';
s[1] = *++in;
s[2] = '\0';
len = len - 2;
s[1] = *++in;
s[2] = '\0';
len = len - 2;
s[2] = *++in;
s[3] = '\0';
len = len - 2;
s[2] = *++in;
s[3] = '\0';
len = len - 2;
char **attr_clist, Odr_oid **attr_set)
{
const char *cp;
char **attr_clist, Odr_oid **attr_set)
{
const char *cp;
- if (!(cp = strchr (li->lex_buf, '=')) ||
+ if (!(cp = strchr(li->lex_buf, '=')) ||
(size_t) (cp-li->lex_buf) > li->lex_len)
{
(size_t) (cp-li->lex_buf) > li->lex_len)
{
- attr_set[num_attr] = query_oid_getvalbyname (li, o);
+ attr_set[num_attr] = query_oid_getvalbyname(li, o);
if (attr_set[num_attr] == 0)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return 0;
}
if (attr_set[num_attr] == 0)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return 0;
}
{
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
}
{
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
}
- if (!(cp = strchr (li->lex_buf, '=')))
+ if (!(cp = strchr(li->lex_buf, '=')))
{
li->error = YAZ_PQF_ERROR_BADATTR;
return 0;
{
li->error = YAZ_PQF_ERROR_BADATTR;
return 0;
}
attr_list[2*num_attr] = odr_atoi(li->lex_buf);
cp++;
}
attr_list[2*num_attr] = odr_atoi(li->lex_buf);
cp++;
- if (*cp >= '0' && *cp <= '9')
- {
- attr_list[2*num_attr+1] = odr_atoi(cp);
- attr_clist[num_attr] = 0;
- }
- else
- {
- int len = li->lex_len - (cp - li->lex_buf);
- attr_list[2*num_attr+1] = 0;
- attr_clist[num_attr] = (char *) odr_malloc (o, len+1);
- len = escape_string(attr_clist[num_attr], cp, len);
- attr_clist[num_attr][len] = '\0';
- }
+
+ /* inspect value .. and make it a integer if it appears to be */
+ for (i = cp - li->lex_buf; i < li->lex_len; i++)
+ if (li->lex_buf[i] < '0' || li->lex_buf[i] > '9')
+ {
+ int len = li->lex_len - (cp - li->lex_buf);
+ attr_list[2*num_attr+1] = 0;
+ attr_clist[num_attr] = (char *) odr_malloc(o, len+1);
+ len = escape_string(attr_clist[num_attr], cp, len);
+ attr_clist[num_attr][len] = '\0';
+ return 1;
+ }
+ attr_list[2*num_attr+1] = odr_atoi(cp);
+ attr_clist[num_attr] = 0;
Z_Term *term;
Z_AttributeElement **elements;
Z_Term *term;
Z_AttributeElement **elements;
- zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt));
- term_octet = (Odr_oct *)odr_malloc (o, sizeof(*term_octet));
- term = (Z_Term *)odr_malloc (o, sizeof(*term));
+ zapt = (Z_AttributesPlusTerm *)odr_malloc(o, sizeof(*zapt));
+ term_octet = (Odr_oct *)odr_malloc(o, sizeof(*term_octet));
+ term = (Z_Term *)odr_malloc(o, sizeof(*term));
if (!num_attr)
elements = (Z_AttributeElement**)odr_nullval();
if (!num_attr)
elements = (Z_AttributeElement**)odr_nullval();
if (j < num_attr)
continue;
elements[k] =
if (j < num_attr)
continue;
elements[k] =
- (Z_AttributeElement*)odr_malloc (o,sizeof(**elements));
+ (Z_AttributeElement*)odr_malloc(o,sizeof(**elements));
elements[k]->attributeType = &attr_tmp[2*i];
elements[k]->attributeSet = attr_set[i];
elements[k]->attributeType = &attr_tmp[2*i];
elements[k]->attributeSet = attr_set[i];
{
elements[k]->which = Z_AttributeValue_complex;
elements[k]->value.complex = (Z_ComplexAttribute *)
{
elements[k]->which = Z_AttributeValue_complex;
elements[k]->value.complex = (Z_ComplexAttribute *)
- odr_malloc (o, sizeof(Z_ComplexAttribute));
+ odr_malloc(o, sizeof(Z_ComplexAttribute));
elements[k]->value.complex->num_list = 1;
elements[k]->value.complex->list =
(Z_StringOrNumeric **)
elements[k]->value.complex->num_list = 1;
elements[k]->value.complex->list =
(Z_StringOrNumeric **)
- odr_malloc (o, 1 * sizeof(Z_StringOrNumeric *));
+ odr_malloc(o, 1 * sizeof(Z_StringOrNumeric *));
elements[k]->value.complex->list[0] =
(Z_StringOrNumeric *)
elements[k]->value.complex->list[0] =
(Z_StringOrNumeric *)
- odr_malloc (o, sizeof(Z_StringOrNumeric));
+ odr_malloc(o, sizeof(Z_StringOrNumeric));
elements[k]->value.complex->list[0]->which =
Z_StringOrNumeric_string;
elements[k]->value.complex->list[0]->u.string =
elements[k]->value.complex->list[0]->which =
Z_StringOrNumeric_string;
elements[k]->value.complex->list[0]->u.string =
num_attr = k;
}
zapt->attributes = (Z_AttributeList *)
num_attr = k;
}
zapt->attributes = (Z_AttributeList *)
- odr_malloc (o, sizeof(*zapt->attributes));
+ odr_malloc(o, sizeof(*zapt->attributes));
zapt->attributes->num_attributes = num_attr;
zapt->attributes->attributes = elements;
zapt->term = term;
zapt->attributes->num_attributes = num_attr;
zapt->attributes->attributes = elements;
zapt->term = term;
- term_octet->buf = (unsigned char *)odr_malloc (o, 1 + li->lex_len);
+ term_octet->buf = (unsigned char *)odr_malloc(o, 1 + li->lex_len);
term_octet->size = term_octet->len =
term_octet->size = term_octet->len =
- escape_string ((char *) (term_octet->buf), li->lex_buf, li->lex_len);
+ escape_string((char *) (term_octet->buf), li->lex_buf, li->lex_len);
term_octet->buf[term_octet->size] = 0; /* null terminate */
switch (li->term_type)
term_octet->buf[term_octet->size] = 0; /* null terminate */
switch (li->term_type)
case Z_Term_characterString:
term->which = Z_Term_characterString;
term->u.characterString = (char*) term_octet->buf;
case Z_Term_characterString:
term->which = Z_Term_characterString;
term->u.characterString = (char*) term_octet->buf;
- /* null terminated above */
+ /* null terminated above */
break;
case Z_Term_numeric:
term->which = Z_Term_numeric;
break;
case Z_Term_numeric:
term->which = Z_Term_numeric;
- zo = (Z_Operand *)odr_malloc (o, sizeof(*zo));
+ zo = (Z_Operand *)odr_malloc(o, sizeof(*zo));
switch (li->query_look)
{
case 't':
switch (li->query_look)
{
case 't':
if (!(zo->u.attributesPlusTerm =
rpn_term(li, o, num_attr, attr_list, attr_clist, attr_set)))
return 0;
if (!(zo->u.attributesPlusTerm =
rpn_term(li, o, num_attr, attr_list, attr_clist, attr_set)))
return 0;
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
}
zo->which = Z_Operand_resultSetId;
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
}
zo->which = Z_Operand_resultSetId;
- zo->u.resultSetId = (char *)odr_malloc (o, li->lex_len+1);
- memcpy (zo->u.resultSetId, li->lex_buf, li->lex_len);
+ zo->u.resultSetId = (char *)odr_malloc(o, li->lex_len+1);
+ memcpy(zo->u.resultSetId, li->lex_buf, li->lex_len);
zo->u.resultSetId[li->lex_len] = '\0';
zo->u.resultSetId[li->lex_len] = '\0';
break;
default:
/* we're only called if one of the above types are seens so
break;
default:
/* we're only called if one of the above types are seens so
-static Z_ProximityOperator *rpn_proximity (struct yaz_pqf_parser *li, ODR o)
+static Z_ProximityOperator *rpn_proximity(struct yaz_pqf_parser *li, ODR o)
- Z_ProximityOperator *p = (Z_ProximityOperator *)odr_malloc (o, sizeof(*p));
+ Z_ProximityOperator *p = (Z_ProximityOperator *)odr_malloc(o, sizeof(*p));
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
else if (*li->lex_buf == 'p')
p->which = Z_ProximityOperator_private;
else
else if (*li->lex_buf == 'p')
p->which = Z_ProximityOperator_private;
else
- p->which = atoi (li->lex_buf);
+ p->which = atoi(li->lex_buf);
if (p->which != Z_ProximityOperator_known
&& p->which != Z_ProximityOperator_private)
if (p->which != Z_ProximityOperator_known
&& p->which != Z_ProximityOperator_private)
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
{
li->error = YAZ_PQF_ERROR_MISSING;
return NULL;
Z_Complex *zc;
Z_Operator *zo;
Z_Complex *zc;
Z_Operator *zo;
- zc = (Z_Complex *)odr_malloc (o, sizeof(*zc));
- zo = (Z_Operator *)odr_malloc (o, sizeof(*zo));
+ zc = (Z_Complex *)odr_malloc(o, sizeof(*zc));
+ zo = (Z_Operator *)odr_malloc(o, sizeof(*zo));
zc->roperator = zo;
switch (li->query_look)
{
zc->roperator = zo;
switch (li->query_look)
{
break;
case 'p':
zo->which = Z_Operator_prox;
break;
case 'p':
zo->which = Z_Operator_prox;
- zo->u.prox = rpn_proximity (li, o);
+ zo->u.prox = rpn_proximity(li, o);
if (!zo->u.prox)
return NULL;
break;
if (!zo->u.prox)
return NULL;
break;
li->error = YAZ_PQF_ERROR_INTERNAL;
return NULL;
}
li->error = YAZ_PQF_ERROR_INTERNAL;
return NULL;
}
if (!(zc->s1 =
rpn_structure(li, o, num_attr, max_attr, attr_list,
attr_clist, attr_set)))
if (!(zc->s1 =
rpn_structure(li, o, num_attr, max_attr, attr_list,
attr_clist, attr_set)))
{
if (!li->query_look)
return ;
{
if (!li->query_look)
return ;
- if (compare_term (li, "general", 0))
+ if (compare_term(li, "general", 0))
li->term_type = Z_Term_general;
li->term_type = Z_Term_general;
- else if (compare_term (li, "numeric", 0))
+ else if (compare_term(li, "numeric", 0))
li->term_type = Z_Term_numeric;
li->term_type = Z_Term_numeric;
- else if (compare_term (li, "string", 0))
+ else if (compare_term(li, "string", 0))
li->term_type = Z_Term_characterString;
li->term_type = Z_Term_characterString;
- else if (compare_term (li, "oid", 0))
+ else if (compare_term(li, "oid", 0))
li->term_type = Z_Term_oid;
li->term_type = Z_Term_oid;
- else if (compare_term (li, "datetime", 0))
+ else if (compare_term(li, "datetime", 0))
li->term_type = Z_Term_dateTime;
li->term_type = Z_Term_dateTime;
- else if (compare_term (li, "null", 0))
+ else if (compare_term(li, "null", 0))
li->term_type = Z_Term_null;
#if 0
else if (compare_term(li, "range", 0))
li->term_type = Z_Term_null;
#if 0
else if (compare_term(li, "range", 0))
li->external_type = VAL_MULTISRCH2;
}
#endif
li->external_type = VAL_MULTISRCH2;
}
#endif
}
static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o,
}
static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o,
- sz = (Z_RPNStructure *)odr_malloc (o, sizeof(*sz));
+ sz = (Z_RPNStructure *)odr_malloc(o, sizeof(*sz));
switch (li->query_look)
{
case 'a':
switch (li->query_look)
{
case 'a':
case 'p':
sz->which = Z_RPNStructure_complex;
if (!(sz->u.complex =
case 'p':
sz->which = Z_RPNStructure_complex;
if (!(sz->u.complex =
- rpn_complex (li, o, num_attr, max_attr, attr_list,
- attr_clist, attr_set)))
+ rpn_complex(li, o, num_attr, max_attr, attr_list,
+ attr_clist, attr_set)))
return NULL;
break;
case 't':
case 's':
sz->which = Z_RPNStructure_simple;
if (!(sz->u.simple =
return NULL;
break;
case 't':
case 's':
sz->which = Z_RPNStructure_simple;
if (!(sz->u.simple =
- rpn_simple (li, o, num_attr, attr_list,
- attr_clist, attr_set)))
+ rpn_simple(li, o, num_attr, attr_list,
+ attr_clist, attr_set)))
return NULL;
break;
case 'l':
return NULL;
break;
case 'l':
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
attr_clist, attr_set))
return 0;
num_attr++;
attr_clist, attr_set))
return 0;
num_attr++;
- rpn_structure (li, o, num_attr, max_attr, attr_list,
- attr_clist, attr_set);
+ rpn_structure(li, o, num_attr, max_attr, attr_list,
+ attr_clist, attr_set);
rpn_term_type(li);
return
rpn_term_type(li);
return
- rpn_structure (li, o, num_attr, max_attr, attr_list,
- attr_clist, attr_set);
+ rpn_structure(li, o, num_attr, max_attr, attr_list,
+ attr_clist, attr_set);
case 0: /* operator/operand expected! */
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
case 0: /* operator/operand expected! */
li->error = YAZ_PQF_ERROR_MISSING;
return 0;
Odr_oid *attr_set[512];
Odr_oid *top_set = 0;
Odr_oid *attr_set[512];
Odr_oid *top_set = 0;
- zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq));
- lex (li);
+ zq = (Z_RPNQuery *)odr_malloc(o, sizeof(*zq));
+ lex(li);
if (li->query_look == 'r')
{
if (li->query_look == 'r')
{
top_set = query_oid_getvalbyname(li, o);
if (!top_set)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return NULL;
}
top_set = query_oid_getvalbyname(li, o);
if (!top_set)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return NULL;
}
Odr_oid *top_set = 0;
Z_AttributesPlusTerm *apt;
Odr_oid *top_set = 0;
Z_AttributesPlusTerm *apt;
if (li->query_look == 'r')
{
if (li->query_look == 'r')
{
top_set = query_oid_getvalbyname(li, o);
if (!top_set)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return NULL;
}
top_set = query_oid_getvalbyname(li, o);
if (!top_set)
{
li->error = YAZ_PQF_ERROR_ATTSET;
return NULL;
}
{
if (li->query_look == 'l')
{
{
if (li->query_look == 'l')
{
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
if (!li->query_look)
{
li->error = YAZ_PQF_ERROR_MISSING;
attr_clist, attr_set))
return 0;
num_attr++;
attr_clist, attr_set))
return 0;
num_attr++;
}
else if (li->query_look == 'y')
{
}
else if (li->query_look == 'y')
{
rpn_term_type(li);
}
else
rpn_term_type(li);
}
else
}
apt = rpn_term(li, o, num_attr, attr_list, attr_clist, attr_set);
}
apt = rpn_term(li, o, num_attr, attr_list, attr_clist, attr_set);
if (li->query_look != 0)
{
if (li->query_look != 0)
{
-YAZ_PQF_Parser yaz_pqf_create (void)
+YAZ_PQF_Parser yaz_pqf_create(void)
- YAZ_PQF_Parser p = (YAZ_PQF_Parser) xmalloc (sizeof(*p));
+ YAZ_PQF_Parser p = (YAZ_PQF_Parser) xmalloc(sizeof(*p));
p->error = 0;
p->left_sep = "{\"";
p->error = 0;
p->left_sep = "{\"";
void yaz_pqf_destroy(YAZ_PQF_Parser p)
{
void yaz_pqf_destroy(YAZ_PQF_Parser p)
{
}
Z_RPNQuery *yaz_pqf_parse(YAZ_PQF_Parser p, ODR o, const char *qbuf)
}
Z_RPNQuery *yaz_pqf_parse(YAZ_PQF_Parser p, ODR o, const char *qbuf)
return p_query_scan_mk(p, o, attributeSetP);
}
return p_query_scan_mk(p, o, attributeSetP);
}
-int yaz_pqf_error (YAZ_PQF_Parser p, const char **msg, size_t *off)
+int yaz_pqf_error(YAZ_PQF_Parser p, const char **msg, size_t *off)
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" ODR_INT_PRINTF "=" ODR_INT_PRINTF " ",
- 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\""ODR_INT_PRINTF "=", 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)
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, ODR_INT_PRINTF,
- *element->value.complex->list[i]->u.numeric);
+ wrbuf_printf(b, ODR_INT_PRINTF,
+ *element->value.complex->list[i]->u.numeric);
- wrbuf_printf(b, "\" ");
- wrbuf_printf (b, "@attr 1=unknown ");
+ wrbuf_printf (b, "@attr 1=unknown");
}
static const char *complex_op_name(const Z_Operator *op)
}
static const char *complex_op_name(const Z_Operator *op)
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <yaz/wrbuf.h>
#include <yaz/querytowrbuf.h>
#include <yaz/pquery.h>
#include <yaz/wrbuf.h>
#include <yaz/querytowrbuf.h>
#include <yaz/pquery.h>
yaz_rpnquery_to_wrbuf(wrbuf, rpn);
if (!strcmp(wrbuf_cstr(wrbuf), expect_pqf))
yaz_rpnquery_to_wrbuf(wrbuf, rpn);
if (!strcmp(wrbuf_cstr(wrbuf), expect_pqf))
wrbuf_destroy(wrbuf);
}
}
wrbuf_destroy(wrbuf);
}
}
{
YAZ_CHECK(expect_pqf("a", "@attrset Bib-1 a", YAZ_PQF_ERROR_NONE));
YAZ_CHECK(expect_pqf("@attr 1=4 a", "@attrset Bib-1 @attr 1=4 a", YAZ_PQF_ERROR_NONE));
{
YAZ_CHECK(expect_pqf("a", "@attrset Bib-1 a", YAZ_PQF_ERROR_NONE));
YAZ_CHECK(expect_pqf("@attr 1=4 a", "@attrset Bib-1 @attr 1=4 a", YAZ_PQF_ERROR_NONE));
+ YAZ_CHECK(expect_pqf("@attr 1=title a", "@attrset Bib-1 @attr 1=title a", YAZ_PQF_ERROR_NONE));
YAZ_CHECK(expect_pqf("a b", "", YAZ_PQF_ERROR_EXTRA));
YAZ_CHECK(expect_pqf("@and a", "", YAZ_PQF_ERROR_MISSING));
YAZ_CHECK(expect_pqf("@attr p=q a", "", YAZ_PQF_ERROR_BAD_INTEGER));
YAZ_CHECK(expect_pqf("a b", "", YAZ_PQF_ERROR_EXTRA));
YAZ_CHECK(expect_pqf("@and a", "", YAZ_PQF_ERROR_MISSING));
YAZ_CHECK(expect_pqf("@attr p=q a", "", YAZ_PQF_ERROR_BAD_INTEGER));
YAZ_PQF_ERROR_NONE));
YAZ_CHECK(expect_pqf("@prox 0 0 0 0 3 0 a b", "",
YAZ_PQF_ERROR_PROXIMITY));
YAZ_PQF_ERROR_NONE));
YAZ_CHECK(expect_pqf("@prox 0 0 0 0 3 0 a b", "",
YAZ_PQF_ERROR_PROXIMITY));
+ YAZ_CHECK(expect_pqf("@attr 1=12345678901 x", "@attrset Bib-1 @attr 1=12345678901 x", YAZ_PQF_ERROR_NONE));
+ YAZ_CHECK(expect_pqf("@attr 1=1234567890.1 x", "@attrset Bib-1 @attr 1=1234567890.1 x", YAZ_PQF_ERROR_NONE));
}
int main (int argc, char **argv)
}
int main (int argc, char **argv)
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"</rpn></query>\n",
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"</rpn></query>\n",
- "RPN @attrset Bib-1 @attr \"1=title\" @attr 2=1 computer"
+ "RPN @attrset Bib-1 @attr 1=title @attr 2=1 computer"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(