~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to contrib/tsearch/query.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __QUERY_H__
 
2
#define __QUERY_H__
 
3
/*
 
4
#define BS_DEBUG
 
5
*/
 
6
 
 
7
 
 
8
/*
 
9
 * item in polish notation with back link
 
10
 * to left operand
 
11
 */
 
12
typedef struct ITEM
 
13
{
 
14
        int2            type;
 
15
        int2            left;
 
16
        int4            val;
 
17
        /* user-friendly value */
 
18
        uint16          distance;
 
19
        uint16          length;
 
20
}       ITEM;
 
21
 
 
22
/*
 
23
 *Storage:
 
24
 *      (len)(size)(array of ITEM)(array of operand in user-friendly form)
 
25
 */
 
26
typedef struct
 
27
{
 
28
        int4            len;
 
29
        int4            size;
 
30
        char            data[1];
 
31
}       QUERYTYPE;
 
32
 
 
33
#define HDRSIZEQT       ( 2*sizeof(int4) )
 
34
#define COMPUTESIZE(size,lenofoperand)  ( HDRSIZEQT + size * sizeof(ITEM) + lenofoperand )
 
35
#define GETQUERY(x)  (ITEM*)( (char*)(x)+HDRSIZEQT )
 
36
#define GETOPERAND(x)   ( (char*)GETQUERY(x) + ((QUERYTYPE*)x)->size * sizeof(ITEM) )
 
37
 
 
38
#define ISOPERATOR(x) ( (x)=='!' || (x)=='&' || (x)=='|' || (x)=='(' || (x)==')' )
 
39
 
 
40
#define END                             0
 
41
#define ERR                             1
 
42
#define VAL                             2
 
43
#define OPR                             3
 
44
#define OPEN                    4
 
45
#define CLOSE                   5
 
46
#define VALTRUE                 6               /* for stop words */
 
47
#define VALFALSE                7
 
48
 
 
49
bool execute(ITEM * curitem, void *checkval,
 
50
                bool calcnot, bool (*chkcond) (void *checkval, ITEM * val));
 
51
 
 
52
#endif