2 * Copyright (C) 1995-2005, Index Data ApS
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation, in whole or in part, for any purpose, is hereby granted,
8 * 1. This copyright and permission notice appear in all copies of the
9 * software and its documentation. Notices of copyright or attribution
10 * which appear at the beginning of any file must remain unchanged.
12 * 2. The name of Index Data or the individual authors may not be used to
13 * endorse or promote products derived from this software without specific
14 * prior written permission.
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22 * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 * $Id: pquery.h,v 1.6 2005-01-15 19:47:09 adam Exp $
30 * \brief Header for PQF parsing
36 #include <yaz/yconfig.h>
37 #include <yaz/proto.h>
41 typedef struct yaz_pqf_parser *YAZ_PQF_Parser;
43 YAZ_EXPORT Z_RPNQuery *p_query_rpn (ODR o, oid_proto proto, const char *qbuf);
45 YAZ_EXPORT Z_AttributesPlusTerm *p_query_scan (ODR o, oid_proto proto,
46 Odr_oid **attributeSetP, const char *qbuf);
47 YAZ_EXPORT int p_query_attset (const char *arg);
49 YAZ_EXPORT YAZ_PQF_Parser yaz_pqf_create (void);
50 YAZ_EXPORT Z_RPNQuery *yaz_pqf_parse (YAZ_PQF_Parser p, ODR o,
52 YAZ_EXPORT Z_AttributesPlusTerm *yaz_pqf_scan (YAZ_PQF_Parser p, ODR o,
53 Odr_oid **attributeSetId,
55 YAZ_EXPORT void yaz_pqf_destroy (YAZ_PQF_Parser p);
57 YAZ_EXPORT int yaz_pqf_error (YAZ_PQF_Parser p, const char **msg, size_t *off);
61 #define YAZ_PQF_ERROR_NONE 0
63 /* extra token (end of query expected) */
64 #define YAZ_PQF_ERROR_EXTRA 1
66 /* missing token (at least one token expected) */
67 #define YAZ_PQF_ERROR_MISSING 2
69 /* bad attribute set (for @attr and @attrset) */
70 #define YAZ_PQF_ERROR_ATTSET 3
72 /* too many items (limit reached - too many attributes, etc) */
73 #define YAZ_PQF_ERROR_TOOMANY 4
75 /* bad format of attribute (missing =) */
76 #define YAZ_PQF_ERROR_BADATTR 5
78 /* internal failure */
79 #define YAZ_PQF_ERROR_INTERNAL 6