Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/extensions/spellcheck/hunspell/src/./../../../../../extensions/spellcheck/hunspell/src/affixmgr.hxx
Warning:line 112, column 7
Excessive padding in 'class AffixMgr' (42 padding bytes, where 2 is optimal). Optimal fields order: alldic, pHMgr, csconv, iconvtable, oconvtable, phone, pfxappnd, sfxappnd, derived, sfx, pfx, maptable, breaktable, checkcpdtable, defcpdtable, cpdvowels_utf16, wordchars_utf16, ignorechars_utf16, keystring, trystring, encoding, cpdvowels, cpdsyllablenum, wordchars, ignorechars, version, lang, pStart, sStart, pFlag, sFlag, utf8, complexprefixes, compoundmoresuffixes, checkcompounddup, checkcompoundrep, checkcompoundcase, checkcompoundtriple, simplifiedtriple, cpdmin, simplifiedcpd, maxngramsugs, maxcpdsugs, maxdiff, onlymaxdiff, nosplitsugs, sugswithdots, cpdwordmax, cpdmaxsyllable, sfxextra, checknum, langnum, forbidwarn, checksharps, fullstrip, havecontclass, compoundflag, compoundbegin, compoundmiddle, compoundend, compoundroot, compoundforbidflag, compoundpermitflag, forbiddenword, nosuggest, nongramsuggest, needaffix, sfxflag, lemma_present, circumfix, onlyincompound, keepcase, forceucase, warn, substandard, parsedmaptable, parsedbreaktable, parsedcheckcpd, parseddefcpd, contclasses, consider reordering the fields or adding explicit padding members

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_hunspell_src0.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/extensions/spellcheck/hunspell/src -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/extensions/spellcheck/hunspell/src -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -include hunspell_alloc_hooks.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D HUNSPELL_STATIC -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/extensions/spellcheck/hunspell/src -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/extensions/spellcheck/hunspell/src -I /root/firefox-clang/extensions/spellcheck/hunspell/glue -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -Wno-implicit-fallthrough -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-10-17-231001-351276-1 -x c++ Unified_cpp_hunspell_src0.cpp
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * Copyright (C) 2002-2022 Németh László
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Hunspell is based on MySpell which is Copyright (C) 2002 Kevin Hendricks.
17 *
18 * Contributor(s): David Einstein, Davide Prina, Giuseppe Modugno,
19 * Gianluca Turconi, Simon Brouwer, Noll János, Bíró Árpád,
20 * Goldman Eleonóra, Sarlós Tamás, Bencsáth Boldizsár, Halácsy Péter,
21 * Dvornik László, Gefferth András, Nagy Viktor, Varga Dániel, Chris Halls,
22 * Rene Engelhard, Bram Moolenaar, Dafydd Jones, Harri Pitkänen
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37/*
38 * Copyright 2002 Kevin B. Hendricks, Stratford, Ontario, Canada
39 * And Contributors. All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 *
45 * 1. Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
47 *
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 *
52 * 3. All modifications to the source code must be clearly marked as
53 * such. Binary redistributions based on modified source code
54 * must be clearly marked as modified versions in the documentation
55 * and/or other materials provided with the distribution.
56 *
57 * THIS SOFTWARE IS PROVIDED BY KEVIN B. HENDRICKS AND CONTRIBUTORS
58 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
59 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
60 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
61 * KEVIN B. HENDRICKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
62 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
63 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE.
69 */
70
71#ifndef AFFIXMGR_HXX_
72#define AFFIXMGR_HXX_
73
74#include <chrono>
75#include <cstdio>
76
77#include <memory>
78#include <string>
79#include <vector>
80
81#include "atypes.hxx"
82#include "baseaffix.hxx"
83#include "hashmgr.hxx"
84#include "phonet.hxx"
85#include "replist.hxx"
86
87// check flag duplication
88#define dupSFX(1 << 0) (1 << 0)
89#define dupPFX(1 << 1) (1 << 1)
90
91class PfxEntry;
92class SfxEntry;
93class TraceCtx;
94
95// Reusable scratch tmpwords for the affix-matching path, passed though
96// through compound_check[_morph] -> prefix_check[_*] / suffix_check[_*]
97// -> Pfx/SfxEntry::checkword[_*]. Each slot is owned by the entry
98// method named in its comment.
99// Passing them around for reuse is both faster than recreating repeatedly
100// and avoids asan running out of quarantine memory
101struct AffixScratch {
102 std::string pfx_check_word; // PfxEntry::checkword / check_morph
103 std::string pfx_check_twosfx; // PfxEntry::check_twosfx[_morph]
104 std::string sfx_check_word; // SfxEntry::checkword
105 std::string sfx_check_twosfx; // SfxEntry::check_twosfx[_morph]
106
107 // where the affix path reports its decisions, or null while nothing is
108 // listening
109 TraceCtx* trace = nullptr;
110};
111
112class AffixMgr {
Excessive padding in 'class AffixMgr' (42 padding bytes, where 2 is optimal). Optimal fields order: alldic, pHMgr, csconv, iconvtable, oconvtable, phone, pfxappnd, sfxappnd, derived, sfx, pfx, maptable, breaktable, checkcpdtable, defcpdtable, cpdvowels_utf16, wordchars_utf16, ignorechars_utf16, keystring, trystring, encoding, cpdvowels, cpdsyllablenum, wordchars, ignorechars, version, lang, pStart, sStart, pFlag, sFlag, utf8, complexprefixes, compoundmoresuffixes, checkcompounddup, checkcompoundrep, checkcompoundcase, checkcompoundtriple, simplifiedtriple, cpdmin, simplifiedcpd, maxngramsugs, maxcpdsugs, maxdiff, onlymaxdiff, nosplitsugs, sugswithdots, cpdwordmax, cpdmaxsyllable, sfxextra, checknum, langnum, forbidwarn, checksharps, fullstrip, havecontclass, compoundflag, compoundbegin, compoundmiddle, compoundend, compoundroot, compoundforbidflag, compoundpermitflag, forbiddenword, nosuggest, nongramsuggest, needaffix, sfxflag, lemma_present, circumfix, onlyincompound, keepcase, forceucase, warn, substandard, parsedmaptable, parsedbreaktable, parsedcheckcpd, parseddefcpd, contclasses, consider reordering the fields or adding explicit padding members
113 PfxEntry* pStart[SETSIZE256];
114 SfxEntry* sStart[SETSIZE256];
115 PfxEntry* pFlag[SETSIZE256];
116 SfxEntry* sFlag[SETSIZE256];
117 const std::vector<std::unique_ptr<HashMgr>>& alldic;
118 const HashMgr* pHMgr;
119 std::string keystring;
120 std::string trystring;
121 std::string encoding;
122 const struct cs_info* csconv;
123 int utf8;
124 int complexprefixes;
125 FLAGunsigned short compoundflag;
126 FLAGunsigned short compoundbegin;
127 FLAGunsigned short compoundmiddle;
128 FLAGunsigned short compoundend;
129 FLAGunsigned short compoundroot;
130 FLAGunsigned short compoundforbidflag;
131 FLAGunsigned short compoundpermitflag;
132 int compoundmoresuffixes;
133 int checkcompounddup;
134 int checkcompoundrep;
135 int checkcompoundcase;
136 int checkcompoundtriple;
137 int simplifiedtriple;
138 FLAGunsigned short forbiddenword;
139 FLAGunsigned short nosuggest;
140 FLAGunsigned short nongramsuggest;
141 FLAGunsigned short needaffix;
142 int cpdmin;
143 RepList* iconvtable;
144 RepList* oconvtable;
145 bool parsedmaptable;
146 std::vector<mapentry> maptable;
147 bool parsedbreaktable;
148 std::vector<std::string> breaktable;
149 bool parsedcheckcpd;
150 std::vector<patentry> checkcpdtable;
151 int simplifiedcpd;
152 bool parseddefcpd;
153 std::vector<flagentry> defcpdtable;
154 phonetable* phone;
155 int maxngramsugs;
156 int maxcpdsugs;
157 int maxdiff;
158 int onlymaxdiff;
159 int nosplitsugs;
160 int sugswithdots;
161 int cpdwordmax;
162 int cpdmaxsyllable;
163 std::string cpdvowels; // vowels (for calculating of Hungarian compounding limit,
164 std::vector<w_char> cpdvowels_utf16; //vowels for UTF-8 encoding
165 std::string cpdsyllablenum; // syllable count incrementing flag
166 const char* pfxappnd; // BUG: not stateless
167 const char* sfxappnd; // BUG: not stateless
168 int sfxextra; // BUG: not stateless
169 FLAGunsigned short sfxflag; // BUG: not stateless
170 char* derived; // BUG: not stateless
171 SfxEntry* sfx; // BUG: not stateless
172 PfxEntry* pfx; // BUG: not stateless
173 int checknum;
174 std::string wordchars; // letters + spec. word characters
175 std::vector<w_char> wordchars_utf16;
176 std::string ignorechars; // letters + spec. word characters
177 std::vector<w_char> ignorechars_utf16;
178 std::string version; // affix and dictionary file version string
179 std::string lang; // language
180 int langnum;
181 FLAGunsigned short lemma_present;
182 FLAGunsigned short circumfix;
183 FLAGunsigned short onlyincompound;
184 FLAGunsigned short keepcase;
185 FLAGunsigned short forceucase;
186 FLAGunsigned short warn;
187 int forbidwarn;
188 FLAGunsigned short substandard;
189 int checksharps;
190 int fullstrip;
191
192 int havecontclass; // boolean variable
193 char contclasses[CONTSIZE65536]; // flags of possible continuing classes (twofold
194 // affix)
195
196 public:
197 // Turns a condition around, so that a group keeps its meaning once the text
198 // it belongs to has been reversed.
199 static void reverse_condition(std::string&);
200
201 AffixMgr(const char* affpath, const std::vector<std::unique_ptr<HashMgr>>& ptr, const char* key = nullptr);
202 ~AffixMgr();
203 struct hentry* affix_check(const std::string& word,
204 int start,
205 int len,
206 AffixScratch& scratch,
207 const unsigned short needflag = (unsigned short)0,
208 char in_compound = IN_CPD_NOT0,
209 const FLAGunsigned short avoidflag = FLAG_NULL0x00,
210 PfxEntry** found_pfx = nullptr,
211 SfxEntry** found_sfx = nullptr);
212 struct hentry* prefix_check(const std::string& word,
213 int start,
214 int len,
215 char in_compound,
216 AffixScratch& scratch,
217 const FLAGunsigned short needflag = FLAG_NULL0x00,
218 const FLAGunsigned short avoidflag = FLAG_NULL0x00);
219 inline int isSubset(const char* s1, const char* s2);
220 struct hentry* prefix_check_twosfx(const std::string& word,
221 int start,
222 int len,
223 char in_compound,
224 AffixScratch& scratch,
225 const FLAGunsigned short needflag = FLAG_NULL0x00);
226 inline int isRevSubset(const char* s1, const char* end_of_s2, int len);
227 struct hentry* suffix_check(const std::string& word,
228 int start,
229 int len,
230 int sfxopts,
231 PfxEntry* ppfx,
232 AffixScratch& scratch,
233 const FLAGunsigned short cclass = FLAG_NULL0x00,
234 const FLAGunsigned short needflag = FLAG_NULL0x00,
235 char in_compound = IN_CPD_NOT0,
236 const FLAGunsigned short avoidflag = FLAG_NULL0x00);
237 struct hentry* suffix_check_twosfx(const std::string& word,
238 int start,
239 int len,
240 int sfxopts,
241 PfxEntry* ppfx,
242 AffixScratch& scratch,
243 const FLAGunsigned short needflag = FLAG_NULL0x00);
244
245 std::string affix_check_morph(const std::string& word,
246 int start,
247 int len,
248 AffixScratch& scratch,
249 const FLAGunsigned short needflag = FLAG_NULL0x00,
250 char in_compound = IN_CPD_NOT0);
251 std::string prefix_check_morph(const std::string& word,
252 int start,
253 int len,
254 char in_compound,
255 AffixScratch& scratch,
256 const FLAGunsigned short needflag = FLAG_NULL0x00);
257 std::string suffix_check_morph(const std::string& word,
258 int start,
259 int len,
260 int sfxopts,
261 PfxEntry* ppfx,
262 AffixScratch& scratch,
263 const FLAGunsigned short cclass = FLAG_NULL0x00,
264 const FLAGunsigned short needflag = FLAG_NULL0x00,
265 char in_compound = IN_CPD_NOT0);
266
267 std::string prefix_check_twosfx_morph(const std::string& word,
268 int start,
269 int len,
270 char in_compound,
271 AffixScratch& scratch,
272 const FLAGunsigned short needflag = FLAG_NULL0x00);
273 std::string suffix_check_twosfx_morph(const std::string& word,
274 int start,
275 int len,
276 int sfxopts,
277 PfxEntry* ppfx,
278 AffixScratch& scratch,
279 const FLAGunsigned short needflag = FLAG_NULL0x00);
280
281 std::string morphgen(const char* ts,
282 int wl,
283 const unsigned short* ap,
284 unsigned short al,
285 const char* morph,
286 const char* targetmorph,
287 int level,
288 const FLAGunsigned short avoidflag = FLAG_NULL0x00);
289
290 int expand_rootword(struct guessword* wlst,
291 int maxn,
292 const char* ts,
293 int wl,
294 const unsigned short* ap,
295 unsigned short al,
296 const char* bad,
297 int,
298 const char*);
299
300 short get_syllable(const std::string& word);
301 int cpdrep_check(const std::string& word,
302 int len,
303 AffixScratch& scratch,
304 bool& timelimit_exceeded,
305 std::chrono::steady_clock::time_point clock_time_start);
306 int cpdwordpair_check(const std::string& word,
307 int len,
308 AffixScratch& scratch,
309 bool& timelimit_exceeded,
310 std::chrono::steady_clock::time_point clock_time_start);
311 int cpdpat_check(const std::string& word,
312 size_t len,
313 hentry* r1,
314 hentry* r2,
315 const char affixed,
316 const TraceCtx* t,
317 PfxEntry* p1,
318 SfxEntry* s1,
319 PfxEntry* p2,
320 SfxEntry* s2);
321 int defcpd_check(hentry*** words,
322 short wnum,
323 short maxwordnum,
324 hentry* rv,
325 hentry** rwords,
326 char all);
327 int cpdcase_check(const std::string& word, int len);
328 inline int candidate_check(const std::string& word, AffixScratch& scratch);
329 void setcminmax(size_t* cmin, size_t* cmax, const char* word, size_t len);
330 struct hentry* compound_check(const std::string& word,
331 short wordnum,
332 short numsyllable,
333 short maxwordnum,
334 short wnum,
335 hentry** words,
336 hentry** rwords,
337 char hu_mov_rule,
338 char is_sug,
339 int* info,
340 AffixScratch& scratch);
341
342 int compound_check_morph(const std::string& word,
343 short wordnum,
344 short numsyllable,
345 short maxwordnum,
346 short wnum,
347 hentry** words,
348 hentry** rwords,
349 char hu_mov_rule,
350 std::string& result,
351 const std::string* partresult,
352 AffixScratch& scratch);
353
354 std::vector<std::string> get_suffix_words(short unsigned* suff,
355 int len,
356 const std::string& root_word);
357
358 struct hentry* lookup(const char* word, size_t len);
359 const std::vector<replentry>& get_reptable() const;
360 RepList* get_iconvtable() const;
361 RepList* get_oconvtable() const;
362 struct phonetable* get_phonetable() const;
363 const std::vector<mapentry>& get_maptable() const;
364 const std::vector<std::string>& get_breaktable() const;
365 const std::string& get_encoding();
366 int get_langnum() const;
367 const std::string& get_key_string();
368 const std::string& get_try_string() const;
369 const std::string& get_wordchars() const;
370 const std::vector<w_char>& get_wordchars_utf16() const;
371 const char* get_ignore() const;
372 const std::vector<w_char>& get_ignore_utf16() const;
373 int get_compound() const;
374 FLAGunsigned short get_compoundflag() const;
375 FLAGunsigned short get_forbiddenword() const;
376 FLAGunsigned short get_nosuggest() const;
377 FLAGunsigned short get_nongramsuggest() const;
378 FLAGunsigned short get_substandard() const;
379 FLAGunsigned short get_needaffix() const;
380 FLAGunsigned short get_circumfix() const;
381 FLAGunsigned short get_onlyincompound() const;
382 const char* get_derived() const;
383 const std::string& get_version() const;
384 int have_contclass() const;
385 int get_utf8() const;
386 int get_complexprefixes() const;
387 char* get_suffixed(char) const;
388 int get_maxngramsugs() const;
389 int get_maxcpdsugs() const;
390 int get_maxdiff() const;
391 int get_onlymaxdiff() const;
392 int get_nosplitsugs() const;
393 int get_sugswithdots() const;
394 FLAGunsigned short get_keepcase() const;
395 FLAGunsigned short get_forceucase() const;
396 FLAGunsigned short get_warn() const;
397 int get_forbidwarn() const;
398 int get_checksharps() const;
399 std::string encode_flag(unsigned short aflag) const;
400 int get_fullstrip() const;
401
402 private:
403 int parse_file(const char* affpath, const char* key);
404 bool parse_flag(const std::string& line, unsigned short* out, FileMgr* af);
405 bool parse_num(const std::string& line, int* out, FileMgr* af);
406 bool parse_cpdsyllable(const std::string& line, FileMgr* af);
407 bool parse_convtable(const std::string& line,
408 FileMgr* af,
409 RepList** rl,
410 const std::string& keyword);
411 bool parse_phonetable(const std::string& line, FileMgr* af);
412 bool parse_maptable(const std::string& line, FileMgr* af);
413 bool parse_breaktable(const std::string& line, FileMgr* af);
414 bool parse_checkcpdtable(const std::string& line, FileMgr* af);
415 bool parse_defcpdtable(const std::string& line, FileMgr* af);
416 bool parse_affix(const std::string& line, const char at, FileMgr* af, char* dupflags);
417
418 bool circumfix_ok(PfxEntry* pfx, SfxEntry* sfx, const TraceCtx* t) const;
419 void trace_avoidflag(TraceCtx* t, const FLAGunsigned short avoidflag, const struct hentry* stem) const;
420 bool suffix_applicable(PfxEntry* pfx,
421 SfxEntry* sfx,
422 const FLAGunsigned short cclass,
423 char in_compound,
424 const TraceCtx* t) const;
425
426 std::string& debugflag(std::string& result, unsigned short flag);
427 int condlen(const std::string& s);
428 int encodeit(AffEntry& entry, const std::string& cs);
429 int build_pfxtree(PfxEntry* pfxptr);
430 int build_sfxtree(SfxEntry* sfxptr);
431 int process_pfx_order();
432 int process_sfx_order();
433 PfxEntry* process_pfx_in_order(PfxEntry* ptr, PfxEntry* nptr);
434 SfxEntry* process_sfx_in_order(SfxEntry* ptr, SfxEntry* nptr);
435 int process_pfx_tree_to_list();
436 int process_sfx_tree_to_list();
437 int redundant_condition(char, const std::string& strip, const std::string& cond, int);
438 void finishFileMgr(FileMgr* afflst);
439};
440
441#endif