Skip to content
Snippets Groups Projects
Commit 963f2327 authored by mhm@chromium.org's avatar mhm@chromium.org
Browse files

Update Hunspell to the latest stable version to use the latest bdict format.

Updated Hunspell to version 1.2.8 which properly deals with UTF8 and fixes many bugs. This CL will use the BDict format and remove the usage of FileMgr. Removed the unwanted "key" parameter constructors from hunspell since we are managing them through bdict. Removed all line numbers from the errors  since we don't support that.

BUG= 14756 (http://crbug.com/14756)
TEST= Compiled Hunspell, Compiled Chromium, Ran Chromium, Fixed some of my spelling mistakes. Ran unit tests for SpellCheckTest.*
Review URL: http://codereview.chromium.org/155841

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22243 0039d316-1c4b-4281-b951-d872f2087c98
parent 877591d6
No related merge requests found
Showing
with 3613 additions and 2317 deletions
......@@ -607,11 +607,11 @@ TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) {
{L"wate", false, 0, 0, L"water"},
{L"wate", false, 0, 0, L"waste"},
{L"wate", false, 0, 0, L"sate"},
{L"wate", false, 0, 0, L"rate"},
{L"wate", false, 0, 0, L"ate"},
{L"jum", false, 0, 0, L"jump"},
{L"jum", false, 0, 0, L"rum"},
{L"jum", false, 0, 0, L"hum"},
{L"jum", false, 0, 0, L"sum"},
{L"jum", false, 0, 0, L"tum"},
{L"jum", false, 0, 0, L"um"},
#endif //!OS_MACOSX
// TODO (Sidchat): add many more examples.
};
......
......@@ -613,7 +613,7 @@ void SpellChecker::AddCustomWordsToHunspell() {
if (hunspell_.get()) {
for (std::vector<std::string>::iterator it = list_of_words.begin();
it != list_of_words.end(); ++it) {
hunspell_->put_word(it->c_str());
hunspell_->add(it->c_str());
}
}
}
......@@ -744,7 +744,7 @@ void SpellChecker::AddWord(const std::wstring& word) {
// Add the word to hunspell.
std::string word_to_add = WideToUTF8(word);
if (!word_to_add.empty())
hunspell_->put_word(word_to_add.c_str());
hunspell_->add(word_to_add.c_str());
// Now add the word to the custom dictionary file.
Task* write_word_task =
......
......@@ -6,24 +6,13 @@ This is a partial copy of Hunspell 1.1.5, with the following changes:
reference in src/hunspell/csutil.cxx changed accordingly
* Change the input params of the constructors to receive a FILE* instead of
a file path. This is required to use hunspell in the sandbox.
The patch is in google.patch.
* Remove all HUNSPELL_WARNING parameters since we are not using HashMgr
anymore, just show the msg not the line number.
* Remove the key variable from Hunspell, HashMgr and AffixMgr since Bdict
is being used instead.
The English dictionary distributed by Firefox has been checked in to the
dictionaries directory. It has several additions over the default
myspell/hunspell dictionary.
* Workaround for non-ASCII characters
Visual Studio on Japanese Windows assumes the source files to be
encoded in Shift_JIS. The compiler is unhappy with non-ASCII letters
in the source files of Hunspell. The same problem happens with other
CJK Windows as well. Here is the workaround for this problem:
Convert 8-bit bytes to hexadecimal escaped forms by
% perl -i -De 's/([\x80-\xff])/sprintf("\\x%02x", $1)/ge' src/*.cxx
Note that Hunspell upstream is going to fix this problem. We'll no
longer need the workaround if the problem is fixed in the upstream.
Index: src/hunspell/affixmgr.cxx
===================================================================
--- src/hunspell/affixmgr.cxx (revision 3811)
+++ src/hunspell/affixmgr.cxx (working copy)
@@ -25,7 +27,7 @@
#endif
#endif
-AffixMgr::AffixMgr(const char * affpath, HashMgr* ptr)
+AffixMgr::AffixMgr(FILE* aff_handle, HashMgr* ptr)
{
// register hash manager and load affix data from aff file
pHMgr = ptr;
@@ -104,8 +106,8 @@
contclasses[j] = 0;
}
- if (parse_file(affpath)) {
- HUNSPELL_WARNING(stderr, "Failure loading aff file %s\n",affpath);
+ if (parse_file(aff_handle)) {
+ HUNSPELL_WARNING(stderr, "Failure loading aff file\n");
wordchars = mystrdup("qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM");
}
@@ -232,7 +234,7 @@
// read in aff file and build up prefix and suffix entry objects
-int AffixMgr::parse_file(const char * affpath)
+int AffixMgr::parse_file(FILE* aff_handle)
{
// io buffers
@@ -250,11 +252,12 @@
// open the affix file
FILE * afflst;
- afflst = fopen(affpath,"r");
+ afflst = _fdopen(_dup(_fileno(aff_handle)), "r");
if (!afflst) {
- HUNSPELL_WARNING(stderr, "error: could not open affix description file %s\n",affpath);
+ HUNSPELL_WARNING(stderr, "error: could not open affix description file\n");
return 1;
}
+ fseek(afflst, 0, SEEK_SET);
// step one is to parse the affix file building up the internal
// affix data structures
Index: src/hunspell/affixmgr.hxx
===================================================================
--- src/hunspell/affixmgr.hxx (revision 3811)
+++ src/hunspell/affixmgr.hxx (working copy)
@@ -93,7 +93,7 @@
public:
- AffixMgr(const char * affpath, HashMgr * ptr);
+ AffixMgr(FILE* aff_handle, HashMgr * ptr);
~AffixMgr();
struct hentry * affix_check(const char * word, int len,
const unsigned short needflag = (unsigned short) 0, char in_compound = IN_CPD_NOT);
@@ -179,7 +179,7 @@
int get_checksharps(void);
private:
- int parse_file(const char * affpath);
+ int parse_file(FILE* aff_handle);
// int parse_string(char * line, char ** out, const char * name);
int parse_flag(char * line, unsigned short * out, const char * name);
int parse_num(char * line, int * out, const char * name);
Index: src/hunspell/hashmgr.cxx
===================================================================
--- src/hunspell/hashmgr.cxx (revision 3811)
+++ src/hunspell/hashmgr.cxx (working copy)
@@ -29,7 +31,7 @@
// build a hash table from a munched word list
-HashMgr::HashMgr(const char * tpath, const char * apath)
+HashMgr::HashMgr(FILE* dic_handle, FILE* aff_handle)
{
tablesize = 0;
tableptr = NULL;
@@ -43,8 +45,8 @@
aliasf = NULL;
numaliasm = 0;
aliasm = NULL;
- load_config(apath);
- int ec = load_tables(tpath);
+ load_config(aff_handle);
+ int ec = load_tables(dic_handle);
if (ec) {
/* error condition - what should we do here */
HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n",ec);
@@ -240,7 +242,7 @@
}
// load a munched word list and build a hash table on the fly
-int HashMgr::load_tables(const char * tpath)
+int HashMgr::load_tables(FILE* t_handle)
{
int wl, al;
char * ap;
@@ -248,8 +250,9 @@
unsigned short * flags;
// raw dictionary - munched file
- FILE * rawdict = fopen(tpath, "r");
+ FILE * rawdict = _fdopen(_dup(_fileno(t_handle)), "r");
if (rawdict == NULL) return 1;
+ fseek(rawdict, 0, SEEK_SET);
// first read the first line of file to get hash table size */
char ts[MAXDELEN];
@@ -442,7 +445,7 @@
}
// read in aff file and set flag mode
-int HashMgr::load_config(const char * affpath)
+int HashMgr::load_config(FILE* aff_handle)
{
int firstline = 1;
@@ -451,11 +454,12 @@
// open the affix file
FILE * afflst;
- afflst = fopen(affpath,"r");
+ afflst = _fdopen(_dup(_fileno(aff_handle)), "r");
if (!afflst) {
- HUNSPELL_WARNING(stderr, "Error - could not open affix description file %s\n",affpath);
+ HUNSPELL_WARNING(stderr, "Error - could not open affix description file\n");
return 1;
}
+ fseek(afflst, 0, SEEK_SET);
// read in each line ignoring any that do not
// start with a known line type indicator
Index: src/hunspell/hashmgr.hxx
===================================================================
--- src/hunspell/hashmgr.hxx (revision 3811)
+++ src/hunspell/hashmgr.hxx (working copy)
@@ -25,7 +25,7 @@
public:
- HashMgr(const char * tpath, const char * apath);
+ HashMgr(FILE* t_handle, FILE* a_handle);
~HashMgr();
struct hentry * lookup(const char *) const;
@@ -46,9 +46,9 @@
private:
- int load_tables(const char * tpath);
+ int load_tables(FILE* t_handle);
int add_word(const char * word, int wl, unsigned short * ap, int al, const char * desc);
- int load_config(const char * affpath);
+ int load_config(FILE* aff_handle);
int parse_aliasf(char * line, FILE * af);
#ifdef HUNSPELL_EXPERIMENTAL
int parse_aliasm(char * line, FILE * af);
Index: src/hunspell/hunspell.cxx
===================================================================
--- src/hunspell/hunspell.cxx (revision 3811)
+++ src/hunspell/hunspell.cxx (working copy)
@@ -20,7 +20,7 @@
#endif
#endif
-Hunspell::Hunspell(const char * affpath, const char * dpath)
+Hunspell::Hunspell(FILE* aff_handle, FILE* dic_handle)
{
encoding = NULL;
csconv = NULL;
@@ -28,11 +28,11 @@
complexprefixes = 0;
/* first set up the hash manager */
- pHMgr = new HashMgr(dpath, affpath);
+ pHMgr = new HashMgr(dic_handle, aff_handle);
/* next set up the affix manager */
/* it needs access to the hash manager lookup methods */
- pAMgr = new AffixMgr(affpath,pHMgr);
+ pAMgr = new AffixMgr(aff_handle, pHMgr);
/* get the preferred try string and the dictionary */
/* encoding from the Affix Manager for that dictionary */
@@ -1694,9 +1694,9 @@
#endif // END OF HUNSPELL_EXPERIMENTAL CODE
-Hunhandle *Hunspell_create(const char * affpath, const char * dpath)
+Hunhandle *Hunspell_create(FILE* aff_handle, FILE* dic_handle)
{
- return (Hunhandle*)(new Hunspell(affpath, dpath));
+ return (Hunhandle*)(new Hunspell(aff_handle, dic_handle));
}
void Hunspell_destroy(Hunhandle *pHunspell)
Index: src/hunspell/hunspell.hxx
===================================================================
--- src/hunspell/hunspell.hxx (revision 3811)
+++ src/hunspell/hunspell.hxx (working copy)
@@ -48,7 +48,7 @@
* input: path of affix file and dictionary file
*/
- Hunspell(const char * affpath, const char * dpath);
+ Hunspell(FILE* aff_handle, FILE* dic_handle);
......@@ -16,6 +16,7 @@
'../../../third_party/icu38/icu38.gyp:icuuc',
],
'defines': [
'HUNSPELL_STATIC',
'HUNSPELL_CHROME_CLIENT',
'OPENOFFICEORG',
],
......@@ -35,21 +36,31 @@
'src/hunspell/csutil.hxx',
'src/hunspell/dictmgr.cxx',
'src/hunspell/dictmgr.hxx',
'src/hunspell/filemgr.cxx',
'src/hunspell/filemgr.hxx',
'src/hunspell/hashmgr.cxx',
'src/hunspell/hashmgr.hxx',
'src/hunspell/htypes.hxx',
'src/hunspell/hunspell.cxx',
'src/hunspell/hunspell.h',
'src/hunspell/hunspell.hxx',
'src/hunspell/hunzip.cxx',
'src/hunspell/hunzip.hxx',
'src/hunspell/langnum.hxx',
'src/hunspell/phonet.cxx',
'src/hunspell/phonet.hxx',
'src/hunspell/replist.cxx',
'src/hunspell/replist.hxx',
'src/hunspell/suggestmgr.cxx',
'src/hunspell/suggestmgr.hxx',
'src/hunspell/utf_info.hxx',
'src/hunspell/w_char.hxx',
'src/parsers/textparser.cxx',
'src/parsers/textparser.hxx',
],
'direct_dependent_settings': {
'defines': [
'HUNSPELL_STATIC',
'HUNSPELL_CHROME_CLIENT',
'USE_HUNSPELL',
],
......
This diff is collapsed.
......@@ -54,6 +54,7 @@ public:
inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
inline char * nextchar(char * p);
inline int test_condition(const char * st);
};
......@@ -123,7 +124,9 @@ public:
inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
inline char * nextchar(char * p);
inline int test_condition(const char * st, const char * begin);
};
#endif
......
This diff is collapsed.
......@@ -13,6 +13,8 @@ using namespace std;
#include "atypes.hxx"
#include "baseaffix.hxx"
#include "hashmgr.hxx"
#include "phonet.hxx"
#include "replist.hxx"
// check flag duplication
#define dupSFX (1 << 0)
......@@ -66,12 +68,15 @@ class AffixMgr
AffEntry * sFlag[CONTSIZE];
#endif
HashMgr * pHMgr;
HashMgr ** alldic;
int * maxdic;
char * keystring;
char * trystring;
char * encoding;
struct cs_info * csconv;
int utf8;
int complexprefixes;
FLAG compoundflag;
FLAG compoundflag;
FLAG compoundbegin;
FLAG compoundmiddle;
FLAG compoundend;
......@@ -82,20 +87,25 @@ class AffixMgr
int checkcompoundrep;
int checkcompoundcase;
int checkcompoundtriple;
int simplifiedtriple;
FLAG forbiddenword;
FLAG nosuggest;
FLAG pseudoroot;
FLAG needaffix;
int cpdmin;
int numrep;
replentry * reptable;
RepList * iconvtable;
RepList * oconvtable;
int nummap;
mapentry * maptable;
int numbreak;
char ** breaktable;
int numcheckcpd;
replentry * checkcpdtable;
patentry * checkcpdtable;
int simplifiedcpd;
int numdefcpd;
flagentry * defcpdtable;
phonetable * phone;
int maxngramsugs;
int nosplitsugs;
int sugswithdots;
......@@ -125,7 +135,9 @@ class AffixMgr
FLAG circumfix;
FLAG onlyincompound;
FLAG keepcase;
FLAG substandard;
int checksharps;
int fullstrip;
int havecontclass; // boolean variable
#ifdef HUNSPELL_CHROME_CLIENT
......@@ -133,68 +145,81 @@ class AffixMgr
#else
char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
#endif
flag flag_mode;
public:
#ifdef HUNSPELL_CHROME_CLIENT
AffixMgr(hunspell::BDictReader* reader, HashMgr* ptr);
AffixMgr(hunspell::BDictReader* reader, HashMgr** ptr, int * md);
#else
AffixMgr(FILE* aff_handle, HashMgr * ptr);
AffixMgr(FILE* aff_handle, HashMgr** ptr, int * md, const char * key)
#endif
~AffixMgr();
struct hentry * affix_check(const char * word, int len,
const unsigned short needflag = (unsigned short) 0, char in_compound = IN_CPD_NOT);
const unsigned short needflag = (unsigned short) 0,
char in_compound = IN_CPD_NOT);
struct hentry * prefix_check(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);
inline int isSubset(const char * s1, const char * s2);
struct hentry * prefix_check_twosfx(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);
inline int isRevSubset(const char * s1, const char * end_of_s2, int len);
struct hentry * suffix_check(const char * word, int len, int sfxopts, AffEntry* ppfx,
char ** wlst, int maxSug, int * ns, const FLAG cclass = FLAG_NULL,
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
struct hentry * suffix_check(const char * word, int len, int sfxopts,
AffEntry* ppfx, char ** wlst, int maxSug, int * ns,
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL,
char in_compound = IN_CPD_NOT);
struct hentry * suffix_check_twosfx(const char * word, int len,
int sfxopts, AffEntry* ppfx, const FLAG needflag = FLAG_NULL);
char * affix_check_morph(const char * word, int len,
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
char * prefix_check_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);
char * suffix_check_morph (const char * word, int len, int sfxopts, AffEntry * ppfx,
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
char in_compound, const FLAG needflag = FLAG_NULL);
char * suffix_check_morph (const char * word, int len, int sfxopts,
AffEntry * ppfx, const FLAG cclass = FLAG_NULL,
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
char * prefix_check_twosfx_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);
char * suffix_check_twosfx_morph(const char * word, int len,
int sfxopts, AffEntry * ppfx, const FLAG needflag = FLAG_NULL);
int expand_rootword(struct guessword * wlst, int maxn, const char * ts,
int wl, const unsigned short * ap, unsigned short al, char * bad, int);
char * morphgen(char * ts, int wl, const unsigned short * ap,
unsigned short al, char * morph, char * targetmorph, int level);
short get_syllable (const char * word, int wlen);
int cpdrep_check(const char * word, int len);
int cpdpat_check(const char * word, int len);
int defcpd_check(hentry *** words, short wnum, hentry * rv, hentry ** rwords, char all);
int cpdcase_check(const char * word, int len);
inline int candidate_check(const char * word, int len);
struct hentry * compound_check(const char * word, int len,
short wordnum, short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, int * cmpdstemnum, int * cmpdstem, char is_sug);
int expand_rootword(struct guessword * wlst, int maxn, const char * ts,
int wl, const unsigned short * ap, unsigned short al, char * bad,
int, char *);
int compound_check_morph(const char * word, int len,
short wordnum, short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, char ** result, char * partresult);
short get_syllable (const char * word, int wlen);
int cpdrep_check(const char * word, int len);
int cpdpat_check(const char * word, int len, hentry * r1, hentry * r2);
int defcpd_check(hentry *** words, short wnum, hentry * rv,
hentry ** rwords, char all);
int cpdcase_check(const char * word, int len);
inline int candidate_check(const char * word, int len);
void setcminmax(int * cmin, int * cmax, const char * word, int len);
struct hentry * compound_check(const char * word, int len, short wordnum,
short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, char is_sug);
struct hentry * lookup(const char * word);
int compound_check_morph(const char * word, int len, short wordnum,
short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, char ** result, char * partresult);
struct hentry * lookup(const char * word);
int get_numrep();
struct replentry * get_reptable();
RepList * get_iconvtable();
RepList * get_oconvtable();
struct phonetable * get_phonetable();
int get_nummap();
struct mapentry * get_maptable();
int get_numbreak();
char ** get_breaktable();
char * get_encoding();
int get_langnum();
char * get_key_string();
char * get_try_string();
const char * get_wordchars();
unsigned short * get_wordchars_utf16(int * len);
......@@ -205,8 +230,7 @@ public:
FLAG get_compoundbegin();
FLAG get_forbiddenword();
FLAG get_nosuggest();
// FLAG get_circumfix();
FLAG get_pseudoroot();
FLAG get_needaffix();
FLAG get_onlyincompound();
FLAG get_compoundroot();
FLAG get_lemma_present();
......@@ -225,6 +249,8 @@ public:
int get_sugswithdots(void);
FLAG get_keepcase(void);
int get_checksharps(void);
char * encode_flag(unsigned short aflag);
int get_fullstrip();
private:
#ifdef HUNSPELL_CHROME_CLIENT
......@@ -232,31 +258,37 @@ private:
hunspell::BDictReader* bdict_reader;
int parse_file();
#else
int parse_file(FILE* aff_handle);
#endif
// int parse_string(char * line, char ** out, const char * name);
int parse_flag(char * line, unsigned short * out, const char * name);
int parse_num(char * line, int * out, const char * name);
// int parse_array(char * line, char ** out, unsigned short ** out_utf16,
// int * out_utf16_len, const char * name);
int parse_cpdsyllable(char * linfe);
#ifdef HUNSPELL_CHROME_CLIENT
// We just change the FILE* to be an iterator.
int parse_flag(char * line, unsigned short * out);
int parse_num(char * line, int * out);
int parse_cpdsyllable(char * line);
int parse_reptable(char * line, hunspell::LineIterator* iterator);
int parse_convtable(char * line, hunspell::LineIterator* iterator, RepList ** rl, const char * keyword);
int parse_phonetable(char * line, hunspell::LineIterator* iterator);
int parse_maptable(char * line, hunspell::LineIterator* iterator);
int parse_checkcpdtable(char * line, hunspell::LineIterator* iterator);
int parse_breaktable(char * line, hunspell::LineIterator* iterator);
int parse_checkcpdtable(char * line, hunspell::LineIterator* iterator);
int parse_defcpdtable(char * line, hunspell::LineIterator* iterator);
int parse_affix(char * line, const char at, hunspell::LineIterator* iterator);
#else
int parse_reptable(char * line, FILE * af);
int parse_maptable(char * line, FILE * af);
int parse_breaktable(char * line, FILE * af);
int parse_checkcpdtable(char * line, FILE * af);
int parse_defcpdtable(char * line, FILE * af);
int parse_affix(char * line, const char at, FILE * af, char * dupflags);
int parse_file(FILE* aff_handle, const char * key);
int parse_flag(char * line, unsigned short * out, FileMgr * af);
int parse_num(char * line, int * out, FileMgr * af);
int parse_cpdsyllable(char * line, FileMgr * af);
int parse_reptable(char * line, FileMgr * af);
int parse_convtable(char * line, FileMgr * af, RepList ** rl, const char * keyword);
int parse_phonetable(char * line, FileMgr * af);
int parse_maptable(char * line, FileMgr * af);
int parse_breaktable(char * line, FileMgr * af);
int parse_checkcpdtable(char * line, FileMgr * af);
int parse_defcpdtable(char * line, FileMgr * af);
int parse_affix(char * line, const char at, FileMgr * af, char * dupflags);
#endif
void reverse_condition(char *);
void debugflag(char * result, unsigned short flag);
int condlen(char *);
int encodeit(struct affentry * ptr, char * cs);
int build_pfxtree(AffEntry* pfxptr);
int build_sfxtree(AffEntry* sfxptr);
......@@ -266,7 +298,8 @@ private:
AffEntry * process_sfx_in_order(AffEntry * ptr, AffEntry * nptr);
int process_pfx_tree_to_list();
int process_sfx_tree_to_list();
int redundant_condition(char, char * strip, int stripl, const char * cond, char *);
int redundant_condition(char, char * strip, int stripl,
const char * cond, int);
};
#endif
......
......@@ -5,27 +5,28 @@
#ifdef HUNSPELL_WARNING_ON
#define HUNSPELL_WARNING fprintf
#else
#define HUNSPELL_WARNING
// empty inline function to switch off warnings (instead of the C99 standard variadic macros)
static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
#endif
#endif
// HUNSTEM def.
#define HUNSTEM
#include "csutil.hxx"
#include "hashmgr.hxx"
#include "w_char.hxx"
#define SETSIZE 256
#define CONTSIZE 65536
#define MAXWORDLEN 100
#define MAXWORDUTF8LEN (MAXWORDLEN * 4)
#define MAXWORDUTF8LEN 256
// affentry options
#define aeXPRODUCT (1 << 0)
#define aeUTF8 (1 << 1)
#define aeALIASF (1 << 2)
#define aeALIASM (1 << 3)
#define aeINFIX (1 << 4)
#define aeLONGCOND (1 << 4)
// compound options
#define IN_CPD_NOT 0
......@@ -33,10 +34,12 @@
#define IN_CPD_END 2
#define IN_CPD_OTHER 3
#define MAXLNLEN 8192 * 4
#define MAXLNLEN 8192
#define MINCPDLEN 3
#define MAXCOMPOUND 10
#define MAXCONDLEN 20
#define MAXCONDLEN_1 (MAXCONDLEN - sizeof(char *))
#define MAXACC 1000
......@@ -55,26 +58,22 @@ struct affentry
char numconds;
char opts;
unsigned short aflag;
union {
char base[SETSIZE];
struct {
char ascii[SETSIZE/2];
char neg[8];
char all[8];
w_char * wchars[8];
int wlen[8];
} utf8;
} conds;
#ifdef HUNSPELL_EXPERIMENTAL
char * morphcode;
#endif
unsigned short * contclass;
short contclasslen;
union {
char conds[MAXCONDLEN];
struct {
char conds1[MAXCONDLEN_1];
char * conds2;
} l;
} c;
char * morphcode;
};
struct replentry {
char * pattern;
char * pattern2;
struct guessword {
char * word;
bool allow;
char * orig;
};
struct mapentry {
......@@ -88,14 +87,12 @@ struct flagentry {
int len;
};
struct guessword {
char * word;
bool allow;
struct patentry {
char * pattern;
char * pattern2;
char * pattern3;
FLAG cond;
FLAG cond2;
};
#endif
......@@ -6,26 +6,23 @@ class AffEntry
public:
protected:
char * appnd;
char * strip;
unsigned char appndl;
unsigned char stripl;
char numconds;
char opts;
unsigned short aflag;
union {
char base[SETSIZE];
struct {
char ascii[SETSIZE/2];
char neg[8];
char all[8];
w_char * wchars[8];
int wlen[8];
} utf8;
} conds;
char * morphcode;
unsigned short * contclass;
short contclasslen;
char * appnd;
char * strip;
unsigned char appndl;
unsigned char stripl;
char numconds;
char opts;
unsigned short aflag;
union {
char conds[MAXCONDLEN];
struct {
char conds1[MAXCONDLEN_1];
char * conds2;
} l;
} c;
char * morphcode;
unsigned short * contclass;
short contclasslen;
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* file manager class - read lines of files [filename] OR [filename.hz] */
#ifndef _FILEMGR_HXX_
#define _FILEMGR_HXX_
#include "hunzip.hxx"
class FileMgr
{
protected:
FILE * fin;
Hunzip * hin;
char in[BUFSIZE + 50]; // input buffer
int fail(const char * err, const char * par);
int linenum;
public:
FileMgr(const char * filename, const char * key = NULL);
~FileMgr();
char * getline();
int getlinenum();
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment