82 const char *value_str = 0;
179 (*pp)->attr_list.num_attributes = ae_num;
181 (*pp)->attr_list.attributes = 0;
187 memcpy((*pp)->attr_list.attributes, ae,
233 while (ret == 0 && fgets(line,
sizeof(line)-1, f))
293 FILE *f = fopen(fname,
"r");
309#define Z_AttributeValue_numeric 1
310#define Z_AttributeValue_complex 2
337 const char *category,
341 size_t clen = strlen(category);
344 if (!strncmp(e->
pattern, category, clen))
378 const char *pat1,
const char *pat2,
384 if (pat1 && pat2 && pat3)
386 else if (pat1 && pat2)
388 else if (pat1 && pat3)
404 const char *uri,
const char *val,
const char *default_val,
405 void (*pr)(
const char *buf,
void *client_data),
410 const char *eval = val ? val : default_val;
411 const char *prefix = 0;
419 !strcmp(e->
value, uri))
432 if (!res && !prefix && !strcmp(category,
"relation"))
434 if (!strcmp(val,
"=="))
436 if (!strcmp(val,
"="))
438 if (!strcmp(val,
"<="))
440 if (!strcmp(val,
">="))
450 const char *cp0 = res, *cp1;
451 while ((cp1 = strchr(cp0,
'=')))
454 while (*cp1 && *cp1 !=
' ')
456 if (cp1 - cp0 >= (ptrdiff_t)
sizeof(buf))
458 memcpy(buf, cp0, cp1 - cp0);
460 (*pr)(
"@attr ", client_data);
462 for (i = 0; buf[i]; i++)
465 (*pr)(eval, client_data);
471 (*pr)(tmp, client_data);
474 (*pr)(
" ", client_data);
490 const char *val,
const char *default_val,
491 void (*pr)(
const char *buf,
void *client_data),
496 val, default_val, pr, client_data, errcode);
501 void (*pr)(
const char *buf,
void *client_data),
506 (*pr)(buf, client_data);
507 (*pr)(
" ", client_data);
513 void (*pr)(
const char *buf,
void *client_data),
525 const char *term = mods->
u.
st.
term;
528 if (!strcmp(
name,
"distance")) {
529 distance = strtol(term, (
char**) 0, 0);
530 if (!strcmp(relation,
"="))
532 else if (!strcmp(relation,
">"))
534 else if (!strcmp(relation,
"<"))
536 else if (!strcmp(relation,
">="))
538 else if (!strcmp(relation,
"<="))
540 else if (!strcmp(relation,
"<>"))
548 else if (!strcmp(
name,
"ordered"))
550 else if (!strcmp(
name,
"unordered"))
552 else if (!strcmp(
name,
"unit"))
570 distance = (unit == 2) ? 1 : 0;
576 (*pr)(
"k ", client_data);
595 const char *
term,
int length,
596 void (*pr)(
const char *buf,
void *client_data),
602 int process_term = 1;
612 r =
cql_pr_attr(ct, addinfo,
"truncation",
"cql", 0,
623 for (i = 0; i < length; i++)
625 if (
term[i] ==
'\\' && i < length - 1)
634 else if (i == length - 1)
640 else if (i == length - 1)
653 r =
cql_pr_attr(ct, addinfo,
"position",
"firstAndLast", 0,
661 else if (anchor == 1)
663 r =
cql_pr_attr(ct, addinfo,
"position",
"first", 0,
671 else if (anchor == 2)
673 r =
cql_pr_attr(ct, addinfo,
"position",
"last", 0,
690 if (trunc == 3 && !
cql_pr_attr(ct, addinfo,
"truncation",
691 "both", 0, pr, client_data, 0))
696 else if (trunc == 1 && !
cql_pr_attr(ct, addinfo,
"truncation",
697 "left", 0, pr, client_data, 0))
702 else if (trunc == 2 && !
cql_pr_attr(ct, addinfo,
"truncation",
703 "right", 0, pr, client_data, 0))
715 r =
cql_pr_attr(ct, addinfo,
"truncation",
"z3958", 0,
737 "relationModifier", mod->
u.
st.
index, 0,
745 (*pr)(
"\"", client_data);
747 for (i = 0; i < length; i++)
750 if (
term[i] ==
'\\' && i < length - 1)
753 if (strchr(
"\"\\",
term[i]))
754 pr(
"\\", client_data);
755 if (z3958_mode && strchr(
"#?",
term[i]))
756 pr(
"\\\\", client_data);
761 else if (z3958_mode &&
term[i] ==
'*')
763 pr(
"?", client_data);
765 pr(
"\\\\", client_data);
767 else if (z3958_mode &&
term[i] ==
'?')
769 pr(
"#", client_data);
774 pr(
"\\", client_data);
775 if (z3958_mode && strchr(
"#?",
term[i]))
776 pr(
"\\\\", client_data);
784 for (i = 0; i < length; i++)
792 (*pr)(
"\" ", client_data);
798 void (*pr)(
const char *buf,
void *client_data),
806 (*pr)(
"@", client_data);
807 (*pr)(op, client_data);
808 (*pr)(
" ", client_data);
816 (*pr)(
"@", client_data);
817 (*pr)(op, client_data);
818 (*pr)(
" ", client_data);
828 void (*pr)(
const char *buf,
void *client_data),
833 const char *cp0 = cn->
u.
st.
term;
835 const char *last_term = 0;
841 cp1 = strchr(cp0,
' ');
844 (*pr)(
"@", client_data);
845 (*pr)(op, client_data);
846 (*pr)(
" ", client_data);
847 r =
emit_term(ct, cn, addinfo, last_term, last_length,
852 last_length = cp1 - cp0;
854 last_length = strlen(cp0);
858 r =
emit_term(ct, cn, addinfo, last_term, last_length, pr, client_data);
864 void (*pr)(
const char *buf,
void *client_data),
882 (*pr)(
"@set \"", client_data);
883 (*pr)(cn->
u.
st.
term, client_data);
884 (*pr)(
"\" ", client_data);
905 pr(
"@prox 0 0 0 0 k 8 ", client_data);
909 cql_pr_attr(ct, addinfo,
"always", 0, 0, pr, client_data, 0);
924 r =
emit_terms(ct, cn, addinfo, pr, client_data,
"and");
939 pr(mod->
u.
st.
term, client_data);
940 pr(
" ", client_data);
946 (*pr)(
"@", client_data);
948 (*pr)(
" ", client_data);
952 r =
cql_pr_prox(ct, mods, addinfo, pr, client_data);
974 fprintf(stderr,
"Fatal: impossible CQL node-type %d\n", cn->
which);
982 void (*pr)(
const char *buf,
void *client_data),
996 r =
emit_node(ct, cn, addinfo, pr, client_data);
1002 void (*pr)(
const char *buf,
void *client_data),
1037 info.
buf[info.
off] =
'\0';
#define CQL_NODE_SORT
Node type: sortby single spec.
struct cql_transform_t_ * cql_transform_t
CQL transform handle. The transform describes how to convert from CQL to PQF (Type-1 AKA RPN).
#define CQL_NODE_ST
Node type: search term.
#define CQL_NODE_BOOL
Node type: boolean.
int cql_strcmp(const char *s1, const char *s2)
compares two CQL strings (ala strcmp)
int cql_strncmp(const char *s1, const char *s2, size_t n)
compares two CQL strings (ala strncmp)
struct cql_node * cql_apply_prefix(NMEM nmem, struct cql_node *n, const char *prefix, const char *uri)
applies a prefix+uri to "unresolved" index and relation URIs. "unresolved" URIs are those nodes where...
void cql_fputs(const char *buf, void *client_data)
stream handle for file (used by cql_to_xml_stdio)
const char * cql_uri(void)
returns the standard CQL context set URI.
Diagnostics: Generated by csvtodiag.tcl from ./srw.csv.
#define YAZ_SRW_UNSUPP_PROX_RELATION
#define YAZ_SRW_UNSUPP_CONTEXT_SET
#define YAZ_SRW_UNSUPP_INDEX
#define YAZ_SRW_MASKING_CHAR_UNSUPP
#define YAZ_SRW_UNSUPP_PROX_UNIT
#define YAZ_SRW_UNSUPP_BOOLEAN_MODIFIER
#define YAZ_SRW_UNSUPP_RELATION
#define YAZ_SRW_ANCHORING_CHAR_IN_UNSUPP_POSITION
#define YAZ_SRW_TOO_MANY_CHARS_IN_QUERY
#define YAZ_SRW_UNSUPP_RELATION_MODIFIER
#define YAZ_SRW_UNSUPP_COMBI_OF_RELATION_AND_TERM
void yaz_log(int level, const char *fmt,...)
Writes log message.
FILE * yaz_log_file(void)
returns FILE handle for log or NULL if no file is in use
#define YLOG_WARN
log level: warning
int yaz_memcmp(const void *a, const void *b, size_t len_a, size_t len_b)
compares two buffers of different size
Header for YAZ iconv interface.
NMEM nmem_create(void)
returns new NMEM handle
void * nmem_malloc(NMEM n, size_t size)
allocates memory block on NMEM handle
void nmem_destroy(NMEM n)
destroys NMEM handle and memory associated with it
struct nmem_control * NMEM
NMEM handle (an opaque pointer to memory).
nmem_int_t * nmem_intdup(NMEM mem, nmem_int_t v)
allocates and sets integer for NMEM
char * nmem_strdup(NMEM mem, const char *src)
allocates string on NMEM handle (similar strdup)
void odr_setprint_noclose(ODR o, FILE *file)
char * odr_getbuf(ODR o, int *len, int *size)
ODR odr_createmem(int direction)
Odr_oid * yaz_string_to_oid_nmem(yaz_oid_db_t oid_list, oid_class oclass, const char *name, NMEM nmem)
creates NMEM malloc'ed OID from string
yaz_oid_db_t yaz_oid_std(void)
returns standard OID database
const Odr_oid yaz_oid_attset_bib_1[]
int oid_oidcmp(const Odr_oid *o1, const Odr_oid *o2)
compares OIDs
int z_str_to_ProxUnit(const char *str)
converts unit name string to unit integer
Header for JSON functions.
Header for RPN to CQL tranform.
void yaz_snprintf(char *buf, size_t size, const char *fmt,...)
Header for config file reading utilities.
Z_ComplexAttribute * complex
Z_AttributeSetId * attributeSet
union Z_AttributeElement::@260252174261265367116362007076255375270002041323 value
Z_AttributeElement ** attributes
Z_StringOrNumeric ** list
Odr_int ** semanticAction
union Z_StringOrNumeric::@255321135104110073015132067151226017215302214211 u
Z_InternationalString * string
Structure used by cql_buf_write_handler.
struct cql_node::@103257335133214234142137075341003020020243260314::@231337216262210265241053375071103126222160053350 st
union cql_node::@103257335133214234142137075341003020020243260314 u
struct cql_node * extra_terms
struct cql_node::@103257335133214234142137075341003020020243260314::@240210333203360145104277071333350273146264012233 boolean
struct cql_node * modifiers
struct cql_node::@103257335133214234142137075341003020020243260314::@115152140343061015107127141216014153002063077012 sort
Z_AttributeList attr_list
struct cql_prop_entry * next
yaz_tok_parse_t yaz_tok_parse_buf(yaz_tok_cfg_t t, const char *buf)
yaz_tok_cfg_t yaz_tok_cfg_create(void)
void yaz_tok_parse_destroy(yaz_tok_parse_t tp)
void yaz_tok_cfg_single_tokens(yaz_tok_cfg_t t, const char *simple)
void yaz_tok_cfg_destroy(yaz_tok_cfg_t t)
const char * yaz_tok_parse_string(yaz_tok_parse_t tp)
int yaz_tok_move(yaz_tok_parse_t tp)
Header with public definitions about YAZ' tokenizer.
struct yaz_tok_parse * yaz_tok_parse_t
struct yaz_tok_cfg * yaz_tok_cfg_t
void wrbuf_destroy(WRBUF b)
destroy WRBUF and its buffer
const char * wrbuf_cstr(WRBUF b)
returns WRBUF content as C-string
void wrbuf_rewind(WRBUF b)
empty WRBUF content (length of buffer set to 0)
WRBUF wrbuf_alloc(void)
construct WRBUF
void wrbuf_puts(WRBUF b, const char *buf)
appends C-string to WRBUF
Header for WRBUF (growing buffer).
void cql_buf_write_handler(const char *b, void *client_data)
Handler for cql_buf_write_info.
Header for memory handling functions.
#define xstrdup(s)
utility macro which calls xstrdup_f
#define xfree(x)
utility macro which calls xfree_f
#define xmalloc(x)
utility macro which calls malloc_f
ASN.1 Module Z39-50-APDU-1995.
#define Z_AttributeValue_numeric
int z_AttributeList(ODR o, Z_AttributeList **p, int opt, const char *name)
#define Z_AttributeValue_complex
#define Z_StringOrNumeric_string
int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt, const char *name)
struct Z_ComplexAttribute Z_ComplexAttribute