Update Scintilla to 4.0.4
[TortoiseGit.git] / ext / hunspell / affixmgr.hxx
blobd9c625aed0904b50107cf1d09bd8fc23db49a391
1 #ifndef _AFFIXMGR_HXX_
2 #define _AFFIXMGR_HXX_
4 #include "hunvisapi.h"
6 #include <stdio.h>
8 #include "atypes.hxx"
9 #include "baseaffix.hxx"
10 #include "hashmgr.hxx"
11 #include "phonet.hxx"
12 #include "replist.hxx"
14 // check flag duplication
15 #define dupSFX (1 << 0)
16 #define dupPFX (1 << 1)
18 class PfxEntry;
19 class SfxEntry;
21 class LIBHUNSPELL_DLL_EXPORTED AffixMgr
24 PfxEntry * pStart[SETSIZE];
25 SfxEntry * sStart[SETSIZE];
26 PfxEntry * pFlag[SETSIZE];
27 SfxEntry * sFlag[SETSIZE];
28 HashMgr * pHMgr;
29 HashMgr ** alldic;
30 int * maxdic;
31 char * keystring;
32 char * trystring;
33 char * encoding;
34 struct cs_info * csconv;
35 int utf8;
36 int complexprefixes;
37 FLAG compoundflag;
38 FLAG compoundbegin;
39 FLAG compoundmiddle;
40 FLAG compoundend;
41 FLAG compoundroot;
42 FLAG compoundforbidflag;
43 FLAG compoundpermitflag;
44 int checkcompounddup;
45 int checkcompoundrep;
46 int checkcompoundcase;
47 int checkcompoundtriple;
48 int simplifiedtriple;
49 FLAG forbiddenword;
50 FLAG nosuggest;
51 FLAG nongramsuggest;
52 FLAG needaffix;
53 int cpdmin;
54 int numrep;
55 replentry * reptable;
56 RepList * iconvtable;
57 RepList * oconvtable;
58 int nummap;
59 mapentry * maptable;
60 int numbreak;
61 char ** breaktable;
62 int numcheckcpd;
63 patentry * checkcpdtable;
64 int simplifiedcpd;
65 int numdefcpd;
66 flagentry * defcpdtable;
67 phonetable * phone;
68 int maxngramsugs;
69 int maxcpdsugs;
70 int maxdiff;
71 int onlymaxdiff;
72 int nosplitsugs;
73 int sugswithdots;
74 int cpdwordmax;
75 int cpdmaxsyllable;
76 char * cpdvowels;
77 w_char * cpdvowels_utf16;
78 int cpdvowels_utf16_len;
79 char * cpdsyllablenum;
80 const char * pfxappnd; // BUG: not stateless
81 const char * sfxappnd; // BUG: not stateless
82 FLAG sfxflag; // BUG: not stateless
83 char * derived; // BUG: not stateless
84 SfxEntry * sfx; // BUG: not stateless
85 PfxEntry * pfx; // BUG: not stateless
86 int checknum;
87 char * wordchars;
88 unsigned short * wordchars_utf16;
89 int wordchars_utf16_len;
90 char * ignorechars;
91 unsigned short * ignorechars_utf16;
92 int ignorechars_utf16_len;
93 char * version;
94 char * lang;
95 int langnum;
96 FLAG lemma_present;
97 FLAG circumfix;
98 FLAG onlyincompound;
99 FLAG keepcase;
100 FLAG forceucase;
101 FLAG warn;
102 int forbidwarn;
103 FLAG substandard;
104 int checksharps;
105 int fullstrip;
107 int havecontclass; // boolean variable
108 char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
110 public:
112 AffixMgr(const char * affpath, HashMgr** ptr, int * md,
113 const char * key = NULL);
114 ~AffixMgr();
115 struct hentry * affix_check(const char * word, int len,
116 const unsigned short needflag = (unsigned short) 0,
117 char in_compound = IN_CPD_NOT);
118 struct hentry * prefix_check(const char * word, int len,
119 char in_compound, const FLAG needflag = FLAG_NULL);
120 inline int isSubset(const char * s1, const char * s2);
121 struct hentry * prefix_check_twosfx(const char * word, int len,
122 char in_compound, const FLAG needflag = FLAG_NULL);
123 inline int isRevSubset(const char * s1, const char * end_of_s2, int len);
124 struct hentry * suffix_check(const char * word, int len, int sfxopts,
125 PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
126 const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL,
127 char in_compound = IN_CPD_NOT);
128 struct hentry * suffix_check_twosfx(const char * word, int len,
129 int sfxopts, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
131 char * affix_check_morph(const char * word, int len,
132 const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
133 char * prefix_check_morph(const char * word, int len,
134 char in_compound, const FLAG needflag = FLAG_NULL);
135 char * suffix_check_morph (const char * word, int len, int sfxopts,
136 PfxEntry * ppfx, const FLAG cclass = FLAG_NULL,
137 const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
139 char * prefix_check_twosfx_morph(const char * word, int len,
140 char in_compound, const FLAG needflag = FLAG_NULL);
141 char * suffix_check_twosfx_morph(const char * word, int len,
142 int sfxopts, PfxEntry * ppfx, const FLAG needflag = FLAG_NULL);
144 char * morphgen(char * ts, int wl, const unsigned short * ap,
145 unsigned short al, char * morph, char * targetmorph, int level);
147 int expand_rootword(struct guessword * wlst, int maxn, const char * ts,
148 int wl, const unsigned short * ap, unsigned short al, char * bad,
149 int, char *);
151 short get_syllable (const char * word, int wlen);
152 int cpdrep_check(const char * word, int len);
153 int cpdpat_check(const char * word, int len, hentry * r1, hentry * r2,
154 const char affixed);
155 int defcpd_check(hentry *** words, short wnum, hentry * rv,
156 hentry ** rwords, char all);
157 int cpdcase_check(const char * word, int len);
158 inline int candidate_check(const char * word, int len);
159 void setcminmax(int * cmin, int * cmax, const char * word, int len);
160 struct hentry * compound_check(const char * word, int len, short wordnum,
161 short numsyllable, short maxwordnum, short wnum, hentry ** words,
162 char hu_mov_rule, char is_sug, int * info);
164 int compound_check_morph(const char * word, int len, short wordnum,
165 short numsyllable, short maxwordnum, short wnum, hentry ** words,
166 char hu_mov_rule, char ** result, char * partresult);
168 struct hentry * lookup(const char * word);
169 int get_numrep() const;
170 struct replentry * get_reptable() const;
171 RepList * get_iconvtable() const;
172 RepList * get_oconvtable() const;
173 struct phonetable * get_phonetable() const;
174 int get_nummap() const;
175 struct mapentry * get_maptable() const;
176 int get_numbreak() const;
177 char ** get_breaktable() const;
178 char * get_encoding();
179 int get_langnum() const;
180 char * get_key_string();
181 char * get_try_string() const;
182 const char * get_wordchars() const;
183 unsigned short * get_wordchars_utf16(int * len) const;
184 char * get_ignore() const;
185 unsigned short * get_ignore_utf16(int * len) const;
186 int get_compound() const;
187 FLAG get_compoundflag() const;
188 FLAG get_compoundbegin() const;
189 FLAG get_forbiddenword() const;
190 FLAG get_nosuggest() const;
191 FLAG get_nongramsuggest() const;
192 FLAG get_needaffix() const;
193 FLAG get_onlyincompound() const;
194 FLAG get_compoundroot() const;
195 FLAG get_lemma_present() const;
196 int get_checknum() const;
197 const char * get_prefix() const;
198 const char * get_suffix() const;
199 const char * get_derived() const;
200 const char * get_version() const;
201 int have_contclass() const;
202 int get_utf8() const;
203 int get_complexprefixes() const;
204 char * get_suffixed(char ) const;
205 int get_maxngramsugs() const;
206 int get_maxcpdsugs() const;
207 int get_maxdiff() const;
208 int get_onlymaxdiff() const;
209 int get_nosplitsugs() const;
210 int get_sugswithdots(void) const;
211 FLAG get_keepcase(void) const;
212 FLAG get_forceucase(void) const;
213 FLAG get_warn(void) const;
214 int get_forbidwarn(void) const;
215 int get_checksharps(void) const;
216 char * encode_flag(unsigned short aflag) const;
217 int get_fullstrip() const;
219 private:
220 int parse_file(const char * affpath, const char * key);
221 int parse_flag(char * line, unsigned short * out, FileMgr * af);
222 int parse_num(char * line, int * out, FileMgr * af);
223 int parse_cpdsyllable(char * line, FileMgr * af);
224 int parse_reptable(char * line, FileMgr * af);
225 int parse_convtable(char * line, FileMgr * af, RepList ** rl, const char * keyword);
226 int parse_phonetable(char * line, FileMgr * af);
227 int parse_maptable(char * line, FileMgr * af);
228 int parse_breaktable(char * line, FileMgr * af);
229 int parse_checkcpdtable(char * line, FileMgr * af);
230 int parse_defcpdtable(char * line, FileMgr * af);
231 int parse_affix(char * line, const char at, FileMgr * af, char * dupflags);
233 void reverse_condition(char *);
234 void debugflag(char * result, unsigned short flag);
235 int condlen(char *);
236 int encodeit(affentry &entry, char * cs);
237 int build_pfxtree(PfxEntry* pfxptr);
238 int build_sfxtree(SfxEntry* sfxptr);
239 int process_pfx_order();
240 int process_sfx_order();
241 PfxEntry * process_pfx_in_order(PfxEntry * ptr, PfxEntry * nptr);
242 SfxEntry * process_sfx_in_order(SfxEntry * ptr, SfxEntry * nptr);
243 int process_pfx_tree_to_list();
244 int process_sfx_tree_to_list();
245 int redundant_condition(char, char * strip, int stripl,
246 const char * cond, int);
249 #endif