~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to contrib/tsearch2/ispell/spell.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 __SPELL_H__
 
2
#define __SPELL_H__
 
3
 
 
4
#include <sys/types.h>
 
5
#include "regex/regex.h"
 
6
#include "regis.h"
 
7
#include "c.h"
 
8
 
 
9
 
 
10
struct SPNode;
 
11
 
 
12
 
 
13
typedef struct
 
14
{
 
15
        uint32
 
16
                                val:8,
 
17
                                isword:1,
 
18
                                compoundallow:1,
 
19
                                affix:22;
 
20
        struct SPNode *node;
 
21
}       SPNodeData;
 
22
 
 
23
typedef struct SPNode
 
24
{
 
25
        uint32          length;
 
26
        SPNodeData      data[1];
 
27
}       SPNode;
 
28
 
 
29
#define SPNHRDSZ        (sizeof(uint32))
 
30
 
 
31
 
 
32
typedef struct spell_struct
 
33
{
 
34
        char       *word;
 
35
        union
 
36
        {
 
37
                char            flag[16];
 
38
                struct
 
39
                {
 
40
                        int                     affix;
 
41
                        int                     len;
 
42
                }                       d;
 
43
        }                       p;
 
44
}       SPELL;
 
45
 
 
46
typedef struct aff_struct
 
47
{
 
48
        uint32
 
49
                                flag:8,
 
50
                                type:2,
 
51
                                compile:1,
 
52
                                flagflags:3,
 
53
                                issimple:1,
 
54
                                isregis:1,
 
55
                                unused:1,
 
56
                                replen:16;
 
57
        char            *mask;
 
58
        char            *find;
 
59
        char            *repl;
 
60
        union
 
61
        {
 
62
                regex_t         regex;
 
63
                Regis           regis;
 
64
        }                       reg;
 
65
}       AFFIX;
 
66
 
 
67
#define FF_CROSSPRODUCT         0x01
 
68
#define FF_COMPOUNDWORD         0x02
 
69
#define FF_COMPOUNDONLYAFX              0x04
 
70
#define FF_SUFFIX                               2
 
71
#define FF_PREFIX                               1
 
72
 
 
73
struct AffixNode;
 
74
 
 
75
typedef struct
 
76
{
 
77
        uint32
 
78
                                val:8,
 
79
                                naff:24;
 
80
        AFFIX     **aff;
 
81
        struct AffixNode *node;
 
82
}       AffixNodeData;
 
83
 
 
84
typedef struct AffixNode
 
85
{
 
86
        uint32          isvoid:1,
 
87
                                length:31;
 
88
        AffixNodeData data[1];
 
89
}       AffixNode;
 
90
 
 
91
#define ANHRDSZ            (sizeof(uint32))
 
92
 
 
93
typedef struct
 
94
{
 
95
        char       *affix;
 
96
        int                     len;
 
97
}       CMPDAffix;
 
98
 
 
99
typedef struct
 
100
{
 
101
        int                     maffixes;
 
102
        int                     naffixes;
 
103
        AFFIX      *Affix;
 
104
        char            compoundcontrol;
 
105
 
 
106
        int                     nspell;
 
107
        int                     mspell;
 
108
        SPELL      *Spell;
 
109
 
 
110
        AffixNode  *Suffix;
 
111
        AffixNode  *Prefix;
 
112
 
 
113
        SPNode     *Dictionary;
 
114
        char      **AffixData;
 
115
        CMPDAffix  *CompoundAffix;
 
116
 
 
117
}       IspellDict;
 
118
 
 
119
char      **NINormalizeWord(IspellDict * Conf, char *word);
 
120
int                     NIImportAffixes(IspellDict * Conf, const char *filename);
 
121
int                     NIImportDictionary(IspellDict * Conf, const char *filename);
 
122
 
 
123
int                     NIAddSpell(IspellDict * Conf, const char *word, const char *flag);
 
124
int                     NIAddAffix(IspellDict * Conf, int flag, char flagflags, const char *mask, const char *find, const char *repl, int type);
 
125
void            NISortDictionary(IspellDict * Conf);
 
126
void            NISortAffixes(IspellDict * Conf);
 
127
void            NIFree(IspellDict * Conf);
 
128
 
 
129
#endif