Update changelog
[TortoiseGit.git] / ext / hunspell / affixmgr.hxx
blob5c5ec2e9994aeae654551d8aaa0b997bf24318ca
1 #ifndef _AFFIXMGR_HXX_
2 #define _AFFIXMGR_HXX_
4 #ifdef MOZILLA_CLIENT
5 #ifdef __SUNPRO_CC // for SunONE Studio compiler
6 using namespace std;
7 #endif
8 #include <stdio.h>
9 #else
10 #include <cstdio>
11 #endif
13 #include "atypes.hxx"
14 #include "baseaffix.hxx"
15 #include "hashmgr.hxx"
17 // check flag duplication
18 #define dupSFX (1 << 0)
19 #define dupPFX (1 << 1)
21 class AffixMgr
24 AffEntry * pStart[SETSIZE];
25 AffEntry * sStart[SETSIZE];
26 AffEntry * pFlag[CONTSIZE];
27 AffEntry * sFlag[CONTSIZE];
28 HashMgr * pHMgr;
29 char * trystring;
30 char * encoding;
31 struct cs_info * csconv;
32 int utf8;
33 int complexprefixes;
34 FLAG compoundflag;
35 FLAG compoundbegin;
36 FLAG compoundmiddle;
37 FLAG compoundend;
38 FLAG compoundroot;
39 FLAG compoundforbidflag;
40 FLAG compoundpermitflag;
41 int checkcompounddup;
42 int checkcompoundrep;
43 int checkcompoundcase;
44 int checkcompoundtriple;
45 FLAG forbiddenword;
46 FLAG nosuggest;
47 FLAG pseudoroot;
48 int cpdmin;
49 int numrep;
50 replentry * reptable;
51 int nummap;
52 mapentry * maptable;
53 int numbreak;
54 char ** breaktable;
55 int numcheckcpd;
56 replentry * checkcpdtable;
57 int numdefcpd;
58 flagentry * defcpdtable;
59 int maxngramsugs;
60 int nosplitsugs;
61 int sugswithdots;
62 int cpdwordmax;
63 int cpdmaxsyllable;
64 char * cpdvowels;
65 w_char * cpdvowels_utf16;
66 int cpdvowels_utf16_len;
67 char * cpdsyllablenum;
68 const char * pfxappnd; // BUG: not stateless
69 const char * sfxappnd; // BUG: not stateless
70 FLAG sfxflag; // BUG: not stateless
71 char * derived; // BUG: not stateless
72 AffEntry * sfx; // BUG: not stateless
73 AffEntry * pfx; // BUG: not stateless
74 int checknum;
75 char * wordchars;
76 unsigned short * wordchars_utf16;
77 int wordchars_utf16_len;
78 char * ignorechars;
79 unsigned short * ignorechars_utf16;
80 int ignorechars_utf16_len;
81 char * version;
82 char * lang;
83 int langnum;
84 FLAG lemma_present;
85 FLAG circumfix;
86 FLAG onlyincompound;
87 FLAG keepcase;
88 int checksharps;
90 int havecontclass; // boolean variable
91 char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
92 flag flag_mode;
94 public:
96 AffixMgr(const char * affpath, HashMgr * ptr);
97 ~AffixMgr();
98 struct hentry * affix_check(const char * word, int len,
99 const unsigned short needflag = (unsigned short) 0, char in_compound = IN_CPD_NOT);
100 struct hentry * prefix_check(const char * word, int len,
101 char in_compound, const FLAG needflag = FLAG_NULL);
102 inline int isSubset(const char * s1, const char * s2);
103 struct hentry * prefix_check_twosfx(const char * word, int len,
104 char in_compound, const FLAG needflag = FLAG_NULL);
105 inline int isRevSubset(const char * s1, const char * end_of_s2, int len);
106 struct hentry * suffix_check(const char * word, int len, int sfxopts, AffEntry* ppfx,
107 char ** wlst, int maxSug, int * ns, const FLAG cclass = FLAG_NULL,
108 const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
109 struct hentry * suffix_check_twosfx(const char * word, int len,
110 int sfxopts, AffEntry* ppfx, const FLAG needflag = FLAG_NULL);
112 char * affix_check_morph(const char * word, int len,
113 const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
114 char * prefix_check_morph(const char * word, int len,
115 char in_compound, const FLAG needflag = FLAG_NULL);
116 char * suffix_check_morph (const char * word, int len, int sfxopts, AffEntry * ppfx,
117 const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
119 char * prefix_check_twosfx_morph(const char * word, int len,
120 char in_compound, const FLAG needflag = FLAG_NULL);
121 char * suffix_check_twosfx_morph(const char * word, int len,
122 int sfxopts, AffEntry * ppfx, const FLAG needflag = FLAG_NULL);
124 int expand_rootword(struct guessword * wlst, int maxn, const char * ts,
125 int wl, const unsigned short * ap, unsigned short al, char * bad, int);
127 short get_syllable (const char * word, int wlen);
128 int cpdrep_check(const char * word, int len);
129 int cpdpat_check(const char * word, int len);
130 int defcpd_check(hentry *** words, short wnum, hentry * rv, hentry ** rwords, char all);
131 int cpdcase_check(const char * word, int len);
132 inline int candidate_check(const char * word, int len);
133 struct hentry * compound_check(const char * word, int len,
134 short wordnum, short numsyllable, short maxwordnum, short wnum, hentry ** words,
135 char hu_mov_rule, int * cmpdstemnum, int * cmpdstem, char is_sug);
137 int compound_check_morph(const char * word, int len,
138 short wordnum, short numsyllable, short maxwordnum, short wnum, hentry ** words,
139 char hu_mov_rule, char ** result, char * partresult);
141 struct hentry * lookup(const char * word);
142 int get_numrep();
143 struct replentry * get_reptable();
144 int get_nummap();
145 struct mapentry * get_maptable();
146 int get_numbreak();
147 char ** get_breaktable();
148 char * get_encoding();
149 int get_langnum();
150 char * get_try_string();
151 const char * get_wordchars();
152 unsigned short * get_wordchars_utf16(int * len);
153 char * get_ignore();
154 unsigned short * get_ignore_utf16(int * len);
155 int get_compound();
156 FLAG get_compoundflag();
157 FLAG get_compoundbegin();
158 FLAG get_forbiddenword();
159 FLAG get_nosuggest();
160 // FLAG get_circumfix();
161 FLAG get_pseudoroot();
162 FLAG get_onlyincompound();
163 FLAG get_compoundroot();
164 FLAG get_lemma_present();
165 int get_checknum();
166 char * get_possible_root();
167 const char * get_prefix();
168 const char * get_suffix();
169 const char * get_derived();
170 const char * get_version();
171 const int have_contclass();
172 int get_utf8();
173 int get_complexprefixes();
174 char * get_suffixed(char );
175 int get_maxngramsugs();
176 int get_nosplitsugs();
177 int get_sugswithdots(void);
178 FLAG get_keepcase(void);
179 int get_checksharps(void);
181 private:
182 int parse_file(const char * affpath);
183 // int parse_string(char * line, char ** out, const char * name);
184 int parse_flag(char * line, unsigned short * out, const char * name);
185 int parse_num(char * line, int * out, const char * name);
186 // int parse_array(char * line, char ** out, unsigned short ** out_utf16,
187 // int * out_utf16_len, const char * name);
188 int parse_cpdsyllable(char * line);
189 int parse_reptable(char * line, FILE * af);
190 int parse_maptable(char * line, FILE * af);
191 int parse_breaktable(char * line, FILE * af);
192 int parse_checkcpdtable(char * line, FILE * af);
193 int parse_defcpdtable(char * line, FILE * af);
194 int parse_affix(char * line, const char at, FILE * af, char * dupflags);
196 int encodeit(struct affentry * ptr, char * cs);
197 int build_pfxtree(AffEntry* pfxptr);
198 int build_sfxtree(AffEntry* sfxptr);
199 int process_pfx_order();
200 int process_sfx_order();
201 AffEntry * process_pfx_in_order(AffEntry * ptr, AffEntry * nptr);
202 AffEntry * process_sfx_in_order(AffEntry * ptr, AffEntry * nptr);
203 int process_pfx_tree_to_list();
204 int process_sfx_tree_to_list();
205 int redundant_condition(char, char * strip, int stripl, const char * cond, char *);
208 #endif