/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
yaz_tok_cfg_t tok_cfg;
int error;
char *addinfo;
- WRBUF w;
NMEM nmem;
};
{
cql_transform_t ct = (cql_transform_t) xmalloc(sizeof(*ct));
ct->tok_cfg = yaz_tok_cfg_create();
- ct->w = wrbuf_alloc();
ct->error = 0;
ct->addinfo = 0;
ct->entry = 0;
Z_AttributeElement *ae[20];
int ret = 0; /* 0=OK, != 0 FAIL */
int t;
+ WRBUF w = wrbuf_alloc();
+
t = yaz_tok_move(tp);
while (t == YAZ_TOK_STRING && ae_num < 20)
elem = (Z_AttributeElement *) nmem_malloc(ct->nmem, sizeof(*elem));
elem->attributeSet = 0;
ae[ae_num] = elem;
- wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ wrbuf_puts(w, yaz_tok_parse_string(tp));
wrbuf_puts(type_str, yaz_tok_parse_string(tp));
t = yaz_tok_move(tp);
if (t == YAZ_TOK_EOF)
}
if (t == YAZ_TOK_STRING)
{
- wrbuf_puts(ct->w, " ");
- wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ wrbuf_puts(w, " ");
+ wrbuf_puts(w, yaz_tok_parse_string(tp));
set_str = type_str;
elem->attributeSet =
ca->num_semanticAction = 0;
ca->semanticAction = 0;
}
- wrbuf_puts(ct->w, "=");
- wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ wrbuf_puts(w, "=");
+ wrbuf_puts(w, yaz_tok_parse_string(tp));
t = yaz_tok_move(tp);
- wrbuf_puts(ct->w, " ");
+ wrbuf_puts(w, " ");
ae_num++;
}
if (ret == 0) /* OK? */
pp = &(*pp)->next;
*pp = (struct cql_prop_entry *) xmalloc(sizeof(**pp));
(*pp)->pattern = xstrdup(pattern);
- (*pp)->value = xstrdup(wrbuf_cstr(ct->w));
+ (*pp)->value = xstrdup(wrbuf_cstr(w));
(*pp)->attr_list.num_attributes = ae_num;
if (ae_num == 0)
odr_destroy(pr);
}
}
+ wrbuf_destroy(w);
return ret;
}
{
yaz_tok_parse_t tp = yaz_tok_parse_buf(ct->tok_cfg, line);
int t;
- wrbuf_rewind(ct->w);
t = yaz_tok_move(tp);
if (t == YAZ_TOK_STRING)
{
}
xfree(ct->addinfo);
yaz_tok_cfg_destroy(ct->tok_cfg);
- wrbuf_destroy(ct->w);
nmem_destroy(ct->nmem);
xfree(ct);
}
return 0;
}
-
static void emit_term(cql_transform_t ct,
struct cql_node *cn,
const char *term, int length,
if (has_modifier(cn, "regexp"))
process_term = 0;
+ else if (has_modifier(cn, "unmasked"))
+ process_term = 0;
else if (cql_lookup_property(ct, "truncation", 0, "cql"))
{
process_term = 0;
assert(cn->which == CQL_NODE_ST);
if (process_term)
- {
+ { /* convert term via truncation.things */
unsigned anchor = 0;
unsigned trunc = 0;
for (i = 0; i < length; i++)