mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1022262 - Part 2: Update Hunspell to version 1.3.3. r=ehsan
This commit is contained in:
parent
16506b3cd6
commit
15ac26de12
182
extensions/spellcheck/hunspell/src/README
Normal file
182
extensions/spellcheck/hunspell/src/README
Normal file
@ -0,0 +1,182 @@
|
||||
About Hunspell
|
||||
--------------
|
||||
|
||||
Hunspell is a spell checker and morphological analyzer library and program
|
||||
designed for languages with rich morphology and complex word compounding or
|
||||
character encoding. Hunspell interfaces: Ispell-like terminal interface
|
||||
using Curses library, Ispell pipe interface, OpenOffice.org UNO module.
|
||||
|
||||
Hunspell's code base comes from the OpenOffice.org MySpell
|
||||
(http://lingucomponent.openoffice.org/MySpell-3.zip). See README.MYSPELL,
|
||||
AUTHORS.MYSPELL and license.myspell files.
|
||||
Hunspell is designed to eventually replace Myspell in OpenOffice.org.
|
||||
|
||||
Main features of Hunspell spell checker and morphological analyzer:
|
||||
|
||||
- Unicode support (affix rules work only with the first 65535 Unicode characters)
|
||||
|
||||
- Morphological analysis (in custom item and arrangement style) and stemming
|
||||
|
||||
- Max. 65535 affix classes and twofold affix stripping (for agglutinative
|
||||
languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
|
||||
|
||||
- Support complex compoundings (for example, Hungarian and German)
|
||||
|
||||
- Support language specific features (for example, special casing of
|
||||
Azeri and Turkish dotted i, or German sharp s)
|
||||
|
||||
- Handle conditional affixes, circumfixes, fogemorphemes,
|
||||
forbidden words, pseudoroots and homonyms.
|
||||
|
||||
- Free software (LGPL, GPL, MPL tri-license)
|
||||
|
||||
Compiling on Unix/Linux
|
||||
-----------------------
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
The developer packages you need to compile Hunspell's interface:
|
||||
|
||||
glibc-devel
|
||||
|
||||
optional developer packages:
|
||||
|
||||
ncurses (need for --with-ui), eg. libncursesw5 for UTF-8
|
||||
readline (for fancy input line editing,
|
||||
configure parameter: --with-readline)
|
||||
locale and gettext (but you can also use the
|
||||
--with-included-gettext configure parameter)
|
||||
|
||||
Hunspell distribution uses new Autoconf (2.59) and Automake (1.9).
|
||||
|
||||
Compiling on Windows
|
||||
--------------------
|
||||
|
||||
1. Compiling with Windows SDK
|
||||
|
||||
Download the free Windows SDK of Microsoft, open a command prompt
|
||||
window and cd into hunspell/src/win_api. Use the following command
|
||||
to compile hunspell:
|
||||
|
||||
vcbuild
|
||||
|
||||
2. Compiling in Cygwin environment
|
||||
|
||||
Download and install Cygwin environment for Windows with the following
|
||||
extra packages:
|
||||
|
||||
make
|
||||
gcc-g++ development package
|
||||
mingw development package (for cygwin.dll free native Windows compilation)
|
||||
ncurses, readline (for user interface)
|
||||
iconv (character conversion)
|
||||
|
||||
2.1. Cygwin1.dll dependent compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell root directory:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
readline configure parameter: --with-readline (for fancy input line editing)
|
||||
|
||||
1.2. Cygwin1.dll free compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell/src/win_api and
|
||||
|
||||
make -f Makefile.cygwin
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Testing Hunspell (see tests in tests/ subdirectory):
|
||||
|
||||
make check
|
||||
|
||||
or with Valgrind debugger:
|
||||
|
||||
make check
|
||||
VALGRIND=[Valgrind_tool] make check
|
||||
|
||||
For example:
|
||||
|
||||
make check
|
||||
VALGRIND=memcheck make check
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
features and dictionary format:
|
||||
man 5 hunspell
|
||||
|
||||
man hunspell
|
||||
hunspell -h
|
||||
http://hunspell.sourceforge.net
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The src/tools dictionary contains ten executables after compiling
|
||||
(or some of them are in the src/win_api):
|
||||
|
||||
affixcompress: dictionary generation from large (millions of words) vocabularies
|
||||
analyze: example of spell checking, stemming and morphological analysis
|
||||
chmorph: example of automatic morphological generation and conversion
|
||||
example: example of spell checking and suggestion
|
||||
hunspell: main program for spell checking and others (see manual)
|
||||
hunzip: decompressor of hzip format
|
||||
hzip: compressor of hzip format
|
||||
makealias: alias compression (Hunspell only, not back compatible with MySpell)
|
||||
munch: dictionary generation from vocabularies (it needs an affix file, too).
|
||||
unmunch: list all recognized words of a MySpell dictionary
|
||||
wordforms: word generation (Hunspell version of unmunch)
|
||||
|
||||
After compiling and installing (see INSTALL) you can
|
||||
run the Hunspell spell checker (compiled with user interface)
|
||||
with a Hunspell or Myspell dictionary:
|
||||
|
||||
hunspell -d en_US text.txt
|
||||
|
||||
or without interface:
|
||||
|
||||
hunspell
|
||||
hunspell -d en_UK -l <text.txt
|
||||
|
||||
Dictionaries consist of an affix and dictionary file, see tests/
|
||||
or http://wiki.services.openoffice.org/wiki/Dictionaries.
|
||||
|
||||
Using Hunspell library with GCC
|
||||
-------------------------------
|
||||
|
||||
Including in your program:
|
||||
#include <hunspell.hxx>
|
||||
|
||||
Linking with Hunspell static library:
|
||||
g++ -lhunspell example.cxx
|
||||
|
||||
Dictionaries
|
||||
------------
|
||||
|
||||
Myspell & Hunspell dictionaries:
|
||||
http://extensions.libreoffice.org
|
||||
http://cgit.freedesktop.org/libreoffice/dictionaries
|
||||
http://extensions.openoffice.org
|
||||
http://wiki.services.openoffice.org/wiki/Dictionaries
|
||||
|
||||
Aspell dictionaries (need some conversion):
|
||||
ftp://ftp.gnu.org/gnu/aspell/dict
|
||||
Conversion steps: see relevant feature request at http://hunspell.sf.net.
|
||||
|
||||
László Németh
|
||||
nemeth at numbertext org
|
@ -1,61 +1,2 @@
|
||||
******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Ryan VanderMeulen (ryanvm@gmail.com)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******
|
||||
|
||||
Hunspell Version: 1.3.2
|
||||
Additional Patches: 694002, 710967, 710940, 784776
|
||||
|
||||
Hunspell Author: László Németh
|
||||
MySpell Author: Kevin Hendricks & David Einstein
|
||||
|
||||
Hunspell is a spell checker and morphological analyser library. Hunspell
|
||||
is based on OpenOffice.org's Myspell. Documentation, tests, and examples
|
||||
are available at http://hunspell.sourceforge.net.
|
||||
|
||||
A special thanks and credit goes to Geoff Kuenning, the creator of Ispell.
|
||||
MySpell's affix algorithms were based on those of Ispell, which should be
|
||||
noted is copyright Geoff Kuenning et al and now available under a BSD-style
|
||||
license. For more information on Ispell and affix compression in general,
|
||||
please see: http://lasr.cs.ucla.edu/geoff/ispell.html (Ispell homepage)
|
||||
|
||||
An almost complete rewrite of MySpell for use by the Mozilla project was
|
||||
developed by David Einstein. David was a significant help in improving MySpell.
|
||||
|
||||
Special thanks also goes to László Németh, who is the author of the Hungarian
|
||||
dictionary and who developed and contributed the code to support compound words
|
||||
in MySpell and fixed numerous problems with the encoding case conversion tables
|
||||
along with rewriting MySpell as Hunspell and ensuring compatibility with the
|
||||
Mozilla codebase.
|
||||
Hunspell Version: 1.3.3
|
||||
Additional Patches: See patches directory.
|
||||
|
@ -1,59 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -63,13 +9,17 @@
|
||||
#include "affentry.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define MAXTEMPWORDLEN (MAXWORDUTF8LEN + 4)
|
||||
|
||||
PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
||||
// register affix manager
|
||||
: pmyMgr(pmgr)
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
|
||||
aflag = dp->aflag; // flag
|
||||
strip = dp->strip; // string to strip
|
||||
appnd = dp->appnd; // string to append
|
||||
@ -82,9 +32,6 @@ PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
||||
memcpy(c.conds, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
contclasslen = dp->contclasslen;
|
||||
@ -107,16 +54,17 @@ PfxEntry::~PfxEntry()
|
||||
// add prefix to this word assuming conditions hold
|
||||
char * PfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word) &&
|
||||
(!stripl || (strncmp(word, strip, stripl) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add prefix */
|
||||
char * pp = tword;
|
||||
if (appndl) {
|
||||
strcpy(tword,appnd);
|
||||
strncpy(tword, appnd, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
pp += appndl;
|
||||
}
|
||||
strcpy(pp, (word + stripl));
|
||||
@ -164,13 +112,15 @@ inline int PfxEntry::test_condition(const char * st)
|
||||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '.':
|
||||
if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
|
||||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
st++;
|
||||
@ -187,11 +137,11 @@ inline int PfxEntry::test_condition(const char * st)
|
||||
}
|
||||
if (pos && st != pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) { // group
|
||||
p = nextchar(p);
|
||||
@ -207,7 +157,7 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
@ -221,7 +171,10 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
||||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
@ -268,7 +221,7 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
@ -283,7 +236,10 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
||||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
@ -315,7 +271,7 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
||||
char in_compound, const FLAG needflag)
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
@ -330,7 +286,10 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
||||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
@ -362,7 +321,7 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
char result[MAXLNLEN];
|
||||
char * st;
|
||||
|
||||
@ -381,7 +340,10 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
||||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
@ -449,10 +411,15 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
||||
}
|
||||
|
||||
SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
||||
: pmyMgr(pmgr) // register affix manager
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
, l_morph(NULL)
|
||||
, r_morph(NULL)
|
||||
, eq_morph(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
aflag = dp->aflag; // char flag
|
||||
strip = dp->strip; // string to strip
|
||||
@ -467,9 +434,6 @@ SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
||||
memcpy(c.l.conds1, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
rappnd = myrevstrdup(appnd);
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
@ -494,15 +458,16 @@ SfxEntry::~SfxEntry()
|
||||
// add suffix to this word assuming conditions hold
|
||||
char * SfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
/* make sure all conditions match */
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word + len, word) &&
|
||||
(!stripl || (strcmp(word + len - stripl, strip) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add suffix */
|
||||
strcpy(tword,word);
|
||||
strncpy(tword, word, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
if (appndl) {
|
||||
strcpy(tword + len - stripl, appnd);
|
||||
} else {
|
||||
@ -537,24 +502,37 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
||||
int i = 1;
|
||||
while (1) {
|
||||
switch (*p) {
|
||||
case '\0': return 1;
|
||||
case '[': { p = nextchar(p); pos = st; break; }
|
||||
case '^': { p = nextchar(p); neg = true; break; }
|
||||
case ']': { if (!neg && !ingroup) return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup) {
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '\0':
|
||||
return 1;
|
||||
case '[':
|
||||
p = nextchar(p);
|
||||
pos = st;
|
||||
break;
|
||||
case '^':
|
||||
p = nextchar(p);
|
||||
neg = true;
|
||||
break;
|
||||
case ']':
|
||||
if (!neg && !ingroup)
|
||||
return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup)
|
||||
{
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p)
|
||||
return 0; // word <= condition
|
||||
break;
|
||||
case '.':
|
||||
if (!pos)
|
||||
{
|
||||
// dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st--; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
@ -569,6 +547,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
p = nextchar(p);
|
||||
@ -589,7 +568,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
||||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
@ -597,8 +576,8 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
||||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)))
|
||||
;
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
@ -624,7 +603,7 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
// if this suffix is being cross checked with a prefix
|
||||
@ -649,7 +628,8 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
||||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy (tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
@ -702,7 +682,10 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
||||
} else if (wlst && (*ns < maxSug)) {
|
||||
int cwrd = 1;
|
||||
for (int k=0; k < *ns; k++)
|
||||
if (strcmp(tmpword, wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(tmpword, wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
if (cwrd) {
|
||||
wlst[*ns] = mystrdup(tmpword);
|
||||
if (wlst[*ns] == NULL) {
|
||||
@ -725,7 +708,7 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
|
||||
@ -749,7 +732,8 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
||||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
@ -786,7 +770,7 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
char * st;
|
||||
|
||||
@ -814,7 +798,8 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
||||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIX_HXX_
|
||||
#define _AFFIX_HXX_
|
||||
|
||||
@ -68,6 +11,10 @@
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
PfxEntry(const PfxEntry&);
|
||||
PfxEntry& operator = (const PfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
|
||||
PfxEntry * next;
|
||||
@ -124,6 +71,10 @@ public:
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
SfxEntry(const SfxEntry&);
|
||||
SfxEntry& operator = (const SfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
char * rappnd;
|
||||
|
||||
|
@ -1,59 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -102,6 +48,7 @@ AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * k
|
||||
compoundroot = FLAG_NULL; // compound word signing flag
|
||||
compoundpermitflag = FLAG_NULL; // compound permitting flag for suffixed word
|
||||
compoundforbidflag = FLAG_NULL; // compound fordidden flag for suffixed word
|
||||
compoundmoresuffixes = 0; // allow more suffixes within compound words
|
||||
checkcompounddup = 0; // forbid double words in compounds
|
||||
checkcompoundrep = 0; // forbid bad compounds (may be non compound word with a REP substitution)
|
||||
checkcompoundcase = 0; // forbid upper and lowercase combinations at word bounds
|
||||
@ -307,6 +254,14 @@ AffixMgr::~AffixMgr()
|
||||
#endif
|
||||
}
|
||||
|
||||
void AffixMgr::finishFileMgr(FileMgr *afflst)
|
||||
{
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
}
|
||||
|
||||
// read in aff file and build up prefix and suffix entry objects
|
||||
int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
@ -333,7 +288,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
||||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
@ -348,7 +303,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the keyboard string */
|
||||
if (strncmp(line,"KEY",3) == 0) {
|
||||
if (parse_string(line, &keystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -356,7 +311,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the try string */
|
||||
if (strncmp(line,"TRY",3) == 0) {
|
||||
if (parse_string(line, &trystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -364,7 +319,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the name of the character set used by the .dict and .aff */
|
||||
if (strncmp(line,"SET",3) == 0) {
|
||||
if (parse_string(line, &encoding, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(encoding, "UTF-8") == 0) {
|
||||
@ -384,7 +339,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by the controlled compound words */
|
||||
if (strncmp(line,"COMPOUNDFLAG",12) == 0) {
|
||||
if (parse_flag(line, &compoundflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -393,12 +348,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
if (strncmp(line,"COMPOUNDBEGIN",13) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -407,7 +362,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by compound words */
|
||||
if (strncmp(line,"COMPOUNDMIDDLE",14) == 0) {
|
||||
if (parse_flag(line, &compoundmiddle, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -415,12 +370,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
if (strncmp(line,"COMPOUNDEND",11) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -429,7 +384,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the data used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDWORDMAX",15) == 0) {
|
||||
if (parse_num(line, &cpdwordmax, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -437,7 +392,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag sign compounds in dictionary */
|
||||
if (strncmp(line,"COMPOUNDROOT",12) == 0) {
|
||||
if (parse_flag(line, &compoundroot, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -445,7 +400,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDPERMITFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundpermitflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -453,11 +408,15 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDFORBIDFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundforbidflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"COMPOUNDMORESUFFIXES",20) == 0) {
|
||||
compoundmoresuffixes = 1;
|
||||
}
|
||||
|
||||
if (strncmp(line,"CHECKCOMPOUNDDUP",16) == 0) {
|
||||
checkcompounddup = 1;
|
||||
}
|
||||
@ -480,14 +439,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
||||
if (strncmp(line,"NOSUGGEST",9) == 0) {
|
||||
if (parse_flag(line, &nosuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"NONGRAMSUGGEST",14) == 0) {
|
||||
if (parse_flag(line, &nongramsuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -495,7 +454,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"FORBIDDENWORD",13) == 0) {
|
||||
if (parse_flag(line, &forbiddenword, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -503,7 +462,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"LEMMA_PRESENT",13) == 0) {
|
||||
if (parse_flag(line, &lemma_present, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -511,7 +470,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by circumfixes */
|
||||
if (strncmp(line,"CIRCUMFIX",9) == 0) {
|
||||
if (parse_flag(line, &circumfix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -519,7 +478,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by fogemorphemes */
|
||||
if (strncmp(line,"ONLYINCOMPOUND",14) == 0) {
|
||||
if (parse_flag(line, &onlyincompound, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -527,7 +486,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"PSEUDOROOT",10) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -535,7 +494,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"NEEDAFFIX",9) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -543,7 +502,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the minimal length for words in compounds */
|
||||
if (strncmp(line,"COMPOUNDMIN",11) == 0) {
|
||||
if (parse_num(line, &cpdmin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (cpdmin < 1) cpdmin = 1;
|
||||
@ -552,7 +511,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the max. words and syllables in compounds */
|
||||
if (strncmp(line,"COMPOUNDSYLLABLE",16) == 0) {
|
||||
if (parse_cpdsyllable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -560,7 +519,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"SYLLABLENUM",11) == 0) {
|
||||
if (parse_string(line, &cpdsyllablenum, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -573,7 +532,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the extra word characters */
|
||||
if (strncmp(line,"WORDCHARS",9) == 0) {
|
||||
if (parse_array(line, &wordchars, &wordchars_utf16, &wordchars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -581,7 +540,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the ignored characters (for example, Arabic optional diacretics charachters */
|
||||
if (strncmp(line,"IGNORE",6) == 0) {
|
||||
if (parse_array(line, &ignorechars, &ignorechars_utf16, &ignorechars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -589,7 +548,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the typical fault correcting table */
|
||||
if (strncmp(line,"REP",3) == 0) {
|
||||
if (parse_reptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -597,7 +556,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"ICONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &iconvtable, "ICONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -605,7 +564,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"OCONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &oconvtable, "OCONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -613,7 +572,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the phonetic translation table */
|
||||
if (strncmp(line,"PHONE",5) == 0) {
|
||||
if (parse_phonetable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -621,7 +580,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the checkcompoundpattern table */
|
||||
if (strncmp(line,"CHECKCOMPOUNDPATTERN",20) == 0) {
|
||||
if (parse_checkcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -629,7 +588,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the defcompound table */
|
||||
if (strncmp(line,"COMPOUNDRULE",12) == 0) {
|
||||
if (parse_defcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -637,7 +596,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the related character map table */
|
||||
if (strncmp(line,"MAP",3) == 0) {
|
||||
if (parse_maptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -645,7 +604,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the word breakpoints table */
|
||||
if (strncmp(line,"BREAK",5) == 0) {
|
||||
if (parse_breaktable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -653,7 +612,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the language for language specific codes */
|
||||
if (strncmp(line,"LANG",4) == 0) {
|
||||
if (parse_string(line, &lang, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
langnum = get_lang_num(lang);
|
||||
@ -666,7 +625,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
||||
if (strncmp(line,"MAXNGRAMSUGS",12) == 0) {
|
||||
if (parse_num(line, &maxngramsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -676,14 +635,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
||||
if (strncmp(line,"MAXDIFF",7) == 0) {
|
||||
if (parse_num(line, &maxdiff, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"MAXCPDSUGS",10) == 0) {
|
||||
if (parse_num(line, &maxcpdsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -703,7 +662,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"KEEPCASE",8) == 0) {
|
||||
if (parse_flag(line, &keepcase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -711,7 +670,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by `forceucase' */
|
||||
if (strncmp(line,"FORCEUCASE",10) == 0) {
|
||||
if (parse_flag(line, &forceucase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -719,7 +678,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by `warn' */
|
||||
if (strncmp(line,"WARN",4) == 0) {
|
||||
if (parse_flag(line, &warn, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -731,7 +690,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
/* parse in the flag used by the affix generator */
|
||||
if (strncmp(line,"SUBSTANDARD",11) == 0) {
|
||||
if (parse_flag(line, &substandard, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -750,19 +709,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
dupflags_ini = 0;
|
||||
}
|
||||
if (parse_affix(line, ft, afflst, dupflags)) {
|
||||
delete afflst;
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
// affix trees are sorted now
|
||||
|
||||
// now we can speed up performance greatly taking advantage of the
|
||||
// relationship between the affixes and the idea of "subsets".
|
||||
@ -1373,7 +1327,7 @@ int AffixMgr::cpdrep_check(const char * word, int wl)
|
||||
}
|
||||
|
||||
// forbid compoundings when there are special patterns at word bound
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char affixed)
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char /*affixed*/)
|
||||
{
|
||||
int len;
|
||||
for (int i = 0; i < numcheckcpd; i++) {
|
||||
@ -1386,7 +1340,7 @@ int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2,
|
||||
// zero pattern (0/flag) => unmodified stem (zero affixes allowed)
|
||||
(!*(checkcpdtable[i].pattern) || (
|
||||
(*(checkcpdtable[i].pattern)=='0' && r1->blen <= pos && strncmp(word + pos - r1->blen, r1->word, r1->blen) == 0) ||
|
||||
(*(checkcpdtable[i].pattern)!='0' && (len = strlen(checkcpdtable[i].pattern)) &&
|
||||
(*(checkcpdtable[i].pattern)!='0' && ((len = strlen(checkcpdtable[i].pattern)) != 0) &&
|
||||
strncmp(word + pos - len, checkcpdtable[i].pattern, len) == 0)))) {
|
||||
return 1;
|
||||
}
|
||||
@ -1447,7 +1401,10 @@ int AffixMgr::defcpd_check(hentry *** words, short wnum, hentry * rv, hentry **
|
||||
for (i = 0; i < numdefcpd; i++) {
|
||||
for (j = 0; j < defcpdtable[i].len; j++) {
|
||||
if (defcpdtable[i].def[j] != '*' && defcpdtable[i].def[j] != '?' &&
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) ok = 1;
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) {
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok == 0) {
|
||||
@ -1598,7 +1555,7 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
||||
int oldlen = 0;
|
||||
int checkedstriple = 0;
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
int checked_prefix;
|
||||
@ -1680,8 +1637,9 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
||||
if (onlycpdrule) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
@ -1694,9 +1652,11 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
||||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) checked_prefix = 1;
|
||||
// else check forbiddenwords and needaffix
|
||||
@ -2099,7 +2059,7 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
||||
int cmax;
|
||||
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
setcminmax(&cmin, &cmax, word, len);
|
||||
@ -2169,11 +2129,12 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
||||
}
|
||||
|
||||
if (!rv) {
|
||||
if (onlycpdrule) break;
|
||||
if (onlycpdrule && strlen(*result) > MAXLNLEN/10) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
@ -2186,9 +2147,11 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
||||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) {
|
||||
// char * p = prefix_check_morph(st, i, 0, compound);
|
||||
@ -3608,7 +3571,7 @@ int AffixMgr::parse_reptable(char * line, FileMgr * af)
|
||||
/* now parse the numrep lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numrep; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
@ -4312,7 +4275,7 @@ int AffixMgr::parse_affix(char * line, const char at, FileMgr * af, char * dupf
|
||||
std::vector<affentry>::iterator start = affentries.begin();
|
||||
std::vector<affentry>::iterator end = affentries.end();
|
||||
for (std::vector<affentry>::iterator entry = start; entry != end; ++entry) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIXMGR_HXX_
|
||||
#define _AFFIXMGR_HXX_
|
||||
|
||||
@ -98,6 +41,7 @@ class LIBHUNSPELL_DLL_EXPORTED AffixMgr
|
||||
FLAG compoundroot;
|
||||
FLAG compoundforbidflag;
|
||||
FLAG compoundpermitflag;
|
||||
int compoundmoresuffixes;
|
||||
int checkcompounddup;
|
||||
int checkcompoundrep;
|
||||
int checkcompoundcase;
|
||||
@ -301,6 +245,7 @@ private:
|
||||
int process_sfx_tree_to_list();
|
||||
int redundant_condition(char, char * strip, int stripl,
|
||||
const char * cond, int);
|
||||
void finishFileMgr(FileMgr *afflst);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _ATYPES_HXX_
|
||||
#define _ATYPES_HXX_
|
||||
|
||||
@ -114,7 +57,7 @@ static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
|
||||
#define FLAG_NULL 0x00
|
||||
#define FREE_FLAG(a) a = 0
|
||||
|
||||
#define TESTAFF( a, b , c ) flag_bsearch((unsigned short *) a, (unsigned short) b, c)
|
||||
#define TESTAFF( a, b , c ) (flag_bsearch((unsigned short *) a, (unsigned short) b, c))
|
||||
|
||||
struct affentry
|
||||
{
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _BASEAFF_HXX_
|
||||
#define _BASEAFF_HXX_
|
||||
|
||||
@ -62,7 +5,11 @@
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED AffEntry
|
||||
{
|
||||
private:
|
||||
AffEntry(const AffEntry&);
|
||||
AffEntry& operator = (const AffEntry&);
|
||||
protected:
|
||||
AffEntry() {}
|
||||
char * appnd;
|
||||
char * strip;
|
||||
unsigned char appndl;
|
||||
|
@ -1,60 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* L. David Baron (dbaron@dbaron.org)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -72,6 +17,11 @@ struct unicode_info {
|
||||
unsigned short clower;
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENOFFICEORG
|
||||
# include <unicode/uchar.h>
|
||||
#else
|
||||
@ -100,6 +50,21 @@ struct unicode_info2 {
|
||||
static struct unicode_info2 * utf_tbl = NULL;
|
||||
static int utf_tbl_count = 0; // utf_tbl can be used by multiple Hunspell instances
|
||||
|
||||
FILE * myfopen(const char * path, const char * mode) {
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
|
||||
if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
|
||||
wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
|
||||
FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
|
||||
free(buff);
|
||||
return f;
|
||||
}
|
||||
#endif
|
||||
return fopen(path, mode);
|
||||
}
|
||||
|
||||
/* only UTF-16 (BMP) implementation */
|
||||
char * u16_u8(char * dest, int size, const w_char * src, int srclen) {
|
||||
signed char * u8 = (signed char *)dest;
|
||||
@ -396,7 +361,10 @@ char * line_uniq(char * text, char breakchar) {
|
||||
for ( i = 1; i < linenum; i++ ) {
|
||||
int dup = 0;
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (strcmp(lines[i], lines[j]) == 0) dup = 1;
|
||||
if (strcmp(lines[i], lines[j]) == 0) {
|
||||
dup = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dup) {
|
||||
if ((i > 1) || (*(lines[0]) != '\0')) {
|
||||
@ -5531,6 +5499,7 @@ struct cs_info * get_current_cs(const char * es) {
|
||||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
@ -5707,7 +5676,7 @@ unsigned short unicodetoupper(unsigned short c, int langnum)
|
||||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_toupper(c);
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToUpperCase((char16_t) c);
|
||||
@ -5725,7 +5694,7 @@ unsigned short unicodetolower(unsigned short c, int langnum)
|
||||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_tolower(c);
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToLowerCase((char16_t) c);
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __CSUTILHXX__
|
||||
#define __CSUTILHXX__
|
||||
|
||||
@ -109,6 +52,9 @@
|
||||
#define FORBIDDENWORD 65510
|
||||
#define ONLYUPCASEFLAG 65511
|
||||
|
||||
// fopen or optional _wfopen to fix long pathname problem of WIN32
|
||||
LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode);
|
||||
|
||||
// convert UTF-16 characters to UTF-8
|
||||
LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
|
||||
|
||||
|
@ -1,36 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -38,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dictmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
DictMgr::DictMgr(const char * dictpath, const char * etype) : numdict(0)
|
||||
{
|
||||
@ -90,7 +58,7 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
||||
|
||||
// open the dictionary list file
|
||||
FILE * dictlst;
|
||||
dictlst = fopen(dictpath,"r");
|
||||
dictlst = myfopen(dictpath,"r");
|
||||
if (!dictlst) {
|
||||
return 1;
|
||||
}
|
||||
@ -133,7 +101,8 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
||||
case 3:
|
||||
free(pdict->region);
|
||||
pdict->region=NULL;
|
||||
case 2: //deliberate fallthrough
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
free(pdict->lang);
|
||||
pdict->lang=NULL;
|
||||
default:
|
||||
|
@ -1,37 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _DICTMGR_HXX_
|
||||
#define _DICTMGR_HXX_
|
||||
|
||||
@ -49,7 +15,10 @@ struct dictentry {
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED DictMgr
|
||||
{
|
||||
|
||||
private:
|
||||
DictMgr(const DictMgr&);
|
||||
DictMgr& operator = (const DictMgr&);
|
||||
private:
|
||||
int numdict;
|
||||
dictentry * pdentry;
|
||||
|
||||
|
@ -1,52 +1,25 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key) {
|
||||
linenum = 0;
|
||||
hin = NULL;
|
||||
fin = fopen(file, "r");
|
||||
FileMgr::FileMgr(const char * file, const char * key)
|
||||
: hin(NULL)
|
||||
, linenum(0)
|
||||
{
|
||||
in[0] = '\0';
|
||||
|
||||
fin = myfopen(file, "r");
|
||||
if (!fin) {
|
||||
// check hzipped file
|
||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
||||
@ -70,7 +43,7 @@ char * FileMgr::getline() {
|
||||
const char * l;
|
||||
linenum++;
|
||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
||||
if (hin && (l = hin->getline())) return strcpy(in, l);
|
||||
if (hin && ((l = hin->getline()) != NULL)) return strcpy(in, l);
|
||||
linenum--;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,37 +1,4 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* file manager class - read lines of files [filename] OR [filename.hz] */
|
||||
#ifndef _FILEMGR_HXX_
|
||||
#define _FILEMGR_HXX_
|
||||
|
||||
@ -42,6 +9,9 @@
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED FileMgr
|
||||
{
|
||||
private:
|
||||
FileMgr(const FileMgr&);
|
||||
FileMgr& operator = (const FileMgr&);
|
||||
protected:
|
||||
FILE * fin;
|
||||
Hunzip * hin;
|
||||
|
@ -1,64 +1,11 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits>
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
@ -67,12 +14,19 @@
|
||||
// build a hash table from a munched word list
|
||||
|
||||
HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
||||
: tablesize(0)
|
||||
, tableptr(NULL)
|
||||
, userword(0)
|
||||
, flag_mode(FLAG_CHAR)
|
||||
, complexprefixes(0)
|
||||
, utf8(0)
|
||||
, forbiddenword(FORBIDDENWORD) // forbidden word signing flag
|
||||
, numaliasf(0)
|
||||
, aliasf(NULL)
|
||||
, aliasflen(0)
|
||||
, numaliasm(0)
|
||||
, aliasm(NULL)
|
||||
{
|
||||
tablesize = 0;
|
||||
tableptr = NULL;
|
||||
flag_mode = FLAG_CHAR;
|
||||
complexprefixes = 0;
|
||||
utf8 = 0;
|
||||
langnum = 0;
|
||||
lang = NULL;
|
||||
enc = NULL;
|
||||
@ -80,11 +34,6 @@ HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
||||
ignorechars = NULL;
|
||||
ignorechars_utf16 = NULL;
|
||||
ignorechars_utf16_len = 0;
|
||||
numaliasf = 0;
|
||||
aliasf = NULL;
|
||||
numaliasm = 0;
|
||||
aliasm = NULL;
|
||||
forbiddenword = FORBIDDENWORD; // forbidden word signing flag
|
||||
load_config(apath, key);
|
||||
int ec = load_tables(tpath, key);
|
||||
if (ec) {
|
||||
@ -170,7 +119,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
||||
int al, const char * desc, bool onlyupcase)
|
||||
{
|
||||
bool upcasehomonym = false;
|
||||
int descl = desc ? (aliasm ? sizeof(short) : strlen(desc) + 1) : 0;
|
||||
int descl = desc ? (aliasm ? sizeof(char *) : strlen(desc) + 1) : 0;
|
||||
// variable-length hash record with word and optional fields
|
||||
struct hentry* hp =
|
||||
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
|
||||
@ -264,18 +213,21 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
||||
}
|
||||
|
||||
int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
||||
unsigned short * flags, int al, char * dp, int captype)
|
||||
unsigned short * flags, int flagslen, char * dp, int captype)
|
||||
{
|
||||
if (flags == NULL)
|
||||
flagslen = 0;
|
||||
|
||||
// add inner capitalized forms to handle the following allcap forms:
|
||||
// Mixed caps: OpenOffice.org -> OPENOFFICE.ORG
|
||||
// Allcaps with suffixes: CIA's -> CIA'S
|
||||
if (((captype == HUHCAP) || (captype == HUHINITCAP) ||
|
||||
((captype == ALLCAP) && (flags != NULL))) &&
|
||||
!((flags != NULL) && TESTAFF(flags, forbiddenword, al))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (al+1));
|
||||
((captype == ALLCAP) && (flagslen != 0))) &&
|
||||
!((flagslen != 0) && TESTAFF(flags, forbiddenword, flagslen))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (flagslen+1));
|
||||
if (!flags2) return 1;
|
||||
if (al) memcpy(flags2, flags, al * sizeof(unsigned short));
|
||||
flags2[al] = ONLYUPCASEFLAG;
|
||||
if (flagslen) memcpy(flags2, flags, flagslen * sizeof(unsigned short));
|
||||
flags2[flagslen] = ONLYUPCASEFLAG;
|
||||
if (utf8) {
|
||||
char st[BUFSIZE];
|
||||
w_char w[BUFSIZE];
|
||||
@ -283,11 +235,11 @@ int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
||||
mkallsmall_utf(w, wlen, langnum);
|
||||
mkallcap_utf(w, 1, langnum);
|
||||
u16_u8(st, BUFSIZE, w, wlen);
|
||||
return add_word(st,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(st,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
} else {
|
||||
mkallsmall(word, csconv);
|
||||
mkinitcap(word, csconv);
|
||||
return add_word(word,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(word,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -417,8 +369,8 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
||||
if (dict == NULL) return 1;
|
||||
|
||||
// first read the first line of file to get hash table size */
|
||||
if (!(ts = dict->getline())) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file\n");
|
||||
if ((ts = dict->getline()) == NULL) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file %s\n", tpath);
|
||||
delete dict;
|
||||
return 2;
|
||||
}
|
||||
@ -431,30 +383,32 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
||||
}
|
||||
|
||||
tablesize = atoi(ts);
|
||||
if (tablesize == 0) {
|
||||
|
||||
int nExtra = 5 + USERWORD;
|
||||
|
||||
if (tablesize <= 0 || (tablesize >= (std::numeric_limits<int>::max() - 1 - nExtra) / int(sizeof(struct hentry *)))) {
|
||||
HUNSPELL_WARNING(stderr, "error: line 1: missing or bad word count in the dic file\n");
|
||||
delete dict;
|
||||
return 4;
|
||||
}
|
||||
tablesize = tablesize + 5 + USERWORD;
|
||||
if ((tablesize %2) == 0) tablesize++;
|
||||
tablesize += nExtra;
|
||||
if ((tablesize % 2) == 0) tablesize++;
|
||||
|
||||
// allocate the hash table
|
||||
tableptr = (struct hentry **) malloc(tablesize * sizeof(struct hentry *));
|
||||
tableptr = (struct hentry **) calloc(tablesize, sizeof(struct hentry *));
|
||||
if (! tableptr) {
|
||||
delete dict;
|
||||
return 3;
|
||||
}
|
||||
for (int i=0; i<tablesize; i++) tableptr[i] = NULL;
|
||||
|
||||
// loop through all words on much list and add to hash
|
||||
// table and create word and affix strings
|
||||
|
||||
while ((ts = dict->getline())) {
|
||||
while ((ts = dict->getline()) != NULL) {
|
||||
mychomp(ts);
|
||||
// split each line into word and morphological description
|
||||
dp = ts;
|
||||
while ((dp = strchr(dp, ':'))) {
|
||||
while ((dp = strchr(dp, ':')) != NULL) {
|
||||
if ((dp > ts + 3) && (*(dp - 3) == ' ' || *(dp - 3) == '\t')) {
|
||||
for (dp -= 4; dp >= ts && (*dp == ' ' || *dp == '\t'); dp--);
|
||||
if (dp < ts) { // missing word
|
||||
@ -670,7 +624,7 @@ int HashMgr::load_config(const char * affpath, const char * key)
|
||||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
@ -810,7 +764,7 @@ int HashMgr::parse_aliasf(char * line, FileMgr * af)
|
||||
/* now parse the numaliasf lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numaliasf; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
@ -917,7 +871,7 @@ int HashMgr::parse_aliasm(char * line, FileMgr * af)
|
||||
/* now parse the numaliasm lines to read in the remainder of the table */
|
||||
char * nl = line;
|
||||
for (int j=0; j < numaliasm; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HASHMGR_HXX_
|
||||
#define _HASHMGR_HXX_
|
||||
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HTYPES_HXX_
|
||||
#define _HTYPES_HXX_
|
||||
|
||||
|
@ -1,59 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -66,6 +12,8 @@
|
||||
#endif
|
||||
#include "csutil.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
|
||||
{
|
||||
encoding = NULL;
|
||||
@ -382,6 +330,10 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
||||
char cw[MAXWORDUTF8LEN];
|
||||
char wspace[MAXWORDUTF8LEN];
|
||||
w_char unicw[MAXWORDLEN];
|
||||
|
||||
int info2 = 0;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
// Hunspell supports XML input of the simplified API (see manual)
|
||||
if (strcmp(word, SPELL_XML) == 0) return 1;
|
||||
int nc = strlen(word);
|
||||
@ -400,7 +352,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
||||
if (rl && rl->conv(word, wspace)) wl = cleanword2(cw, wspace, unicw, &nc, &captype, &abbv);
|
||||
else wl = cleanword2(cw, word, unicw, &nc, &captype, &abbv);
|
||||
|
||||
int info2 = 0;
|
||||
if (wl == 0 || maxdic == 0) return 1;
|
||||
if (root) *root = NULL;
|
||||
|
||||
@ -418,13 +369,14 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
||||
} else break;
|
||||
}
|
||||
if ((i == wl) && (nstate == NNUM)) return 1;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
switch(captype) {
|
||||
case HUHCAP:
|
||||
/* FALLTHROUGH */
|
||||
case HUHINITCAP:
|
||||
*info += SPELL_ORIGCAP;
|
||||
case NOCAP: {
|
||||
/* FALLTHROUGH */
|
||||
case NOCAP:
|
||||
rv = checkword(cw, info, root);
|
||||
if ((abbv) && !(rv)) {
|
||||
memcpy(wspace,cw,wl);
|
||||
@ -433,7 +385,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
||||
rv = checkword(wspace, info, root);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ALLCAP: {
|
||||
*info += SPELL_ORIGCAP;
|
||||
rv = checkword(cw, info, root);
|
||||
@ -457,7 +408,7 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
||||
*apostrophe = '\0';
|
||||
wl2 = u8_u16(tmpword, MAXWORDLEN, cw);
|
||||
*apostrophe = '\'';
|
||||
if (wl2 < nc) {
|
||||
if (wl2 >= 0 && wl2 < nc) {
|
||||
mkinitcap2(apostrophe + 1, unicw + wl2 + 1, nc - wl2 - 1);
|
||||
rv = checkword(cw, info, root);
|
||||
if (rv) break;
|
||||
@ -804,19 +755,28 @@ int Hunspell::suggest(char*** slst, const char * word)
|
||||
char * dot = strchr(cw, '.');
|
||||
if (dot && (dot > cw)) {
|
||||
int captype_;
|
||||
if (utf8) {
|
||||
if (utf8)
|
||||
{
|
||||
w_char w_[MAXWORDLEN];
|
||||
int wl_ = u8_u16(w_, MAXWORDLEN, dot + 1);
|
||||
captype_ = get_captype_utf8(w_, wl_, langnum);
|
||||
} else captype_ = get_captype(dot+1, strlen(dot+1), csconv);
|
||||
if (captype_ == INITCAP) {
|
||||
if (captype_ == INITCAP)
|
||||
{
|
||||
char * st = mystrdup(cw);
|
||||
if (st) st = (char *) realloc(st, wl + 2);
|
||||
if (st) {
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
if (st)
|
||||
{
|
||||
char *newst = (char *) realloc(st, wl + 2);
|
||||
if (newst == NULL)
|
||||
free(st);
|
||||
st = newst;
|
||||
}
|
||||
if (st)
|
||||
{
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -902,7 +862,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
||||
*pos = '\0';
|
||||
strcpy(w, (*slst)[j]);
|
||||
strcat(w, pos + 1);
|
||||
spell(w, &info, NULL);
|
||||
(void)spell(w, &info, NULL);
|
||||
if ((info & SPELL_COMPOUND) && (info & SPELL_FORBIDDEN)) {
|
||||
*pos = ' ';
|
||||
} else *pos = '-';
|
||||
@ -1724,6 +1684,13 @@ int Hunspell::get_langnum() const
|
||||
return langnum;
|
||||
}
|
||||
|
||||
int Hunspell::input_conv(const char * word, char * dest)
|
||||
{
|
||||
RepList * rl = (pAMgr) ? pAMgr->get_iconvtable() : NULL;
|
||||
return (rl && rl->conv(word, dest));
|
||||
}
|
||||
|
||||
|
||||
// return the beginning of the element (attr == NULL) or the attribute
|
||||
const char * Hunspell::get_xml_pos(const char * s, const char * attr)
|
||||
{
|
||||
@ -1748,11 +1715,11 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
||||
int n = 0;
|
||||
char * p;
|
||||
if (!list) return 0;
|
||||
for (p = list; (p = strstr(p, tag)); p++) n++;
|
||||
for (p = list; ((p = strstr(p, tag)) != NULL); p++) n++;
|
||||
if (n == 0) return 0;
|
||||
*slst = (char **) malloc(sizeof(char *) * n);
|
||||
if (!*slst) return 0;
|
||||
for (p = list, n = 0; (p = strstr(p, tag)); p++, n++) {
|
||||
for (p = list, n = 0; ((p = strstr(p, tag)) != NULL); p++, n++) {
|
||||
int l = strlen(p);
|
||||
(*slst)[n] = (char *) malloc(l + 1);
|
||||
if (!(*slst)[n]) return n;
|
||||
@ -1764,6 +1731,19 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
||||
return n;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void myrep(std::string& str, const std::string& search, const std::string& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = str.find(search, pos)) != std::string::npos)
|
||||
{
|
||||
str.replace(pos, search.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Hunspell::spellml(char*** slst, const char * word)
|
||||
{
|
||||
char *q, *q2;
|
||||
@ -1775,26 +1755,26 @@ int Hunspell::spellml(char*** slst, const char * word)
|
||||
q2 = strstr(q2, "<word");
|
||||
if (!q2) return 0; // bad XML input
|
||||
if (check_xml_par(q, "type=", "analyze")) {
|
||||
int n = 0, s = 0;
|
||||
int n = 0;
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
|
||||
if (n == 0) return 0;
|
||||
// convert the result to <code><a>ana1</a><a>ana2</a></code> format
|
||||
for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
|
||||
char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&
|
||||
if (!r) return 0;
|
||||
strcpy(r, "<code>");
|
||||
std::string r;
|
||||
r.append("<code>");
|
||||
for (int i = 0; i < n; i++) {
|
||||
int l = strlen(r);
|
||||
strcpy(r + l, "<a>");
|
||||
strcpy(r + l + 3, (*slst)[i]);
|
||||
mystrrep(r + l + 3, "\t", " ");
|
||||
mystrrep(r + l + 3, "<", "<");
|
||||
mystrrep(r + l + 3, "&", "&");
|
||||
strcat(r, "</a>");
|
||||
r.append("<a>");
|
||||
|
||||
std::string entry((*slst)[i]);
|
||||
free((*slst)[i]);
|
||||
myrep(entry, "\t", " ");
|
||||
myrep(entry, "&", "&");
|
||||
myrep(entry, "<", "<");
|
||||
r.append(entry);
|
||||
|
||||
r.append("</a>");
|
||||
}
|
||||
strcat(r, "</code>");
|
||||
(*slst)[0] = r;
|
||||
r.append("</code>");
|
||||
(*slst)[0] = mystrdup(r.c_str());
|
||||
return 1;
|
||||
} else if (check_xml_par(q, "type=", "stem")) {
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);
|
||||
@ -1807,9 +1787,9 @@ int Hunspell::spellml(char*** slst, const char * word)
|
||||
return generate(slst, cw, cw2);
|
||||
}
|
||||
} else {
|
||||
if ((q2 = strstr(q2 + 1, "<code"))) {
|
||||
if ((q2 = strstr(q2 + 1, "<code")) != NULL) {
|
||||
char ** slst2;
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>"))) {
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>")) != 0) {
|
||||
int n2 = generate(slst, cw, slst2, n);
|
||||
freelist(&slst2, n);
|
||||
return uniqlist(*slst, n2);
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _MYSPELLMGR_H_
|
||||
#define _MYSPELLMGR_H_
|
||||
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include "hunvisapi.h"
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
@ -76,6 +19,10 @@
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunspell
|
||||
{
|
||||
private:
|
||||
Hunspell(const Hunspell&);
|
||||
Hunspell& operator = (const Hunspell&);
|
||||
private:
|
||||
AffixMgr* pAMgr;
|
||||
HashMgr* pHMgr[MAXDIC];
|
||||
int maxdic;
|
||||
@ -92,6 +39,11 @@ public:
|
||||
|
||||
/* Hunspell(aff, dic) - constructor of Hunspell class
|
||||
* input: path of affix file and dictionary file
|
||||
*
|
||||
* In WIN32 environment, use UTF-8 encoded paths started with the long path
|
||||
* prefix \\\\?\\ to handle system-independent character encoding and very
|
||||
* long path names (without the long path prefix Hunspell will use fopen()
|
||||
* with system-dependent character encoding instead of _wfopen()).
|
||||
*/
|
||||
|
||||
Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
|
||||
@ -188,6 +140,9 @@ public:
|
||||
const char * get_version();
|
||||
|
||||
int get_langnum() const;
|
||||
|
||||
/* need for putdic */
|
||||
int input_conv(const char * word, char * dest);
|
||||
|
||||
/* experimental and deprecated functions */
|
||||
|
||||
|
@ -1,36 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code is Caolan McNamara.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010 the
|
||||
* Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HUNSPELL_VISIBILITY_H_
|
||||
#define _HUNSPELL_VISIBILITY_H_
|
||||
|
||||
@ -42,7 +9,7 @@
|
||||
# else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
|
||||
# endif
|
||||
#elif BUILDING_LIBHUNSPELL && 1
|
||||
#elif defined(BUILDING_LIBHUNSPELL) && 1
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED
|
||||
|
@ -1,42 +1,9 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "hunzip.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define CODELEN 65536
|
||||
#define BASEBITREC 5000
|
||||
@ -51,15 +18,17 @@ int Hunzip::fail(const char * err, const char * par) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Hunzip::Hunzip(const char * file, const char * key) {
|
||||
bufsiz = 0;
|
||||
lastbit = 0;
|
||||
inc = 0;
|
||||
outc = 0;
|
||||
dec = NULL;
|
||||
fin = NULL;
|
||||
filename = (char *) malloc(strlen(file) + 1);
|
||||
if (filename) strcpy(filename, file);
|
||||
Hunzip::Hunzip(const char * file, const char * key)
|
||||
: fin(NULL)
|
||||
, bufsiz(0)
|
||||
, lastbit(0)
|
||||
, inc(0)
|
||||
, inbits(0)
|
||||
, outc(0)
|
||||
, dec(NULL)
|
||||
{
|
||||
in[0] = out[0] = line[0] = '\0';
|
||||
filename = mystrdup(file);
|
||||
if (getcode(key) == -1) bufsiz = -1;
|
||||
else bufsiz = getbuf();
|
||||
}
|
||||
@ -72,7 +41,7 @@ int Hunzip::getcode(const char * key) {
|
||||
|
||||
if (!filename) return -1;
|
||||
|
||||
fin = fopen(filename, "rb");
|
||||
fin = myfopen(filename, "rb");
|
||||
if (!fin) return -1;
|
||||
|
||||
// read magic number
|
||||
|
@ -1,36 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* hunzip: file decompression for sorted dictionaries with optional encryption,
|
||||
* algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
|
||||
|
||||
#ifndef _HUNZIP_HXX_
|
||||
#define _HUNZIP_HXX_
|
||||
@ -54,7 +23,9 @@ struct bit {
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunzip
|
||||
{
|
||||
|
||||
private:
|
||||
Hunzip(const Hunzip&);
|
||||
Hunzip& operator = (const Hunzip&);
|
||||
protected:
|
||||
char * filename;
|
||||
FILE * fin;
|
||||
|
@ -1,59 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _LANGNUM_HXX_
|
||||
#define _LANGNUM_HXX_
|
||||
|
||||
|
61
extensions/spellcheck/hunspell/src/license.hunspell
Normal file
61
extensions/spellcheck/hunspell/src/license.hunspell
Normal file
@ -0,0 +1,61 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Hunspell, based on MySpell.
|
||||
*
|
||||
* The Initial Developers of the Original Code are
|
||||
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
|
||||
* Portions created by the Initial Developers are Copyright (C) 2002-2005
|
||||
* the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Einstein
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MOZILLA_CLIENT
|
||||
# include "config.h"
|
||||
#endif
|
24
extensions/spellcheck/hunspell/src/patches/01-675553.diff
Executable file
24
extensions/spellcheck/hunspell/src/patches/01-675553.diff
Executable file
@ -0,0 +1,24 @@
|
||||
Bug 675553 - Switch from PRBool to bool.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5517,17 +5517,17 @@ struct cs_info * get_current_cs(const ch
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
- PRBool success = PR_FALSE;
|
||||
+ bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
24
extensions/spellcheck/hunspell/src/patches/02-690892.diff
Executable file
24
extensions/spellcheck/hunspell/src/patches/02-690892.diff
Executable file
@ -0,0 +1,24 @@
|
||||
Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5549,17 +5549,17 @@ struct cs_info * get_current_cs(const ch
|
||||
|
||||
uniCased = ToUpperCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &upper, &charLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
|
||||
- success = PR_TRUE;
|
||||
+ success = true;
|
||||
} while (0);
|
||||
|
||||
if (success) {
|
||||
ccs[i].cupper = upper;
|
||||
ccs[i].clower = lower;
|
||||
} else {
|
||||
ccs[i].cupper = i;
|
||||
ccs[i].clower = i;
|
25
extensions/spellcheck/hunspell/src/patches/03-clang.diff
Executable file
25
extensions/spellcheck/hunspell/src/patches/03-clang.diff
Executable file
@ -0,0 +1,25 @@
|
||||
Silence the warning about empty while body loop in clang.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.cxx b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
@@ -571,17 +571,18 @@ inline int SfxEntry::test_condition(cons
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
} else if (pos) {
|
||||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
- while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
+ while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
+ ;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
if (!pos) {
|
||||
i++;
|
||||
st--;
|
||||
}
|
||||
if (st < beg && p && *p != ']') return 0; // word <= condition
|
24
extensions/spellcheck/hunspell/src/patches/04-777292.diff
Executable file
24
extensions/spellcheck/hunspell/src/patches/04-777292.diff
Executable file
@ -0,0 +1,24 @@
|
||||
Bug 777292 - Change nsnull to nullptr.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5507,17 +5507,17 @@ struct cs_info * get_current_cs(const ch
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
- encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nsnull, '?');
|
||||
+ encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
24
extensions/spellcheck/hunspell/src/patches/05-579517.diff
Executable file
24
extensions/spellcheck/hunspell/src/patches/05-579517.diff
Executable file
@ -0,0 +1,24 @@
|
||||
Bug 579517 - Convert NSPR numeric types to stdint types.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5528,17 +5528,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
PRUnichar uni, uniCased;
|
||||
- PRInt32 charLength = 1, uniLength = 1;
|
||||
+ int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &lower, &charLength);
|
43
extensions/spellcheck/hunspell/src/patches/06-784776.diff
Executable file
43
extensions/spellcheck/hunspell/src/patches/06-784776.diff
Executable file
@ -0,0 +1,43 @@
|
||||
Bug 784776 - Don't assume NULL is numeric in Hunspell code.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.hxx b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
@@ -26,17 +26,17 @@ public:
|
||||
|
||||
PfxEntry(AffixMgr* pmgr, affentry* dp );
|
||||
~PfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_morph(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len,
|
||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
inline FLAG getFlag() { return aflag; }
|
||||
@@ -93,17 +93,17 @@ public:
|
||||
~SfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
|
||||
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
|
||||
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
struct hentry * get_next_homonym(struct hentry * he);
|
||||
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
|
||||
const FLAG cclass, const FLAG needflag);
|
||||
|
||||
|
62
extensions/spellcheck/hunspell/src/patches/07-927728.diff
Executable file
62
extensions/spellcheck/hunspell/src/patches/07-927728.diff
Executable file
@ -0,0 +1,62 @@
|
||||
Bug 927728 - Replace PRUnichar with char16_t.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5527,17 +5527,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
- PRUnichar uni, uniCased;
|
||||
+ char16_t uni, uniCased;
|
||||
int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
@@ -5680,17 +5680,17 @@ unsigned short unicodetoupper(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToUpperCase((PRUnichar) c);
|
||||
+ return ToUpperCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].cupper : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned short unicodetolower(unsigned short c, int langnum)
|
||||
{
|
||||
@@ -5698,17 +5698,17 @@ unsigned short unicodetolower(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToLowerCase((PRUnichar) c);
|
||||
+ return ToLowerCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].clower : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int unicodeisalpha(unsigned short c)
|
||||
{
|
71
extensions/spellcheck/hunspell/src/patches/08-943268.diff
Executable file
71
extensions/spellcheck/hunspell/src/patches/08-943268.diff
Executable file
@ -0,0 +1,71 @@
|
||||
Bug 943268 - Remove nsCharsetAlias and nsCharsetConverterManager.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -28,23 +28,22 @@ struct unicode_info {
|
||||
# ifndef MOZILLA_CLIENT
|
||||
# include "utf_info.cxx"
|
||||
# define UTF_LST_LEN (sizeof(utf_lst) / (sizeof(unicode_info)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nsCOMPtr.h"
|
||||
-#include "nsServiceManagerUtils.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
-#include "nsICharsetConverterManager.h"
|
||||
+#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
+using mozilla::dom::EncodingUtils;
|
||||
#endif
|
||||
|
||||
struct unicode_info2 {
|
||||
char cletter;
|
||||
unsigned short cupper;
|
||||
unsigned short clower;
|
||||
};
|
||||
|
||||
@@ -5500,32 +5499,27 @@ struct cs_info * get_current_cs(const ch
|
||||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
nsresult rv;
|
||||
- nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
- if (NS_FAILED(rv))
|
||||
+
|
||||
+ nsAutoCString label(es);
|
||||
+ nsAutoCString encoding;
|
||||
+ if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return ccs;
|
||||
-
|
||||
- rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
+ }
|
||||
+ encoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
+ decoder = EncodingUtils::DecoderForEncoding(encoding);
|
||||
encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
- rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
-
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
18
extensions/spellcheck/hunspell/src/patches/09-license.diff
Normal file
18
extensions/spellcheck/hunspell/src/patches/09-license.diff
Normal file
@ -0,0 +1,18 @@
|
||||
Don't include config.h in license.hunspell if MOZILLA_CLIENT is set.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/license.hunspell b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
--- a/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
+++ b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
@@ -51,9 +51,11 @@
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
-#include "config.h"
|
||||
+#ifndef MOZILLA_CLIENT
|
||||
+# include "config.h"
|
||||
+#endif
|
@ -1,48 +1,31 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-26 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-23 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell using C-like structs
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -104,7 +87,8 @@ int phonet (const char * inword, char * target,
|
||||
char word[MAXPHONETUTF8LEN + 1];
|
||||
if (len == -1) len = strlen(inword);
|
||||
if (len > MAXPHONETUTF8LEN) return 0;
|
||||
strcpy(word, inword);
|
||||
strncpy(word, inword, MAXPHONETUTF8LEN);
|
||||
word[MAXPHONETUTF8LEN] = '\0';
|
||||
|
||||
/** check word **/
|
||||
i = j = z = 0;
|
||||
|
@ -1,48 +1,31 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-20 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-22 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell by little modifications
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#ifndef __PHONETHXX__
|
||||
#define __PHONETHXX__
|
||||
|
@ -1,36 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1,37 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* string replacement list class */
|
||||
#ifndef _REPLIST_HXX_
|
||||
#define _REPLIST_HXX_
|
||||
@ -42,6 +8,9 @@
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED RepList
|
||||
{
|
||||
private:
|
||||
RepList(const RepList&);
|
||||
RepList& operator = (const RepList&);
|
||||
protected:
|
||||
replentry ** dat;
|
||||
int size;
|
||||
|
@ -1,59 +1,5 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -161,7 +107,10 @@ int SuggestMgr::testsug(char** wlst, const char * candidate, int wl, int ns, int
|
||||
int cwrd = 1;
|
||||
if (ns == maxSug) return maxSug;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
@ -418,8 +367,12 @@ int SuggestMgr::map_related(const char * word, char * candidate, int wn, int cn,
|
||||
int cwrd = 1;
|
||||
*(candidate + cn) = '\0';
|
||||
int wl = strlen(candidate);
|
||||
for (int m=0; m < ns; m++)
|
||||
if (strcmp(candidate, wlst[m]) == 0) cwrd = 0;
|
||||
for (int m=0; m < ns; m++) {
|
||||
if (strcmp(candidate, wlst[m]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
if (ns < maxSug) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
@ -732,7 +685,7 @@ int SuggestMgr::extrachar(char** wlst, const char * word, int ns, int cpdsuggest
|
||||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
|
||||
{
|
||||
char candidate[MAXSWUTF8L];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
@ -754,8 +707,8 @@ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge
|
||||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
|
||||
{
|
||||
w_char candidate_utf[MAXSWL];
|
||||
char candidate[MAXSWUTF8L];
|
||||
w_char candidate_utf[MAXSWL + 1];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
w_char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
@ -815,8 +768,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
||||
((c1 == 3) && (c2 >= 2)))) *p = '-';
|
||||
|
||||
cwrd = 1;
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
@ -831,8 +788,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
||||
mystrlen(p + 1) > 1 &&
|
||||
mystrlen(candidate) - mystrlen(p) > 1) {
|
||||
*p = '-';
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
@ -1387,7 +1348,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
||||
if ((!guessorig[i] && strstr(guess[i], wlst[j])) ||
|
||||
(guessorig[i] && strstr(guessorig[i], wlst[j])) ||
|
||||
// check forbidden words
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = guess[i];
|
||||
@ -1415,7 +1379,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
||||
// don't suggest previous suggestions or a previous suggestion with prefixes or affixes
|
||||
if (strstr(rootsphon[i], wlst[j]) ||
|
||||
// check forbidden words
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = mystrdup(rootsphon[i]);
|
||||
@ -1909,6 +1876,10 @@ int SuggestMgr::commoncharacterpositions(char * s1, const char * s2, int * is_sw
|
||||
w_char su2[MAXSWL];
|
||||
int l1 = u8_u16(su1, MAXSWL, s1);
|
||||
int l2 = u8_u16(su2, MAXSWL, s2);
|
||||
|
||||
if (l1 <= 0 || l2 <= 0)
|
||||
return 0;
|
||||
|
||||
// decapitalize dictionary word
|
||||
if (complexprefixes) {
|
||||
mkallsmall_utf(su2+l2-1, 1, langnum);
|
||||
|
@ -1,60 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _SUGGESTMGR_HXX_
|
||||
#define _SUGGESTMGR_HXX_
|
||||
|
||||
@ -89,6 +32,10 @@ enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
|
||||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SuggestMgr
|
||||
{
|
||||
private:
|
||||
SuggestMgr(const SuggestMgr&);
|
||||
SuggestMgr& operator = (const SuggestMgr&);
|
||||
private:
|
||||
char * ckey;
|
||||
int ckeyl;
|
||||
w_char * ckey_utf;
|
||||
|
@ -1,36 +1,3 @@
|
||||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __WCHARHXX__
|
||||
#define __WCHARHXX__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user