1 /*-------------------------------------------------------------------------
5 * Declarations for ISpell dictionary
7 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
11 *-------------------------------------------------------------------------
17 #include "regex/regex.h"
18 #include "tsearch/dicts/regis.h"
19 #include "tsearch/ts_public.h"
22 * Max length of a flag name. Names longer than this will be truncated
39 * Names of FF_ are correlated with Hunspell options in affix file
40 * http://sourceforge.net/docman/display_doc.php?docid=29374&group_id=143754
42 #define FF_COMPOUNDONLY 0x01
43 #define FF_COMPOUNDBEGIN 0x02
44 #define FF_COMPOUNDMIDDLE 0x04
45 #define FF_COMPOUNDLAST 0x08
46 #define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | FF_COMPOUNDLAST )
47 #define FF_DICTFLAGMASK 0x0f
55 #define SPNHDRSZ (offsetof(SPNode,data))
58 typedef struct spell_struct
63 * flag is filled in by NIImportDictionary. After NISortDictionary, d
64 * is valid and flag is invalid.
66 char flag
[MAXFLAGLEN
];
73 char word
[1]; /* variable length, null-terminated */
76 #define SPELLHDRSZ (offsetof(SPELL, word))
78 typedef struct aff_struct
96 * affixes use dictionary flags too
98 #define FF_COMPOUNDPERMITFLAG 0x10
99 #define FF_COMPOUNDFORBIDFLAG 0x20
100 #define FF_CROSSPRODUCT 0x40
103 * Don't change the order of these. Initialization sorts by these,
104 * and expects prefixes to come first after sorting.
116 struct AffixNode
*node
;
119 typedef struct AffixNode
123 AffixNodeData data
[1];
126 #define ANHRDSZ (offsetof(AffixNode, data))
142 * Temporary array of all words in the dict file. Only used during
146 int nspell
; /* number of valid entries in Spell array */
147 int mspell
; /* allocated length of Spell array */
157 CMPDAffix
*CompoundAffix
;
159 unsigned char flagval
[256];
163 extern TSLexeme
*NINormalizeWord(IspellDict
*Conf
, char *word
);
164 extern void NIImportAffixes(IspellDict
*Conf
, const char *filename
);
165 extern void NIImportDictionary(IspellDict
*Conf
, const char *filename
);
166 extern void NISortDictionary(IspellDict
*Conf
);
167 extern void NISortAffixes(IspellDict
*Conf
);