summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/tsearch/dicts/spell.h44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/include/tsearch/dicts/spell.h b/src/include/tsearch/dicts/spell.h
index 8116bd20160..cbd51742098 100644
--- a/src/include/tsearch/dicts/spell.h
+++ b/src/include/tsearch/dicts/spell.h
@@ -45,7 +45,7 @@ typedef struct
#define FF_COMPOUNDLAST 0x08
#define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | \
FF_COMPOUNDLAST )
-#define FF_DICTFLAGMASK 0x0f
+#define FF_COMPOUNDFLAGMASK 0x0f
typedef struct SPNode
{
@@ -86,7 +86,7 @@ typedef struct spell_struct
*/
typedef struct aff_struct
{
- uint32 flag:16;
+ char *flag;
/* FF_SUFFIX or FF_PREFIX */
uint32 type:1,
flagflags:7,
@@ -146,14 +146,34 @@ typedef struct
bool issuffix;
} CMPDAffix;
+/*
+ * Type of encoding affix flags in Hunspel dictionaries
+ */
typedef enum
{
- FM_CHAR,
- FM_LONG,
- FM_NUM
+ FM_CHAR, /* one character (like ispell) */
+ FM_LONG, /* two characters */
+ FM_NUM /* number, >= 0 and < 65536 */
} FlagMode;
-#define FLAGCHAR_MAXSIZE (1 << 8)
+/*
+ * Structure to store Hunspell options. Flag representation depends on flag
+ * type. These flags are about support of compound words.
+ */
+typedef struct CompoundAffixFlag
+{
+ union
+ {
+ /* Flag name if flagMode is FM_CHAR or FM_LONG */
+ char *s;
+ /* Flag name if flagMode is FM_NUM */
+ uint32 i;
+ } flag;
+ /* we don't have a bsearch_arg version, so, copy FlagMode */
+ FlagMode flagMode;
+ uint32 value;
+} CompoundAffixFlag;
+
#define FLAGNUM_MAXSIZE (1 << 16)
typedef struct
@@ -174,11 +194,21 @@ typedef struct
CMPDAffix *CompoundAffix;
- unsigned char flagval[FLAGNUM_MAXSIZE];
bool usecompound;
FlagMode flagMode;
/*
+ * All follow fields are actually needed only for initialization
+ */
+
+ /* Array of Hunspell options in affix file */
+ CompoundAffixFlag *CompoundAffixFlags;
+ /* number of entries in CompoundAffixFlags array */
+ int nCompoundAffixFlag;
+ /* allocated length of CompoundAffixFlags array */
+ int mCompoundAffixFlag;
+
+ /*
* Remaining fields are only used during dictionary construction; they are
* set up by NIStartBuild and cleared by NIFinishBuild.
*/