Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: google.patch

Issue 12328121: Use up to 8 affixes in Hunspell spellcheck suggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: google.patch
diff --git a/google.patch b/google.patch
index 55b726bc51556a27c8c7f41440e3d16825d7ae82..1005084de6605a2bfdc33ac8e913a7d574b841c6 100644
--- a/google.patch
+++ b/google.patch
@@ -2,9 +2,9 @@ Index: src/hunspell/affixmgr.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.cxx,v
retrieving revision 1.41
-diff -u -r1.41 affixmgr.cxx
+diff -u -p -r1.41 affixmgr.cxx
--- src/hunspell/affixmgr.cxx 16 Dec 2011 09:15:34 -0000 1.41
-+++ src/hunspell/affixmgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/affixmgr.cxx 26 Feb 2013 23:13:13 -0000
@@ -14,8 +14,14 @@
#include "csutil.hxx"
@@ -20,7 +20,7 @@ diff -u -r1.41 affixmgr.cxx
// register hash manager and load affix data from aff file
pHMgr = ptr[0];
alldic = ptr;
-@@ -107,9 +113,17 @@
+@@ -107,9 +113,17 @@ AffixMgr::AffixMgr(const char * affpath,
sFlag[i] = NULL;
}
@@ -38,7 +38,7 @@ diff -u -r1.41 affixmgr.cxx
if (parse_file(affpath, key)) {
HUNSPELL_WARNING(stderr, "Failure loading aff file %s\n",affpath);
-@@ -269,6 +283,43 @@
+@@ -269,6 +283,43 @@ int AffixMgr::parse_file(const char * a
char * line; // io buffers
char ft; // affix type
@@ -82,7 +82,7 @@ diff -u -r1.41 affixmgr.cxx
// checking flag duplication
char dupflags[CONTSIZE];
char dupflags_ini = 1;
-@@ -282,6 +333,7 @@
+@@ -282,6 +333,7 @@ int AffixMgr::parse_file(const char * a
HUNSPELL_WARNING(stderr, "error: could not open affix description file %s\n",affpath);
return 1;
}
@@ -90,7 +90,7 @@ diff -u -r1.41 affixmgr.cxx
// step one is to parse the affix file building up the internal
// affix data structures
-@@ -291,6 +343,7 @@
+@@ -291,6 +343,7 @@ int AffixMgr::parse_file(const char * a
while ((line = afflst->getline()) != NULL) {
mychomp(line);
@@ -98,7 +98,7 @@ diff -u -r1.41 affixmgr.cxx
/* remove byte order mark */
if (firstline) {
firstline = 0;
-@@ -299,6 +352,7 @@
+@@ -299,6 +352,7 @@ int AffixMgr::parse_file(const char * a
memmove(line, line+3, strlen(line+3)+1);
}
}
@@ -106,7 +106,7 @@ diff -u -r1.41 affixmgr.cxx
/* parse in the keyboard string */
if (strncmp(line,"KEY",3) == 0) {
-@@ -545,6 +599,7 @@
+@@ -545,6 +599,7 @@ int AffixMgr::parse_file(const char * a
}
}
@@ -114,7 +114,7 @@ diff -u -r1.41 affixmgr.cxx
/* parse in the typical fault correcting table */
if (strncmp(line,"REP",3) == 0) {
if (parse_reptable(line, afflst)) {
-@@ -552,6 +607,7 @@
+@@ -552,6 +607,7 @@ int AffixMgr::parse_file(const char * a
return 1;
}
}
@@ -122,7 +122,7 @@ diff -u -r1.41 affixmgr.cxx
/* parse in the input conversion table */
if (strncmp(line,"ICONV",5) == 0) {
-@@ -699,6 +755,7 @@
+@@ -699,6 +755,7 @@ int AffixMgr::parse_file(const char * a
checksharps=1;
}
@@ -130,7 +130,7 @@ diff -u -r1.41 affixmgr.cxx
/* parse this affix: P - prefix, S - suffix */
ft = ' ';
if (strncmp(line,"PFX",3) == 0) ft = complexprefixes ? 'S' : 'P';
-@@ -713,6 +770,7 @@
+@@ -713,6 +770,7 @@ int AffixMgr::parse_file(const char * a
return 1;
}
}
@@ -138,7 +138,7 @@ diff -u -r1.41 affixmgr.cxx
}
finishFileMgr(afflst);
-@@ -1307,6 +1365,26 @@
+@@ -1307,6 +1365,26 @@ int AffixMgr::cpdrep_check(const char *
const char * r;
int lenr, lenp;
@@ -165,7 +165,7 @@ diff -u -r1.41 affixmgr.cxx
if ((wl < 2) || !numrep) return 0;
for (int i=0; i < numrep; i++ ) {
-@@ -1323,6 +1401,7 @@
+@@ -1323,6 +1401,7 @@ int AffixMgr::cpdrep_check(const char *
r++; // search for the next letter
}
}
@@ -173,7 +173,7 @@ diff -u -r1.41 affixmgr.cxx
return 0;
}
-@@ -4219,6 +4298,7 @@
+@@ -4219,6 +4298,7 @@ int AffixMgr::parse_affix(char * line,
case 1: {
np++;
aflag = pHMgr->decode_flag(piece);
@@ -181,7 +181,7 @@ diff -u -r1.41 affixmgr.cxx
if (((at == 'S') && (dupflags[aflag] & dupSFX)) ||
((at == 'P') && (dupflags[aflag] & dupPFX))) {
HUNSPELL_WARNING(stderr, "error: line %d: multiple definitions of an affix flag\n",
-@@ -4226,6 +4306,7 @@
+@@ -4226,6 +4306,7 @@ int AffixMgr::parse_affix(char * line,
// return 1; XXX permissive mode for bad dictionaries
}
dupflags[aflag] += (char) ((at == 'S') ? dupSFX : dupPFX);
@@ -193,9 +193,9 @@ Index: src/hunspell/affixmgr.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.hxx,v
retrieving revision 1.15
-diff -u -r1.15 affixmgr.hxx
+diff -u -p -r1.15 affixmgr.hxx
--- src/hunspell/affixmgr.hxx 13 Oct 2011 13:41:54 -0000 1.15
-+++ src/hunspell/affixmgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/affixmgr.hxx 26 Feb 2013 23:13:13 -0000
@@ -18,6 +18,40 @@
class PfxEntry;
class SfxEntry;
@@ -237,7 +237,7 @@ diff -u -r1.15 affixmgr.hxx
class LIBHUNSPELL_DLL_EXPORTED AffixMgr
{
-@@ -106,12 +140,20 @@
+@@ -106,12 +140,20 @@ class LIBHUNSPELL_DLL_EXPORTED AffixMgr
int fullstrip;
int havecontclass; // boolean variable
@@ -258,7 +258,7 @@ diff -u -r1.15 affixmgr.hxx
~AffixMgr();
struct hentry * affix_check(const char * word, int len,
const unsigned short needflag = (unsigned short) 0,
-@@ -218,6 +260,10 @@
+@@ -218,6 +260,10 @@ public:
int get_fullstrip() const;
private:
@@ -269,7 +269,7 @@ diff -u -r1.15 affixmgr.hxx
int parse_file(const char * affpath, const char * key);
int parse_flag(char * line, unsigned short * out, FileMgr * af);
int parse_num(char * line, int * out, FileMgr * af);
-@@ -249,4 +295,3 @@
+@@ -249,4 +295,3 @@ private:
};
#endif
@@ -278,9 +278,9 @@ Index: src/hunspell/filemgr.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.cxx,v
retrieving revision 1.5
-diff -u -r1.5 filemgr.cxx
+diff -u -p -r1.5 filemgr.cxx
--- src/hunspell/filemgr.cxx 23 Jun 2011 09:21:50 -0000 1.5
-+++ src/hunspell/filemgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/filemgr.cxx 26 Feb 2013 23:13:13 -0000
@@ -7,6 +7,32 @@
#include "filemgr.hxx"
@@ -314,7 +314,7 @@ diff -u -r1.5 filemgr.cxx
int FileMgr::fail(const char * err, const char * par) {
fprintf(stderr, err, par);
return -1;
-@@ -47,3 +73,4 @@
+@@ -47,3 +73,4 @@ char * FileMgr::getline() {
int FileMgr::getlinenum() {
return linenum;
}
@@ -323,9 +323,9 @@ Index: src/hunspell/filemgr.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.hxx,v
retrieving revision 1.3
-diff -u -r1.3 filemgr.hxx
+diff -u -p -r1.3 filemgr.hxx
--- src/hunspell/filemgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
-+++ src/hunspell/filemgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/filemgr.hxx 26 Feb 2013 23:13:13 -0000
@@ -7,6 +7,30 @@
#include "hunzip.hxx"
#include <stdio.h>
@@ -357,7 +357,7 @@ diff -u -r1.3 filemgr.hxx
class LIBHUNSPELL_DLL_EXPORTED FileMgr
{
protected:
-@@ -23,3 +47,4 @@
+@@ -23,3 +47,4 @@ public:
int getlinenum();
};
#endif
@@ -366,9 +366,9 @@ Index: src/hunspell/hashmgr.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.cxx,v
retrieving revision 1.12
-diff -u -r1.12 hashmgr.cxx
+diff -u -p -r1.12 hashmgr.cxx
--- src/hunspell/hashmgr.cxx 23 Jun 2011 09:21:50 -0000 1.12
-+++ src/hunspell/hashmgr.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hashmgr.cxx 26 Feb 2013 23:13:13 -0000
@@ -12,8 +12,14 @@
// build a hash table from a munched word list
@@ -384,7 +384,7 @@ diff -u -r1.12 hashmgr.cxx
tablesize = 0;
tableptr = NULL;
flag_mode = FLAG_CHAR;
-@@ -31,8 +37,14 @@
+@@ -31,8 +37,14 @@ HashMgr::HashMgr(const char * tpath, con
numaliasm = 0;
aliasm = NULL;
forbiddenword = FORBIDDENWORD; // forbidden word signing flag
@@ -399,7 +399,7 @@ diff -u -r1.12 hashmgr.cxx
if (ec) {
/* error condition - what should we do here */
HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n",ec);
-@@ -91,15 +103,58 @@
+@@ -91,15 +103,58 @@ HashMgr::~HashMgr()
if (ignorechars) free(ignorechars);
if (ignorechars_utf16) free(ignorechars_utf16);
@@ -458,7 +458,7 @@ diff -u -r1.12 hashmgr.cxx
struct hentry * dp;
if (tableptr) {
dp = tableptr[hash(word)];
-@@ -109,12 +164,14 @@
+@@ -109,12 +164,14 @@ struct hentry * HashMgr::lookup(const ch
}
}
return NULL;
@@ -473,7 +473,7 @@ diff -u -r1.12 hashmgr.cxx
bool upcasehomonym = false;
int descl = desc ? (aliasm ? sizeof(short) : strlen(desc) + 1) : 0;
// variable-length hash record with word and optional fields
-@@ -206,6 +263,17 @@
+@@ -206,6 +263,17 @@ int HashMgr::add_word(const char * word,
if (hp->astr) free(hp->astr);
free(hp);
}
@@ -491,7 +491,7 @@ diff -u -r1.12 hashmgr.cxx
return 0;
}
-@@ -256,6 +324,12 @@
+@@ -256,6 +324,12 @@ int HashMgr::get_clen_and_captype(const
// remove word (personal dictionary function for standalone applications)
int HashMgr::remove(const char * word)
{
@@ -504,7 +504,7 @@ diff -u -r1.12 hashmgr.cxx
struct hentry * dp = lookup(word);
while (dp) {
if (dp->alen == 0 || !TESTAFF(dp->astr, forbiddenword, dp->alen)) {
-@@ -270,6 +344,7 @@
+@@ -270,6 +344,7 @@ int HashMgr::remove(const char * word)
}
dp = dp->next_homonym;
}
@@ -512,7 +512,7 @@ diff -u -r1.12 hashmgr.cxx
return 0;
}
-@@ -339,6 +414,44 @@
+@@ -339,6 +414,44 @@ int HashMgr::add_with_affix(const char *
// initialize: col=-1; hp = NULL; hp = walk_hashtable(&col, hp);
struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const
{
@@ -557,7 +557,7 @@ diff -u -r1.12 hashmgr.cxx
if (hp && hp->next != NULL) return hp->next;
for (col++; col < tablesize; col++) {
if (tableptr[col]) return tableptr[col];
-@@ -346,11 +459,13 @@
+@@ -346,11 +459,13 @@ struct hentry * HashMgr::walk_hashtable(
// null at end and reset to start
col = -1;
return NULL;
@@ -571,7 +571,7 @@ diff -u -r1.12 hashmgr.cxx
int al;
char * ap;
char * dp;
-@@ -471,6 +586,7 @@
+@@ -471,6 +586,7 @@ int HashMgr::load_tables(const char * tp
}
delete dict;
@@ -579,7 +579,7 @@ diff -u -r1.12 hashmgr.cxx
return 0;
}
-@@ -479,6 +595,9 @@
+@@ -479,6 +595,9 @@ int HashMgr::load_tables(const char * tp
int HashMgr::hash(const char * word) const
{
@@ -589,7 +589,7 @@ diff -u -r1.12 hashmgr.cxx
long hv = 0;
for (int i=0; i < 4 && *word != 0; i++)
hv = (hv << 8) | (*word++);
-@@ -487,6 +606,7 @@
+@@ -487,6 +606,7 @@ int HashMgr::hash(const char * word) con
hv ^= (*word++);
}
return (unsigned long) hv % tablesize;
@@ -597,7 +597,7 @@ diff -u -r1.12 hashmgr.cxx
}
int HashMgr::decode_flags(unsigned short ** result, char * flags, FileMgr * af) {
-@@ -607,7 +727,12 @@
+@@ -607,7 +727,12 @@ int HashMgr::load_config(const char * a
int firstline = 1;
// open the affix file
@@ -610,7 +610,7 @@ diff -u -r1.12 hashmgr.cxx
if (!afflst) {
HUNSPELL_WARNING(stderr, "Error - could not open affix description file %s\n",affpath);
return 1;
-@@ -802,6 +927,121 @@
+@@ -802,6 +927,121 @@ int HashMgr::parse_aliasf(char * line,
return 0;
}
@@ -736,9 +736,9 @@ Index: src/hunspell/hashmgr.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.hxx,v
retrieving revision 1.3
-diff -u -r1.3 hashmgr.hxx
+diff -u -p -r1.3 hashmgr.hxx
--- src/hunspell/hashmgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
-+++ src/hunspell/hashmgr.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hashmgr.hxx 26 Feb 2013 23:13:13 -0000
@@ -8,10 +8,25 @@
#include "htypes.hxx"
#include "filemgr.hxx"
@@ -765,7 +765,7 @@ diff -u -r1.3 hashmgr.hxx
int tablesize;
struct hentry ** tableptr;
int userword;
-@@ -34,7 +49,23 @@
+@@ -34,7 +49,23 @@ class LIBHUNSPELL_DLL_EXPORTED HashMgr
public:
@@ -789,7 +789,7 @@ diff -u -r1.3 hashmgr.hxx
~HashMgr();
struct hentry * lookup(const char *) const;
-@@ -59,6 +90,40 @@
+@@ -59,6 +90,40 @@ private:
int al, const char * desc, bool onlyupcase);
int load_config(const char * affpath, const char * key);
int parse_aliasf(char * line, FileMgr * af);
@@ -834,9 +834,9 @@ Index: src/hunspell/htypes.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/htypes.hxx,v
retrieving revision 1.3
-diff -u -r1.3 htypes.hxx
+diff -u -p -r1.3 htypes.hxx
--- src/hunspell/htypes.hxx 6 Sep 2010 07:58:53 -0000 1.3
-+++ src/hunspell/htypes.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/htypes.hxx 26 Feb 2013 23:13:13 -0000
@@ -1,6 +1,16 @@
#ifndef _HTYPES_HXX_
#define _HTYPES_HXX_
@@ -858,9 +858,9 @@ Index: src/hunspell/hunspell.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.cxx,v
retrieving revision 1.29
-diff -u -r1.29 hunspell.cxx
+diff -u -p -r1.29 hunspell.cxx
--- src/hunspell/hunspell.cxx 23 Jun 2011 09:21:50 -0000 1.29
-+++ src/hunspell/hunspell.cxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hunspell.cxx 26 Feb 2013 23:13:13 -0000
@@ -7,20 +7,37 @@
#include "hunspell.hxx"
@@ -899,7 +899,7 @@ diff -u -r1.29 hunspell.cxx
/* first set up the hash manager */
pHMgr[0] = new HashMgr(dpath, affpath, key);
if (pHMgr[0]) maxdic = 1;
-@@ -28,6 +45,7 @@
+@@ -28,6 +45,7 @@ Hunspell::Hunspell(const char * affpath,
/* next set up the affix manager */
/* it needs access to the hash manager lookup methods */
pAMgr = new AffixMgr(affpath, pHMgr, &maxdic, key);
@@ -907,7 +907,7 @@ diff -u -r1.29 hunspell.cxx
/* get the preferred try string and the dictionary */
/* encoding from the Affix Manager for that dictionary */
-@@ -41,7 +59,11 @@
+@@ -41,7 +59,11 @@ Hunspell::Hunspell(const char * affpath,
wordbreak = pAMgr->get_breaktable();
/* and finally set up the suggestion manager */
@@ -919,7 +919,7 @@ diff -u -r1.29 hunspell.cxx
if (try_string) free(try_string);
}
-@@ -59,10 +81,16 @@
+@@ -59,10 +81,16 @@ Hunspell::~Hunspell()
csconv= NULL;
if (encoding) free(encoding);
encoding = NULL;
@@ -936,7 +936,7 @@ diff -u -r1.29 hunspell.cxx
// load extra dictionaries
int Hunspell::add_dic(const char * dpath, const char * key) {
if (maxdic == MAXDIC || !affixpath) return 1;
-@@ -70,6 +98,7 @@
+@@ -70,6 +98,7 @@ int Hunspell::add_dic(const char * dpath
if (pHMgr[maxdic]) maxdic++; else return 1;
return 0;
}
@@ -944,7 +944,7 @@ diff -u -r1.29 hunspell.cxx
// make a copy of src at destination while removing all leading
// blanks and removing any trailing periods after recording
-@@ -322,6 +351,9 @@
+@@ -322,6 +351,9 @@ int Hunspell::insert_sug(char ***slst, c
int Hunspell::spell(const char * word, int * info, char ** root)
{
@@ -954,7 +954,7 @@ diff -u -r1.29 hunspell.cxx
struct hentry * rv=NULL;
// need larger vector. For example, Turkish capital letter I converted a
// 2-byte UTF-8 character (dotless i) by mkallsmall.
-@@ -586,6 +618,13 @@
+@@ -586,6 +618,13 @@ struct hentry * Hunspell::checkword(cons
if (!len)
return NULL;
@@ -968,7 +968,7 @@ diff -u -r1.29 hunspell.cxx
// word reversing wrapper for complex prefixes
if (complexprefixes) {
if (word != w2) {
-@@ -675,6 +714,9 @@
+@@ -675,6 +714,9 @@ struct hentry * Hunspell::checkword(cons
int Hunspell::suggest(char*** slst, const char * word)
{
@@ -978,7 +978,7 @@ diff -u -r1.29 hunspell.cxx
int onlycmpdsug = 0;
char cw[MAXWORDUTF8LEN];
char wspace[MAXWORDUTF8LEN];
-@@ -1921,13 +1963,21 @@
+@@ -1921,13 +1963,21 @@ char * Hunspell::morph_with_correction(c
Hunhandle *Hunspell_create(const char * affpath, const char * dpath)
{
@@ -1004,9 +1004,9 @@ Index: src/hunspell/hunspell.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.hxx,v
retrieving revision 1.6
-diff -u -r1.6 hunspell.hxx
+diff -u -p -r1.6 hunspell.hxx
--- src/hunspell/hunspell.hxx 21 Jan 2011 17:30:41 -0000 1.6
-+++ src/hunspell/hunspell.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/hunspell.hxx 26 Feb 2013 23:13:13 -0000
@@ -5,6 +5,10 @@
#include "suggestmgr.hxx"
#include "langnum.hxx"
@@ -1018,7 +1018,7 @@ diff -u -r1.6 hunspell.hxx
#define SPELL_XML "<?xml?>"
#define MAXDIC 20
-@@ -23,7 +27,9 @@
+@@ -23,7 +27,9 @@ class LIBHUNSPELL_DLL_EXPORTED Hunspell
HashMgr* pHMgr[MAXDIC];
int maxdic;
SuggestMgr* pSMgr;
@@ -1028,7 +1028,7 @@ diff -u -r1.6 hunspell.hxx
char * encoding;
struct cs_info * csconv;
int langnum;
-@@ -31,17 +37,28 @@
+@@ -31,17 +37,28 @@ class LIBHUNSPELL_DLL_EXPORTED Hunspell
int complexprefixes;
char** wordbreak;
@@ -1061,9 +1061,9 @@ Index: src/hunspell/replist.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/replist.hxx,v
retrieving revision 1.2
-diff -u -r1.2 replist.hxx
+diff -u -p -r1.2 replist.hxx
--- src/hunspell/replist.hxx 15 Apr 2010 11:22:09 -0000 1.2
-+++ src/hunspell/replist.hxx 8 Jan 2013 00:30:25 -0000
++++ src/hunspell/replist.hxx 26 Feb 2013 23:13:13 -0000
@@ -2,6 +2,12 @@
#ifndef _REPLIST_HXX_
#define _REPLIST_HXX_
@@ -1081,10 +1081,10 @@ Index: src/hunspell/suggestmgr.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.cxx,v
retrieving revision 1.24
-diff -u -r1.24 suggestmgr.cxx
+diff -u -p -r1.24 suggestmgr.cxx
--- src/hunspell/suggestmgr.cxx 14 Feb 2011 21:47:24 -0000 1.24
-+++ src/hunspell/suggestmgr.cxx 8 Jan 2013 00:30:26 -0000
-@@ -12,9 +12,110 @@
++++ src/hunspell/suggestmgr.cxx 26 Feb 2013 23:13:13 -0000
+@@ -12,9 +12,114 @@
const w_char W_VLINE = { '\0', '|' };
@@ -1130,24 +1130,25 @@ diff -u -r1.24 suggestmgr.cxx
+ // it can store affix flags into 'h->astr[0]',...,'h->astr[alen-1]'. To handle
+ // this new hentry struct, we define a struct which combines three values: an
+ // hentry struct 'hentry'; a char array 'word[kMaxWordLen]', and; an unsigned
-+ // short value 'astr' so a hentry struct 'h' returned from
++ // short array 'astr' so a hentry struct 'h' returned from
+ // CreateScopedHashEntry() satisfies the following equations:
+ // hentry* h = factory.CreateScopedHashEntry(0, source);
+ // h->word[0] == ((HashEntryItem*)h)->entry.word[0].
+ // h->word[1] == ((HashEntryItem*)h)->word[0].
+ // ...
+ // h->word[h->blen] == ((HashEntryItem*)h)->word[h->blen-1].
-+ // h->astr[0] == ((HashEntryItem*)h)->astr.
-+ // Our BDICT does not use affix flags longer than one for now since they are
-+ // discarded by convert_dict, i.e. 'h->astr' is always <= 1. Therefore, this
-+ // struct does not use an array for 'astr'.
++ // h->astr[0] == ((HashEntryItem*)h)->astr[0].
++ // h->astr[1] == ((HashEntryItem*)h)->astr[1].
++ // ...
++ // h->astr[h->alen-1] == ((HashEntryItem*)h)->astr[h->alen-1].
+ enum {
+ kMaxWordLen = 128,
++ kMaxAffixLen = 8,
+ };
+ struct HashEntryItem {
+ hentry entry;
+ char word[kMaxWordLen];
-+ unsigned short astr;
++ unsigned short astr[kMaxAffixLen];
+ };
+
+ HashEntryItem hash_items_[MAX_ROOTS];
@@ -1162,7 +1163,7 @@ diff -u -r1.24 suggestmgr.cxx
+
+hentry* ScopedHashEntryFactory::CreateScopedHashEntry(int index,
+ const hentry* source) {
-+ if (index >= MAX_ROOTS || source->blen >= kMaxWordLen || source->alen > 1)
++ if (index >= MAX_ROOTS || source->blen >= kMaxWordLen)
+ return NULL;
+
+ // Retrieve a HashEntryItem struct from our spool, initialize it, and
@@ -1171,8 +1172,11 @@ diff -u -r1.24 suggestmgr.cxx
+ HashEntryItem* hash_item = &hash_items_[index];
+ memcpy(&hash_item->entry, source, source_size);
+ if (source->astr) {
-+ hash_item->astr = *source->astr;
-+ hash_item->entry.astr = &hash_item->astr;
++ hash_item->entry.alen = source->alen;
++ if (source->alen > kMaxAffixLen)
++ hash_item->entry.alen = kMaxAffixLen;
++ memcpy(hash_item->astr, source->astr, hash_item->entry.alen * sizeof(unsigned short));
++ hash_item->entry.astr = &hash_item->astr[0];
+ }
+ return &hash_item->entry;
+}
@@ -1195,7 +1199,7 @@ diff -u -r1.24 suggestmgr.cxx
// register affix manager and check in string of chars to
// try when building candidate suggestions
-@@ -407,6 +508,49 @@
+@@ -407,6 +512,49 @@ int SuggestMgr::replchars(char** wlst, c
int lenr, lenp;
int wl = strlen(word);
if (wl < 2 || ! pAMgr) return ns;
@@ -1245,7 +1249,7 @@ diff -u -r1.24 suggestmgr.cxx
int numrep = pAMgr->get_numrep();
struct replentry* reptable = pAMgr->get_reptable();
if (reptable==NULL) return ns;
-@@ -448,6 +592,7 @@
+@@ -448,6 +596,7 @@ int SuggestMgr::replchars(char** wlst, c
r++; // search for the next letter
}
}
@@ -1253,7 +1257,7 @@ diff -u -r1.24 suggestmgr.cxx
return ns;
}
-@@ -678,7 +823,9 @@
+@@ -678,7 +827,9 @@ int SuggestMgr::extrachar(char** wlst, c
// error is missing a letter it needs
int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
{
@@ -1264,7 +1268,7 @@ diff -u -r1.24 suggestmgr.cxx
char * p;
clock_t timelimit = clock();
int timer = MINTIMER;
-@@ -700,8 +847,10 @@
+@@ -700,8 +851,10 @@ int SuggestMgr::forgotchar(char ** wlst,
// error is missing a letter it needs
int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
{
@@ -1277,7 +1281,7 @@ diff -u -r1.24 suggestmgr.cxx
w_char * p;
clock_t timelimit = clock();
int timer = MINTIMER;
-@@ -1057,6 +1206,9 @@
+@@ -1057,6 +1210,9 @@ int SuggestMgr::ngsuggest(char** wlst, c
struct hentry* hp = NULL;
int col = -1;
@@ -1287,7 +1291,7 @@ diff -u -r1.24 suggestmgr.cxx
phonetable * ph = (pAMgr) ? pAMgr->get_phonetable() : NULL;
char target[MAXSWUTF8L];
char candidate[MAXSWUTF8L];
-@@ -1115,7 +1267,11 @@
+@@ -1115,7 +1271,11 @@ int SuggestMgr::ngsuggest(char** wlst, c
if (sc > scores[lp]) {
scores[lp] = sc;
@@ -1303,10 +1307,10 @@ Index: src/hunspell/suggestmgr.hxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.hxx,v
retrieving revision 1.5
-diff -u -r1.5 suggestmgr.hxx
+diff -u -p -r1.5 suggestmgr.hxx
--- src/hunspell/suggestmgr.hxx 21 Jan 2011 22:10:24 -0000 1.5
-+++ src/hunspell/suggestmgr.hxx 8 Jan 2013 00:30:26 -0000
-@@ -52,7 +52,11 @@
++++ src/hunspell/suggestmgr.hxx 26 Feb 2013 23:13:13 -0000
+@@ -52,7 +52,11 @@ class LIBHUNSPELL_DLL_EXPORTED SuggestMg
public:
@@ -1318,7 +1322,7 @@ diff -u -r1.5 suggestmgr.hxx
~SuggestMgr();
int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug);
-@@ -66,6 +70,10 @@
+@@ -66,6 +70,10 @@ public:
char * suggest_morph_for_spelling_error(const char * word);
private:
« no previous file with comments | « README.chromium ('k') | src/hunspell/suggestmgr.cxx » ('j') | src/hunspell/suggestmgr.cxx » ('J')

Powered by Google App Engine
This is Rietveld 408576698