YAZ  5.34.0
yaz-ccl.c
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data
3  * See the file LICENSE for details.
4  */
9 #if HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 
17 #include <yaz/yaz-ccl.h>
18 #include <yaz/pquery.h>
19 
21 {
22  YAZ_PQF_Parser parser = yaz_pqf_create();
23  WRBUF wr = wrbuf_alloc();
24  Z_RPNQuery *q;
25 
26  ccl_pquery(wr, p);
27 
28  q = yaz_pqf_parse(parser, o, wrbuf_cstr(wr));
29 
30  wrbuf_destroy(wr);
31  yaz_pqf_destroy(parser);
32  return q;
33 }
34 
36 {
37  YAZ_PQF_Parser parser = yaz_pqf_create();
38  WRBUF wr = wrbuf_alloc();
40  Odr_oid *setp;
41 
42  ccl_pquery(wr, p);
43 
44  q = yaz_pqf_scan(parser, o, &setp, wrbuf_cstr(wr));
45 
46  wrbuf_destroy(wr);
47  yaz_pqf_destroy(parser);
48  return q;
49 }
50 
51 /*
52  * Local variables:
53  * c-basic-offset: 4
54  * c-file-style: "Stroustrup"
55  * indent-tabs-mode: nil
56  * End:
57  * vim: shiftwidth=4 tabstop=8 expandtab
58  */
59 
void ccl_pquery(WRBUF w, struct ccl_rpn_node *p)
Definition: cclptree.c:135
short Odr_oid
Definition: oid_util.h:42
void yaz_pqf_destroy(YAZ_PQF_Parser p)
Definition: pquery.c:811
YAZ_PQF_Parser yaz_pqf_create(void)
Definition: pquery.c:798
Z_AttributesPlusTerm * yaz_pqf_scan(YAZ_PQF_Parser p, ODR o, Odr_oid **attributeSetP, const char *qbuf)
Definition: pquery.c:824
Z_RPNQuery * yaz_pqf_parse(YAZ_PQF_Parser p, ODR o, const char *qbuf)
Definition: pquery.c:816
Header for PQF parsing.
RPN tree structure node.
Definition: ccl.h:128
Definition: odr.h:125
string buffer
Definition: wrbuf.h:43
void wrbuf_destroy(WRBUF b)
destroy WRBUF and its buffer
Definition: wrbuf.c:38
WRBUF wrbuf_alloc(void)
construct WRBUF
Definition: wrbuf.c:25
const char * wrbuf_cstr(WRBUF b)
returns WRBUF content as C-string
Definition: wrbuf.c:281
Z_AttributesPlusTerm * ccl_scan_query(ODR o, struct ccl_rpn_node *p)
Definition: yaz-ccl.c:35
Z_RPNQuery * ccl_rpn_query(ODR o, struct ccl_rpn_node *p)
Definition: yaz-ccl.c:20
Header for CCL node tree to RPN converson utilities.