Happy new year
[yaz-moved-to-github.git] / src / yaz-ccl.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2011 Index Data
3  * See the file LICENSE for details.
4  */
5 /**
6  * \file yaz-ccl.c
7  * \brief Implements CCL node tree to RPN converson.
8  */
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 #include <ctype.h>
17
18 #include <yaz/yaz-ccl.h>
19 #include <yaz/pquery.h>
20
21 Z_RPNQuery *ccl_rpn_query (ODR o, struct ccl_rpn_node *p)
22 {
23     YAZ_PQF_Parser parser = yaz_pqf_create();
24     WRBUF wr = wrbuf_alloc();
25     Z_RPNQuery *q;
26
27     ccl_pquery(wr, p);
28
29     q = yaz_pqf_parse(parser, o, wrbuf_cstr(wr));
30
31     wrbuf_destroy(wr);
32     yaz_pqf_destroy(parser);
33     return q;
34 }
35
36 Z_AttributesPlusTerm *ccl_scan_query (ODR o, struct ccl_rpn_node *p)
37 {
38     YAZ_PQF_Parser parser = yaz_pqf_create();
39     WRBUF wr = wrbuf_alloc();
40     Z_AttributesPlusTerm *q;
41     Odr_oid *setp;
42
43     ccl_pquery(wr, p);
44
45     q = yaz_pqf_scan(parser, o, &setp, wrbuf_cstr(wr));
46
47     wrbuf_destroy(wr);
48     yaz_pqf_destroy(parser);
49     return q;
50 }
51
52 /*
53  * Local variables:
54  * c-basic-offset: 4
55  * c-file-style: "Stroustrup"
56  * indent-tabs-mode: nil
57  * End:
58  * vim: shiftwidth=4 tabstop=8 expandtab
59  */
60