~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to contrib/tsearch/txtidx.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 __TXTIDX_H__
 
2
#define __TXTIDX_H__
 
3
 
 
4
/*
 
5
#define TXTIDX_DEBUG
 
6
*/
 
7
 
 
8
#include "postgres.h"
 
9
 
 
10
#include "access/gist.h"
 
11
#include "access/itup.h"
 
12
#include "utils/builtins.h"
 
13
#include "storage/bufpage.h"
 
14
 
 
15
typedef struct
 
16
{
 
17
        uint16          len;
 
18
        uint16          pos;
 
19
}       WordEntry;
 
20
 
 
21
typedef struct
 
22
{
 
23
        int4            len;
 
24
        int4            size;
 
25
        char            data[1];
 
26
}       txtidx;
 
27
 
 
28
#define DATAHDRSIZE (sizeof(int4)*2)
 
29
#define CALCDATASIZE(x, lenstr) ( x * sizeof(WordEntry) + DATAHDRSIZE + lenstr )
 
30
#define ARRPTR(x)       ( (WordEntry*) ( (char*)x + DATAHDRSIZE ) )
 
31
#define STRPTR(x)       ( (char*)x + DATAHDRSIZE + ( sizeof(WordEntry) * ((txtidx*)x)->size ) )
 
32
#define STRSIZE(x)      ( ((txtidx*)x)->len - DATAHDRSIZE - ( sizeof(WordEntry) * ((txtidx*)x)->size ) )
 
33
 
 
34
typedef struct
 
35
{
 
36
        char       *prsbuf;
 
37
        char       *word;
 
38
        char       *curpos;
 
39
        int4            len;
 
40
        int4            state;
 
41
        bool            oprisdelim;
 
42
}       TI_IN_STATE;
 
43
 
 
44
int4            gettoken_txtidx(TI_IN_STATE * state);
 
45
 
 
46
#endif