Update hunspell from 1.2.1 to 1.3.2

This commit is contained in:
Thomas Goyne 2012-10-08 12:20:19 -07:00
parent e4a6092b36
commit 93a567e800
58 changed files with 17753 additions and 5120 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ back into a single tree. David has been a significant help
in improving MySpell. in improving MySpell.
Németh László <nemethl@gyorsposta.hu> is the author of Németh László <nemethl@gyorsposta.hu> is the author of
the Hungarian dictionary and he developed and contributed the Hungarian dictionary and he developed and contributed
extensive changes to MySpell including ... extensive changes to MySpell including ...
* code to support compound words in MySpell * code to support compound words in MySpell

View File

@ -1,9 +1,5 @@
* Problems with UTF-8 flag support on ARM platform (fail reputf and maputf test) * Interactive interface has some visualization problem with long lines
* Interactive interface has some visualisation problem with UTF-8 characters * Experimental -U, -u options don't support Unicode.
* -U, -u options doesn't support Unicode. * Compound handling is not thread safe in Hungarian specific code.
* Compound handling is not thread safe in Hungarian specific code
* stemming is experimental and incomplete

View File

@ -1,3 +1,709 @@
2011-02-16 Németh László <nemeth at numbertext dot org>:
* src/*/Makefile.am: fix library versioning, the probem reported by
Rene Engerhald and Simon Brouwer.
* man/hunspell.4: new version based on the revised version of Ruud Baars
2011-02-02 Németh László <nemeth at OOo>:
* suggestngr.cxx: fix ngram PHONE suggestion for input words with
diacritics using UTF-8 encoded dictionaries (add byte length to the
8-bit phonet() argument instead of character length)
* suggestmgr.cxx: fix missing csconv problem with UTF-8 encoding
dictionares, when the input contains non-BMP characters
- tests/utf8_nonbmp.sug: test file
* suggestmgr.cxx: mixed and keyboard based character suggestions
don't forbid ngram suggestion search (optimized tests/suggestiontest)
* affixmgr.cxx: fix hun#2999225: interfering compounding mechanisms,
tested on Dutch word list and reported by Ruud Baars
* affixmgr.cxx: allomorph fix for hun#2970240 (Hungarian
compound "vadász+gép" was analyzed as vad+ász+gép, and rejected
by the ss->s rep rule (verb "vadássz"), but the analysis
didn't continue for the longer word parts (vadász+gép).
* csutil.cxx: add lang code "az_AZ", "hu_HU", "tr_TR" for back
compatibility (fixing Azeri and Turkish casing conversion, also
Hungarian compound handling)
* affixmgr.cxx: fix morphological analysis
2011-01-26 Németh László <nemeth at OOo>:
* affixmgr.cxx: fix for moz#626195 (memcheck problem with FULLSTRIP).
* affixmgr.*, suggestmgr.cxx: FORBIDWARN parameter (see manual)
2011-01-24 Németh László <nemeth at OOo>:
* suffixmgr.cxx: fix bad suggestion of forbidden compound words, eg.
"termijndoel" with the Dutch dictionary. Reported by Ruud Baars.
* latexparser.cxx: fix double apostrophe TeX quoation mark tokenization
(hun#3119776), reported by Wybodekker at SF.net.
* tests/suggestiontest/*: multilanguage and single Hunspell version, see README
* tests/suggestiontest/prepare2: for make -f Makefile.orig single
2011-01-22 Németh László <nemeth at OOo>:
* affixmgr.*, suggestmgr.*: new features
ONLYMAXDIFF: remove all bad ngram suggestions (default mode keeps one)
NONGRAMSUGGEST: similar to NOSUGGEST, but it forbids to use the word
in ngram based (more, than 1-character distance) suggestions.
2011-01-21 Németh László <nemeth at OOo>:
* suggestmgr.*: limit wild suggestions (hun#2970237 by Ruud Baars)
- limited compound word suggestions
- improved and limited ngram based suggestions
* tests/*.sug: modified test files
- feature MAXCPDSUGS:
MAXCPDSUGS 0 : no compound suggestion, suggested by
Finn Gruwier Larsen in hunfeat#2836033
MAXCPDSUGS n : max. ~n compound suggestions
- feature MAXDIFF: differency limit for ngram suggestions: 0-10
eg. MAXDIFF 5: normal (default) limit
MAXDIFF 0: only one ngram suggestion
MAXDIFF 10: ~maxngramsugs ngram suggestions
* affixmgr.*, hunspell.*: add flag FORCEUCASE (hun#2999228), force
capitalization of compound words, see Hunspell 4 manual),
suggested by Ruud Baars
test/forceucase.*: test files
* affixmgr.*, hunspell.*: add flag WARN (hun#1808861), optional warning feature
for rare words, suggested by Ruud Baars
tests/warn: test files
* tools/hunspell.cxx: add option -r for optional filtering of rare words
* affixmgr.cxx: fix hun#3161359 (gcc warnings) reported by Ryan VanderMeulen.
2011-01-17 Németh László <nemeth at OOo>:
* suggestmgr.cxx: fix hun#3158994 and hun#3159027 (missing csconv table
using awkward 8bit capitalization of UTF-8 encoded dictionary words with PHONE
suggestion, reported by benjarobin and dicollecte at SF.net).
2011-01-13 Németh László <nemeth at OOo>:
* affixmgr.cxx: ONLYINCOMPOUND fix for hun#2999224 (fogemorphene
was allowed in end position of compoundings). Reported by Ruud Baars.
* tests/onlyincompound2.*: test files
2011-01-10 Ingo H. de Boer <idb_winshell at SF.net>:
* win_api/{hunspell,libhunspell, testparser}.vcproj: updated project
files for the library and the executables. Compiling problem
also reported by Don Walker.
2011-01-06 Németh László <nemeth at OOo>:
* affixmgr.cxx: fix freedesktop#32850 (program halt during Hungarian
spell checking of the word "6csillagocska6", reported by András Tímár)
* tools/hunspell.cxx: add Mac OS X Hunspell dictionary paths, asked by
Vidar Gundersen in hunfeat#3142010
2011-01-05 Caolán McNamara <cmc at OOo>:
* moz#620626 NS_UNICHARUTIL_CID doesn't support
case conversion
2011-01-03 Németh László <nemeth at OOo>:
* NEWS and THANKS: update for release 1.2.13
2010-12-20 Németh László <nemeth at OOo>:
* affixmgr.cxx: hun#3140784
2010-12-16 Németh László <nemeth at OOo>:
* affixmgr.cxx:
- improved fix of hun#2970242 (supporting
zero affixes, reported by Ruud Baars
- tests/opentaal_cpdpat{,2}: test files
- switching off default BREAK parameters by BREAK 0,
reported by Ruud Baars
- hun#2999225: interfering compounding mechanisms, reported by Ruud Baars
2010-12-11 Németh László <nemeth at OOo>:
* affixmgr.cxx: fix hun#2970242 (CHECKCOMPOUNDPATTERN only with flags),
the bug reported by Ruud Baars
* tests/2970242.*: test files
* tests/2970240.*: test files for CHECKCOMPOUNDPATTERN fix (check all
boundaries in compound words, fixed by the previous CHECKCOMPOUNDREP
fix), the bug reported by Ruud Baars
* win_api/Makefile.cygwin: update
2010-12-09 Caolán McNamara <cmc at OOo>:
* moz#617953 fix leak
2010-11-08 Caolán McNamara <cmc at OOo>:
* rhbz#650503 crash in arabic dictionary
2010-11-05 Caolán McNamara <cmc at OOo>:
* rhbz#648740 don't warn on empty flagvector
2010-11-03 Caolán McNamara <cmc at OOo>:
* logically we shouldn't need a csconv table in utf-8 mode
2010-10-27 Németh László <nemeth at OOo>:
* hun#3000055 (requested by Ruud Baars) add REP boundary specifiation:
REP ^word$ xxxx
REP ^wordstarting xxxx
REP wordending$ xxxx
* hun#3008434 (requested by Adrián Chaves Fernández) and
hun#3018929 (requested by Ruud Baars): REP with more than 2 words:
REP morethantwo more_than_two
* suggestmgr.cxx: fix incomplete suggestion list for capitalized words,
eg. missing Machtstrijd->Machtsstrijd in the Dutch dictionary
(reported by Ruud Bars)
* tests, man: related updates
2010-10-12 Caolán McNamara <cmc at OOo>:
* moz#603311 HashMgr::load_tables leaks dict when decode_flags fails
* fix mem leak found with new tests
* hun#3084340 allow underscores in html entity names
2010-10-07 Németh László <nemeth at OOo>:
* affixmgr.cxx:
- hun#2970239 fix bad suggestion of forbidden compound words
- hun#2999224 fix keepcase feature on compound words (only partial
fix for COMPOUNDRULE based compounding)
- fix checkcompoundrep feature in compound words (check all boundaries,
not only the last one)
Problems reported by Ruud Baars.
* tests/opentaal_forbiddenword[12]*, tests/opentaal_keepcase*:
new test files for the previous fixes
* tests/checkcompoundrep: extended test file.
2010-09-05 Caolán McNamara <cmc at OOo>:
* moz#583582 fix double buffer gcc fortify issue
2010-08-13 Caolán McNamara <cmc at OOo>:
* moz#586671 AffixMgr::parse_convtable leaks pattern/pattern2 if it
can't create both
* moz#586686 tidy up get_xml_list and friends
2010-08-10 Caolán McNamara <cmc at OOo>:
* hun#3022860 fix remove duplicate code
2010-07-17 Caolán McNamara <cmc at OOo>:
* remove ununsed get_default_enc and avoid potential misrecognition of
three letter language ids
* normalize encoding names before lookup
2010-07-05 Caolán McNamara <cmc at OOo>:
* hun#2286060 add Hangul syllables to unicode tables
2010-06-26 Caolán McNamara <cmc at OOo>:
* moz#571728 keep new[]/delete[] wrappers in sync for embedded in moz
case
2010-06-13 Caolán McNamara <cmc at OOo>:
* moz#571728 keep new[]/delete[] wrappers in sync for embedded in moz
case
2010-06-02 Caolán McNamara <cmc at OOo>:
* moz#569611 compile cleanly under win64
2010-05-22 Caolán McNamara <cmc at OOo>:
* moz#525581 apply mozilla's current preferred get_current_cs impl
2010-05-17 Németh László <nemeth at OOo>:
* affixmgr.cxx: fix bad limitation of parenthesized flags at
COMPOUNDRULEs. Windows crash reported by Ruud Baars and Simon Brouwer.
2010-05-05 Caolán McNamara <cmc at OOo>:
* rhbz#589326 malloc of int that should have been of char**
* hun#2997388 fix ironic misspellings
2010-04-28 Caolán McNamara <cmc at OOo>:
* moz#550942 get_xml_list doesn't handle failure from get_xml_par
2010-04-27 Caolán McNamara <cmc at OOo>:
* moz#465612 mozilla-specific code leaks
* moz#430900 phone is dereferenced before oom check
* moz#418348 ckey_utf alloc is used unchecked in SuggestMgr::badcharkey_utf
* CID#1487 pointer "rl" dereferenced before NULL check
* CID#1464 Returned without freeing storage "ptr"
* CID#1459 Avoid duplicate strchr
* CID#1443 Avoid any chance of dereferencing *slst
* CID#1442 Unsafe to have a null morph
* CID#1440 Avoid null filenames
* CID#1302 Dereferencing NULL value "apostrophe"
* CID#1441 Avoid deferencing null ppfx
2010-04-16 Caolán McNamara <cmc at OOo>:
* hun#2344123 fix U)ncap in utf-8 locale
* fix up hunspell text UI and lines wider than terminal
2010-04-15 Caolán McNamara <cmc at OOo>:
* hun#2613701 fix small leak in FileMgr::FileMgr
* fix small leak in tools/hunspell
* hun#2871300 avoid crash if def and words are NULL
* hun#2904479 fix length of hzip file
* hun#2986756 mingw build fix
* hun#2986756 fix double-free
* hun#2059896 fix crash in interactive mode without nls
* hun#2917914 add some extra words to the latexparser
* make some structs static
* C-api has duped symbol names
* regenerate gettext/intl with recent version
* hun#2796772 build a .dll under MinGW
* rhbz#502387 allow cross-compiling for MinGW target
* hun#2467643 update .vcproj files to include replist.?xx
* unify visiblity/dll_export support across platforms
* hun#2831289 sizeof(short) typo
* hun#2986756 add -u3 gcc style output
2010-04-14 Caolán McNamara <cmc at OOo>:
* hun#2813804 fix segfault on hu_HU stemming
2010-04-13 Caolán McNamara <cmc at OOo>:
* hun#2806689 fix ironic misspellings
* hun#2836240 add Italian translations
2010-04-09 Caolán McNamara <cmc at OOo>:
* fix titchy possible leak in command-line spellchecker
2010-04-07 Caolán McNamara <cmc at OOo>:
* hun#2973827 apply win64 patch
* hun#2005643 fix broken mystrdup
2010-03-04 Caolán McNamara <cmc at OOo>:
* ooo#107768 fix crash in long strings in spellml mode
* hun#1999737 add some malloc checks
* hun#1999769 drop old buffer on realloc failure
* hun#2005643 tidy string functions
* hun#2005643 micro-opt
* hun#2006077 free strings on failed dict parse
* hun#2110783 ispell-alike verbose mode implementation
2010-03-03 Németh László <nemeth at OOo>:
* hunspell/(affixmgr, suggestmgr).cxx: add character sequence
support for MAP suggestion, using parenthesized character groups
in the syntax, eg. MAP ß(ss).
* man/hunspell.4, tests/map*: documentation and test files
2010-02-25 Németh László <nemeth at OOo>:
* hunspell/hunspell.cxx: add recursion limit for BREAK (fix OOo Issue 106267)
* hunspell/hunspell.cxx: fix crash in morphological analysis of
capitalized words with ending dashes
* affixmgr.cxx: fix morphological analysis of long numbers combined with dash,
eg. 45-00000045 (reported by a@freeblog.hu).
2010-02-23 Caolán McNamara <cmc at OOo>:
* hun#2314461 improve ispell-alike mode
* hun#2784983 improve default language detection
* hun#2812045 fix some compiler warnings
* hun#2910695 survive missing HOME dir
* hun#2934195 fix suggestmgr crash
* hun#2921129 remove unused variables
* hun#2826164 make sure make check uses the in-tree libhunspell
* bump toolchain to support --disable-rpath
* hun#2843984 fix coverity warning
* hun#2843986 fix coverity warning
* hun#2077630 add iconv lib
* make gcc strict-aliasing warning free
* make cppcheck warning free
2008-11-01 Németh László <nemeth at OOo>:
* replist.*, hunspell.cxx, affixmgr.cxx: new input and output
conversion support, see ICONV and OCONV keywords in the Hunspell(4)
manual page and the test examples. The input/output conversion
problem of syllabic languages reported by Daniel Yacob and
Shewangizaw Gulilat.
- tests/{iconv,oconv}.*: test examples
* tools/wordforms: word generation script for dictionary developers
(Hunspell version of the unmunch program)
* hunspell/hunspell.cxx: extended BREAK feature: ^ and $ mean in break
patterns the beginning and end of the word.
- tests/BREAK.*: modified examples.
* hunspell/hunspell.cxx: set default break at hyphen characters.
The associated problem reported by S Page in Hunspell Bug 2174061.
See Mozilla Bug ID 355178 and OOo Issue 64400, too.
- tests/breakdefault.*: test data
The following definition is equivalent of the default word break:
BREAK 3
BREAK -
BREAK ^-
BREAK -$
* affixmgr.cxx: SIMPLIFIEDTRIPLE is a new affix file keyword to allow
simplified forms of the compound words with triple repeating letters.
It is useful for Swedish and Norwegian languages.
* affixmgr.cxx: extend CHECKCOMPOUNDPATTERN to support
alternations of compound words for example by sandhi
feature of Indian and other languages. The problem reported
by Kiran Chittella associated with Telugu writing system
(see Telugu example in tests/checkcompoundpattern4.test).
The new optional field of CHECKCOMPOUNDPATTERN definition is the
replacement of the compound boundary defined by the previous fields:
CHECKCOMPOUNDPATTERN ff f ff
means ff|f compound boundary has been replaced by "ff", like in
the (prereform) German Schiffahrt (Schiff+fahrt).
- CHECKCOMPOUNDPATTERN supports also optional flag conditions now:
CHECKCOMPOUNDPATTERN ff/A f/B ff
means that the first word of the compound needs flag "A" and
the second word of the compound needs flag "B" to the operation.
* tools/hunspell.cxx: add empty lines as separators to the output of
the stemming and morphological analysis.
* affixmgr.cxx: fix condition checking algorithm. Bad suggestion
generation reported by Mehmet Akin in SF.net Bug 2124186 with help of
Eleonora Goldman.
* affixmgr,cxx: fix COMPOUNDWORDMAX feature. The problem and its
code details reported by Göran Andersson under SF.net Bug ID 2138001.
* csutil.cxx: fix bad conditional code for Mozilla compilation.
Patch by Serge Gautherie. The problem reported by Ryan VanderMeulen.
* hunspell/hunspell.cxx: add missing ngram suggestion for HUHINITCAP
(capitalized mixed case) words.
* w_char.hxx: use GCC conditions for GCC related code. Patch by
Ryan VanderMeulen.
* affixmgr.cxx: check morphological description in morphgen()
(fix potential program fault by incomplete morphological
description of affix rules)
* src/win_api: config.h: switch on warning messages on Windows
* tools/affixcompress: extended help for -h (use LC_ALL=C sort
for input word list)
* man/hunspell.4: updated manual:
- new and modified features (SIMPLIFIEDTRIPLE, ICONV, OCONV,
BREAK, CHECKCOMPOUNDPATTERN).
- note about costs of zero affixes, suggested by Olivier Ronez.
* hunspell/hunspell.cxx: remove deprecated word breaking codes.
2008-08-15 Németh László <nemeth at OOo>:
* affentry.cxx: add FULLSTRIP option. With FULLSTRIP, affix rules can
strip full words, not only one less characters. Suggested by
Davide Prina and other developers in OOo Issue 80145.
* tests/fullstrip.*: Test data based on Davide Prina's example.
* tools/unmunch.cxx: modified for FULLSTRIP.
* affixmgr.cxx: COMPOUNDRULE now works with long and numerical flag
types by parenthesized flags. Syntax: (flag)*, (flag)(flag)?(flag)*.
* tests/compoundrule[78].*: tests with parenthesized COMPOUNDRULE
definitions.
* suggestmgr.cxx: modified badchar*(), forgotchar*() and extrachar*()
1-character distance suggestion algorithms: search a TRY character
in all position instead of all TRY characters in a character position
(it can give more readable suggestion order, also better suggestions
in the first positions, when TRY characters are sorted by frequency.)
For example, suggestions for "moze":
ooze, doze, Roze, maze, more etc. (Hunspell 1.2.6),
maze, more, mote, ooze, mole etc. (Hunspell 1.2.7).
* suggestmgr.cxx: extended compound word checking for better COMPOUNDRULE
related suggestions, for example English ordinal numbers: 121323th ->
121323rd (it needs also a th->rd REP definition).
* phonet.cxx: cast unsigned char parameter of isdigit() and fix
isalpha by myisalpha() (potential problems in Windows environment).
Reported by Thomas Lange in OOo Issue 92736.
* hunspell/csutil.*,hunspell/{affentry,affixmgr,hunspell,suggestmgr}.cxx:
fix potential buffer overloading under morphological analysis by the
new mystrcat() function. Reported by Molnár Andor (dolhpy at true
dot hu) in SF.net Bug 2026203.
* affixmgr.cxx: add recursion limit to defcpd(). Fix OOo Issue 76067:
crash-like deceleration by checking hexadecimal numbers with long FFF
sequence (combinatory explosion by the en_US words "f" and "ff").
Missing fix reported by Mathias Bauer.
* affixmgr.cxx: fix the difference in the Unicode and non-Unicode
parts of cpdcase_check(). Bug report by Brett Wilson.
* filemgr.*, affixmgr.cxx, csutil.*, hashmgr.*: warning messages now
contain line numbers (use --with-warnings configure option for
warning messages).
* hunspell.cxx: analyze(): fix case conversion of stemming and
morphological analysis of UTF-8 encoded input. Reported by Ferenc Godó.
* tools/hunspell.cxx: fix LaTeX Unicode support in filter mode.
Reported by Jan Seeger in SF.net Bug 2039990.
* affixmgr.hxx: 0.5 or in 64 bit environment, 1 MB (virtual) memory
saving using only the requested size for sFlag and pFlag arrays.
Bug report by Brett Wilson.
* affixmgr.cxx,tools/hunspell.cxx: get_version() returns with full
VERSION affix parameter instead of its first word. Fixes for
Hunspell's header. Some problems with Hunspell header reported in
SF.net Bug 2043080.
2008-07-15 Németh László <nemeth at OOo>:
* affentry.cxx: fixes of the affix rule matching algorithm (affected
only the sk_SK dictionary from all OpenOffice.org dictionaries):
- fix dot pattern + accented letters matching (in non Unicode encoding)
- word-length conditions work again
* tests/condition.*: extended test for the fix.
* hashmgr.cxx: load multiword expressions: spaces may be parts
of the dictionary words again (but spaces also work as morphological
field separators: word word2 -> "word word2", word po:noun -> "word").
* man/hunspell.4: updated manual
* tools/hunspell.cxx: add iconv character conversion support to
stemming and morphological analysis
* tools/hunspell.cxx: add /usr/share/myspell/dicts search path for
Ubuntu support
2008-07-09 Németh László <nemeth at OOo>:
* affentry.cxx: fixes of the affix rule matching algorithm:
- right ASCII character handling in bracket expression;
- fault-tolerant nextchar() for bad rules.
Problem with the en_GB dictionary and nextchar() with a detailed
code analysis reported by John Winters in SF.net Bug ID 2012753.
* tests/condition.*: extended test for the fix.
* hunspell/hunspell.*, parsers/*, tools/hunspell.cxx: fix compiler
warnings (deprecated const-free char consts)
* win_api/hunspelldll.*: add hunspell_free_list(), the problem
reported by Laurier Mercer.
2008-06-30 Török László <torok_laszlo at users dot SF dot net>:
* tests/affixmgr.cxx: fix morphological analysis: strcat() on
an uninitialized char array in suffix_check_morph().
2008-06-18 Németh László <nemeth at OOo>:
* src/hunspell/affixmgr.cxx: fix GCC compiler warnings
(comparisons with string literal results in unspecified behaviour).
The problem reported by Ladislav Michnovič.
2008-06-17 Németh László <nemeth at OOo>:
* src/hunspell/{hunspell.cxx,hunspell.h}: add free_list() to the C and
C++ interface to deallocate suggestion lists. The problem
reported by Laurie Mercer and Christophe Paris.
* csutil.cxx: fix freelist() to deallocate non-NULL list, when n = 0.
* tools/{analyze,example,chmorph,hunspell}.cxx: use free_list().
* tools/hunspell.cxx: fix only --with-readline compiling problem.
Reported by Volkov Peter in SF.net Bug 1995842.
* man/hunspell.3,hunspell.hxx: fix analyze and generate examples in
the manual and comments (using char*** parameter instead of char**).
* tools/example.cxx: fix suggestion example.
2008-06-17 Németh László <nemeth at OOo>:
* affentry.cxx: fix the new affix rule matching algorithm of
Hunspell 1.2. Arabic dictionary problem reported by Khaled Hosny
in SF.net Bug ID 1975530. Mohamed Kebdani also sent a
prepared test data.
* tests/{1975530,condition*}: tests for the fix
2008-06-13 Ingo H. de Boer <idb_winshell at SF.net>:
* src/hunspell/{affixmgr.cxx,hunspell.cxx}: add missing type
cast to strstr() calls for VC8 compatibility.
2008-06-13 Németh László <nemeth at OOo>:
* suggestmgr.cxx: add also part1-part2 suggestion with dash
for bad part1part2 word forms, suggested by Ruud Baars.
For example, now suggestion of "parttime": "part time"
and "part-time".
NOTE: this feature will work only when the TRY definition
contains "-" or the letter "a".
* hunspell.cxx: new XML API in spell() and suggest() (see hunspell(3)).
* src/hunspell/*: fixes for OpenOffice.org build environment.
* man/{hunspell.3,hzip.1,hunzip.1}: add new manual pages for
Hunspell programming API and dictionary compression and
encryption utilities.
* src/hunspell/*: handle failed mystrdup() calls and other potential
insufficient memory problems. The problem reported by Elio Voci
in OpenOffice.org Issue 90604 and others.
* src/tools/affixmgr.cxx: restore original behaviour of get_wordchars
without conditional code. Problem reported by Ingo H. de Boer
in SF.net Bug 1763105.
* win_api/hunspelldll.h: put_word() renamed to add() in the (old)
Windows DLL API bug reported in SF.net Bug 1943236. Also reported
by Bartkó Zoltán.
* tools/hunspell.cxx: fix chench() for environments without
native language support (ENABLE_NLS 0 in config.h),
PHP system_exec() bug reported by Michel Weimerskirch in
SF.net Bug 1951087.
* hunspell.cxx, affixmgr.cxx: remove "result" from the
(result && *result) conditions, when "result" is a static variable.
The problem and a possible solution reported by Ladislav Michnovič.
* affixmgr.cxx: parse_affix(): print line instead of NULL in
the warning message, when affix class header is bad.
The problem reported by Ladislav Michnovič.
2008-06-01 Christian Lohmaier <cloph at OOo>
* configure.ac: patch to fix --with-readline, --with-ui logic.
Reported in the SF.net Bug 981395.
2008-05-04: Volkov Peter <volkov_peter at users sourceforge net>
* configure.ac: fix LibTool 2.22 incompatibility by removing
unused LT_* macros. Report and patch in SF.net Bug 1957383.
The problem reported and fixed by Ladislav Michnovič, too.
2008-04-23: Ladislav Michnovič <lmichnovic at suse cz>
* hunspell.pc.in: fix wrongly set directories.
2008-04-12 Németh László <nemeth at OOo>:
* src/tools/hunspell.cxx:
- Multilingual spell checking and special dictionary support with -d.
Multilingual spell checking suggested by Khaled Hosny (SF.net
Bug 1834280). Example for the new syntax:
-d en_US,en_geo,en_med,de_DE,de_med
en_US and de_DE are base dictionaries, and en_geo, en_med, de_med
are special dictionaries (dictionaries without affix file).
Special dictionaries are optional extension of the base dictionaries.
There is no explicit naming convention for special dictionaries,
only the ".dic" extension: dictionaries without affix file will
be an extension of the preceding base dictionary. First dictionary
in -d parameter must have an affix file (it must be a base
dictionary).
- new options for debugging, morphological analysis and stemming:
-m: morphological analysis or flag debug mode (without affix
rule data it signs the flag of the affix rules)
-s: stemming mode
-D: show also available dictionaries and search path
(suggested by Aaron Digulla in SF.net Bug 1902133)
- add missing refresh() to print bad words before the slower suggestion
search in UI (better user experience)
- fix tabulator problems (reported by ugli-kid-joe AT sf DOT net)
- fix different encoding of dic and input, and suggestions
- add per mille sign to LANG hu_HU section.
- rewrite program messages. Concatenating multiple printfs for
easier translation suggested by András Tímár and Gábor Kelemen.
* src/hunspell/csutil.cxx: set static encds variable. Patch by
Rene Engerhald. SF.net Bug 1896207 and 1939988.
* src/hunspell/w_char.hxx,csutil.hxx: reorganizing
w_char typedef and HENTRY_DATA, HENTRY_FIND consts
* src/hunspell/hunzip.cxx: fopen(): using rb options instead of r (fix
for Windows)
* src/tools/affixmgr.cxx: restore original behaviour of get_wordchars
in an #ifdef WINSHELL section. Problem reported by Ingo H. de Boer
in SF.net Bug 1763105.
* src/tools/chmorph.cxx: remove the experimental modifications
* src/tools/hzip.c: fopen(): using wb options instead of w (fix
for Windows)
* src/tools/hunzip.cxx: add missing MOZILLA_CLIENT. Reported
by Ryan VanderMeulen.
* man/*, man/hu/*: updated manual
* man/hunspell.4: fix formatting problem (missing header)
* tools/makealias: now works with the extra data fields.
* phonet.cxx: use HASHSIZE const
* tests/rep.aff: fix REP count
* src/win_api/Makefile.cygwin, README: native Windows compilation
in Cygwin environment without cygwin1.dll dependency (see README
for compiling instructions).
2008-04-08 Roland Smith <rsmith AT xs4all DOT nl>:
* src/parsers/latexparser.cxx: fix PATTERN_LEN for AMD64 and
other platforms with different struct padding (SF.net Bug 1937995).
2008-04-03 Kelemen Gábor <kelemeng AT gnome DOT hu>:
* po/POTFILES.in: fix path of the source file
* po/Makevars: add --from-code=UTF-8 gettext option
* hunspell.cxx: add comments for shortkey translation
2008-02-04 Flemming Frandsen <flfr AT stibo DOT com>
* src/hunspell.h: fix Windows DLL support
- this patch also reported by Zoltán Bartkó.
2008-01-30 Mark McClain <marc_mcclain AT users DOT sf DOT net>
* src/hunspell.cxx: stem(): fix function call side effect
for PPC platform (SF.net Bug 1882105).
2008-01-30 Németh László <nemeth at OOo>:
* hunspell.cxx, csutil.cxx, hunspelldll.c: fix
SF.et Bug 1851246, patch also by Ingo H. de Boer.
* hunspell.h: fix SF.net Bug 1856572 (C prototype problem),
patch by Mark de Does.
* hunspell.pc.in: fix SF.net Bug 1857450 wrong prefix, reported
by Mark de Does.
* hunspell.pc.in: reset numbering scheme: libhunspell-1.2.
Fix SF.net Bug 1857512 reported by Mark de Does,
also by Rene Engelhard.
* csutil.cxx: patches for ARM platform, signed_chars.dpatch
by Rene Engelhard and arm_structure_alignment.dpatch by
Steinar H. Gunderson <sesse@debian.org>
* hunzip.*, hzip.c: new hzip compression format
* tools/affixcompressor: affix compressor utility (similar to
munch, but it generates affix table automatically), works
with million-words dictionaries of agglutinative languages.
* README: fix problems reported by Pham Ngoc Khanh.
* csutil.cxx, suggestmgr: Warning-free in OOo builds.
* hashmgr.*, csutil.*: fix protected memory problems with
stored pointers on several not x86 platforms by
store_pointer(), get_stored_pointer().
* src/tools/hunspell.cxx: fix iconv support on Solaris platform.
* tests/IJ.good: add missing test file
* csutil.cxx: fix const char* related errors. Compiling bug
with Visual C++ reported by Ryan VanderMeulen and Ingo H. de Boer.
2008-01-03 Caolan McNamara <cmc at OO.o>:
* csutil.cxx: SF.net Bug 1863239, notrailingcomma patch and
optimization of get_currect_cs().
2007-11-01 Németh László <nemeth at OOo>: 2007-11-01 Németh László <nemeth at OOo>:
* hunspell/*: new feature: morphological generation, * hunspell/*: new feature: morphological generation,
also fix experimental morphological analysis and stemming. also fix experimental morphological analysis and stemming.
@ -57,7 +763,7 @@
2007-09-05 Németh László <nemeth at OOo>: 2007-09-05 Németh László <nemeth at OOo>:
* win_api/Hunspell.vproj, parsers/testparser.cxx,textparser.hxx: * win_api/Hunspell.vproj, parsers/testparser.cxx,textparser.hxx:
warning fixes and removing unnecessary Windows project file. warning fixes and removing unnecessary Windows project file.
Reported by Ingo H. De Boer. Reported by Ingo H. de Boer.
* hashmgr.*, {affixmgr,suggestmgr}.cxx: optimized data structure * hashmgr.*, {affixmgr,suggestmgr}.cxx: optimized data structure
for variable-count fields (only "ph" transliteration field in for variable-count fields (only "ph" transliteration field in
@ -93,7 +799,7 @@ Marseille ph:maarsayl
* suggestmgr.cxx: fix twowords() for last UTF-8 multibyte character. * suggestmgr.cxx: fix twowords() for last UTF-8 multibyte character.
(conditional jump or move depended on uninitialised value). (conditional jump or move depended on uninitialised value).
2007-08-29 Ingo H. De Boer <idb_winshell at SF.net>: 2007-08-29 Ingo H. de Boer <idb_winshell at SF.net>:
* win_api/{hunspell,libhunspell, testparser}.vcproj: new project * win_api/{hunspell,libhunspell, testparser}.vcproj: new project
files for the library and the executables. files for the library and the executables.
@ -101,26 +807,26 @@ Marseille ph:maarsayl
Version number problem also reported by András Tímár. Version number problem also reported by András Tímár.
2007-08-27 Németh László <nemeth at OOo>: 2007-08-27 Németh László <nemeth at OOo>:
* suggestmgr.hxx: put fixed version. Bug report by Ingo H. De Boer. * suggestmgr.hxx: put fixed version. Bug report by Ingo H. de Boer.
* suggestmgr.cxx: remove variable-length local character array * suggestmgr.cxx: remove variable-length local character array
reported by Ingo H. De Boer. reported by Ingo H. de Boer.
2007-08-27 Németh László <nemeth at OOo>: 2007-08-27 Németh László <nemeth at OOo>:
* suggestmgr.hxx: change bad time_t to clock_t in header, too. * suggestmgr.hxx: change bad time_t to clock_t in header, too.
Bug reports or patches by Ingo H. De Boer under SF.net Bug reports or patches by Ingo H. de Boer under SF.net
Bug ID 1781951, János Mohácsi and Gábor Zahemszky, András Tímár, Bug ID 1781951, János Mohácsi and Gábor Zahemszky, András Tímár,
OMax3 at SF.net under SF.net Bug ID 1781592. OMax3 at SF.net under SF.net Bug ID 1781592.
* phonet.*: change variable-length local character array to * phonet.*: change variable-length local character array to
portable fixed size character array. Problem reported by portable fixed size character array. Problem reported by
Ingo H. De Boer under SF.net Bug ID 1781951 and Ingo H. de Boer under SF.net Bug ID 1781951 and
Ryan VanderMeulen. Ryan VanderMeulen.
* suggestmgr.cxx: remove debug message (also by * suggestmgr.cxx: remove debug message (also by
Ingo H. De Boer). Ingo H. de Boer).
2007-08-26 Ingo H. De Boer <idb_winshell at SF.net>: 2007-08-26 Ingo H. de Boer <idb_winshell at SF.net>:
* win_api/Hunspell.vcproj: updated version (with phonet.*) * win_api/Hunspell.vcproj: updated version (with phonet.*)
2007-08-23 Németh László <nemeth at OOo>: 2007-08-23 Németh László <nemeth at OOo>:
@ -209,7 +915,7 @@ Marseille ph:maarsayl
will be recognised with affixes of Simpson (Foo's etc.)." will be recognised with affixes of Simpson (Foo's etc.)."
2007-07-18 Németh László <nemeth at OOo>: 2007-07-18 Németh László <nemeth at OOo>:
* src/win_api/: add missing resource files, reported by Ingo H. De Boer. * src/win_api/: add missing resource files, reported by Ingo H. de Boer.
2007-07-16 Németh László <nemeth at OOo>: 2007-07-16 Németh László <nemeth at OOo>:
* hunspell.cxx: fix dot removing from UTF-8 encoded words in cleanword2() * hunspell.cxx: fix dot removing from UTF-8 encoded words in cleanword2()
@ -254,7 +960,7 @@ Marseille ph:maarsayl
* {dictmgr,csutil,hashmgr,suggestmgr}.cxx: check memory allocation. * {dictmgr,csutil,hashmgr,suggestmgr}.cxx: check memory allocation.
Sf.net Bug ID 1747507, based on the patch by Jose da Silva. Sf.net Bug ID 1747507, based on the patch by Jose da Silva.
2007-07-13 Ingo H. De Boer <idb_winshell at SF.net>: 2007-07-13 Ingo H. de Boer <idb_winshell at SF.net>:
* atypes.cxx: fix Visual C compatibility: Using * atypes.cxx: fix Visual C compatibility: Using
"HUNSPELL_WARNING(a,b,...} {}" macro instead of empty "X(a,b...)". "HUNSPELL_WARNING(a,b,...} {}" macro instead of empty "X(a,b...)".

View File

@ -1,3 +1,147 @@
2011-02-02: Hunspell 1.3.2 release:
- fix library versioning
- improved manual
2011-02-02: Hunspell 1.3.1 release:
- bug fixes
2011-01-26: Hunspell 1.2.15/1.3 release:
- new features: MAXDIFF, ONLYMAXDIFF, MAXCPDSUGS, FORBIDWARN, see manual
- bug fixes
2011-01-21:
- new features: FORCEUCASE and WARN, see manual
- new options: -r to filter potential mistakes (rare words
signed by flag WARN in the dictionary)
- limited and optimized suggestions
2011-01-06: Hunspell 1.2.14 release:
- bug fix
2011-01-03: Hunspell 1.2.13 release:
- bug fixes
- improved compound handling and
other improvements supported by OpenTaal Foundation, Netherlands
2010-07-15: Hunspell 1.2.12 release
2010-05-06: Hunspell 1.2.11 release:
- Maintenance release bug fixes
2010-04-30: Hunspell 1.2.10 release:
- Maintenance release bug fixes
2010-03-03: Hunspell 1.2.9 release:
- Maintenance release bug fixes and warnings
- MAP support for composed characters or character sequences
2008-11-01: Hunspell 1.2.8 release:
- Default BREAK feature and better hyphenated word suggestion to accept
and fix (compound) words with hyphen characters by spell checker
instead of by work breaking code of OpenOffice.org. With this feature
it's possible to accept hyphenated compound words, such as "scot-free",
where "scot" is not a correct English word.
- ICONV & OCONV: input and output conversion tables for optional character
handling or using special inner format. Example:
# Accepting de facto replacements of the Romanian comma acuted letters
SET UTF-8
ICONV 4
ICONV ş ș
ICONV ţ ț
ICONV Ş Ș
ICONV Ţ Ț
Typical usage of ICONV/OCONV is to manage an inner format for a segmental
writing system, like the Ethiopic script of the Amharic language.
- Extended CHECKCOMPOUNDPATTERN to handle conpound word alternations, like
sandhi feature of Telugu and other writing systems.
- SIMPLIFIEDTRIPLE compound word feature: allow simplified Swedish and
Norwegian compound word forms, like tillåta (till|låta) and
bussjåfør (buss|sjåfør)
- wordforms: word generator script for dictionary developers (Hunspell
version of unmunch).
- bug fixes
2008-08-15: Hunspell 1.2.7 release:
- FULLSTRIP: new option for affix handling. With FULLSTRIP, affix rules can
strip full words, not only one less characters.
- COMPOUNDRULE works with all flag types. (COMPOUNDRULE is for pattern
matching. For example, en_US dictionary of OpenOffice.org uses COMPOUNDRULE
for ordinal number recognition: 1st, 2nd, 11th, 12th, 22nd, 112th, 1000122nd
etc.).
- optimized suggestions:
- modified 1-character distance suggestion algorithms: search a TRY character
in all position instead of all TRY characters in a character position
(it can give more readable suggestion order, also better suggestions
in the first positions, when TRY characters are sorted by frequency.)
For example, suggestions for "moze":
ooze, doze, Roze, maze, more etc. (Hunspell 1.2.6),
maze, more, mote, ooze, mole etc. (Hunspell 1.2.7).
- extended compound word checking for better COMPOUNDRULE related
suggestions, for example English ordinal numbers: 121323th -> 121323rd
(it needs also a th->rd REP definition).
- bug fixes
2008-07-15: Hunspell 1.2.6 release:
- bug fix release (fix affix rule condition checking of sk_SK dictionary,
iconv support in stemming and morphological analysis of the Hunspell
utility, see also Changelog)
2008-07-09: Hunspell 1.2.5 release:
- bug fix release (fix affix rule condition checking of en_GB dictionary,
also morphological analysis by dictionaries with two-level suffixes)
2008-06-18: Hunspell 1.2.4-2 release:
- fix GCC compiler warnings
2008-06-17: Hunspell 1.2.4 release:
- add free_list() for C, C++ interfaces to deallocate suggestion lists
- bug fixes
2008-06-17: Hunspell 1.2.3 release:
- extended XML interface to use morphological functions by standard
spell checking interface, spell() and suggest(). See hunspell.3 manual page.
- default dash suggestions for compound words: newword-> new word and new-word
- new manual pages: hunspell.3, hzip.1, hunzip.1.
- bug fixes
2008-04-12: Hunspell 1.2.2 release:
- extended dictionary (dic file) support to use multiple base and
special dictionaries.
- new and improved options of command line hunspell:
-m: morphological analysis or flag debug mode (without affix
rule data it signs the flag of the affix rules)
-s: stemming mode
-D: list available dictionaries and search path
-d: support extra dictionaries by comma separated list. Example:
hunspell -d en_US,en_med,de_DE,de_med,de_geo UNESCO.txt
- forbidding in personal dictionary (with asterisk, / signs affixation)
- optional compressed dictionary format "hzip" for aff and dic files
usage:
hzip example.aff example.dic
mv example.aff example.dic /tmp
hunspell -d example
hunzip example.aff.hz >example.aff
hunzip example.dic.hz >example.dic
- new affix compression tool "affixcompress": compression tool for
large (millions of words) dictionaries.
- support encrypted dictionaries for closed OpenOffice.org extensions or
other commercial programs
- improved manual
- bug fixes
2007-11-01: Hunspell 1.2.1 release: 2007-11-01: Hunspell 1.2.1 release:
- new memory efficient condition checking algorithm for affix rules - new memory efficient condition checking algorithm for affix rules

View File

@ -15,7 +15,7 @@ Main features of Hunspell spell checker and morphological analyzer:
- Unicode support (affix rules work only with the first 65535 Unicode characters) - Unicode support (affix rules work only with the first 65535 Unicode characters)
- Morphological analysis (in custom item and arrangement style) - Morphological analysis (in custom item and arrangement style) and stemming
- Max. 65535 affix classes and twofold affix stripping (for agglutinative - Max. 65535 affix classes and twofold affix stripping (for agglutinative
languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.) languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
@ -30,8 +30,8 @@ Main features of Hunspell spell checker and morphological analyzer:
- Free software (LGPL, GPL, MPL tri-license) - Free software (LGPL, GPL, MPL tri-license)
Compiling Compiling on Unix/Linux
--------- -----------------------
./configure ./configure
make make
@ -39,9 +39,6 @@ make install
For dictionary development, use the --with-warnings option of configure. For dictionary development, use the --with-warnings option of configure.
For compiling morphological analyser and stemmer code and tools, use the
--with-experimental option of configure.
For interactive user interface of Hunspell executable, use the --with-ui option. For interactive user interface of Hunspell executable, use the --with-ui option.
The developer packages you need to compile Hunspell's interface: The developer packages you need to compile Hunspell's interface:
@ -58,6 +55,48 @@ locale and gettext (but you can also use the
Hunspell distribution uses new Autoconf (2.59) and Automake (1.9). 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
------- -------
@ -88,26 +127,34 @@ http://hunspell.sourceforge.net
Usage Usage
----- -----
The src/tools dictionary contains three executables. The src/tools dictionary contains ten executables after compiling
A spell checker with Ispell-like curses interface and Ispell (or some of them are in the src/win_api):
compatible pipe interface (hunspell) and two small example
program (hunmorph and hunstem). 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 After compiling and installing (see INSTALL) you can
run the Hunspell spell checker (compiled with user interface) run the Hunspell spell checker (compiled with user interface)
with a Hunspell or Myspell dictionary: with a Hunspell or Myspell dictionary:
hunspell -d en_UK text.txt hunspell -d en_US text.txt
or without interface: or without interface:
hunspell
hunspell -d en_UK -l <text.txt hunspell -d en_UK -l <text.txt
(Dictionaries consists of an affix and dictionary file.) Dictionaries consist of an affix and dictionary file, see tests/
or http://wiki.services.openoffice.org/wiki/Dictionaries.
Usage of Hunmorph morphological analyzer:
hunmorph en_UK.aff en_UK.dic input_file
Using Hunspell library with GCC Using Hunspell library with GCC
------------------------------- -------------------------------
@ -121,12 +168,12 @@ g++ -lhunspell example.cxx
Dictionaries Dictionaries
------------ ------------
Myspell dictionaries: Myspell & Hunspell dictionaries:
http://lingucomponent.openoffice.org/spell_dic.html http://wiki.services.openoffice.org/wiki/Dictionaries
Aspell dictionaries (need some conversion): Aspell dictionaries (need some conversion):
ftp://ftp.gnu.org/gnu/aspell/dict ftp://ftp.gnu.org/gnu/aspell/dict
Conversion steps: see relevant feature request at http://hunspell.sf.net. Conversion steps: see relevant feature request at http://hunspell.sf.net.
Németh László László Németh
nemeth at OOo nemeth at OOo

View File

@ -1,21 +1,31 @@
Many thanks to the following contributors and supporters: Many thanks to the following contributors and supporters:
Mehmet Akin
Göran Andersson
Lars Aronsson Lars Aronsson
Ruud Baars
Bartkó Zoltán
Mathias Bauer
Bencsáth Boldizsár Bencsáth Boldizsár
Bíró Árpád Bíró Árpád
Ingo H. de Boer Ingo H. de Boer
Simon Brouwer Simon Brouwer
Jeppe Bundsgaard Jeppe Bundsgaard
Ginn Chen Ginn Chen
Aaron Digulla
Dmitri Gabinski Dmitri Gabinski
Dvornik László Dvornik László
David Einstein David Einstein
Rene Engelhard Rene Engelhard
Frederik Fouvry Frederik Fouvry
Flemming Frandsen
Serge Gautherie
Marek Gleń
Gavins at OOo Gavins at OOo
Gefferth András Gefferth András
Godó Ferenc Godó Ferenc
Goldman Eleonóra Goldman Eleonóra
Steinar H. Gunderson
Halácsy Péter Halácsy Péter
Chris Halls Chris Halls
Khaled Hosny Khaled Hosny
@ -28,17 +38,26 @@ Jean-Christophe Helary
Kevin Hendricks Kevin Hendricks
Martin Hollmichel Martin Hollmichel
Pavel Janík Pavel Janík
John Winters
Mohamed Kebdani
Kelemen Gábor
Shewangizaw Gulilat
Kéménczy Kálmán Kéménczy Kálmán
Dan Kenigsberg Dan Kenigsberg
Pham Ngoc Khanh
Khiraly László Khiraly László
Koblinger Egmont Koblinger Egmont
Kornai András Kornai András
Tor Lillqvist Tor Lillqvist
Christian Lohmaier
Robert Longson Robert Longson
Marot at SF dot net Marot at SF dot net
Mark McClain
Caolan McNamara Caolan McNamara
Michael Meeks Michael Meeks
Moheb Mekhaiel Moheb Mekhaiel
Laurie Mercer
Ladislav Michnovič
Ellis Miller Ellis Miller
Giuseppe Modugno Giuseppe Modugno
János Mohácsi János Mohácsi
@ -47,25 +66,40 @@ Daniel Naber
Nagy Viktor Nagy Viktor
John Nisly John Nisly
Noll János Noll János
S Page
Christophe Paris
Malcolm Parsons
Sylvain Paschein
Volkov Peter
Bryan Petty Bryan Petty
Harri Pitkänen Harri Pitkänen
Davide Prina Davide Prina
Kevin F. Quinn Kevin F. Quinn
Erdal Ronahi Erdal Ronahi
Olivier Ronez
Bernhard Rosenkraenzer Bernhard Rosenkraenzer
Sarlós Tamás Sarlós Tamás
Thobias Schlemmer Thobias Schlemmer
Jan Seeger
Jose da Silva Jose da Silva
Paulo Ney de Souza
Roland Smith
Munzir Taha Munzir Taha
Timeless at bemail dot org
Tímár András Tímár András
Tonal at OOo Tonal at OOo
Török László
Trón Viktor Trón Viktor
Gianluca Turconi Gianluca Turconi
Ryan VanderMeulen Ryan VanderMeulen
Varga Dániel Varga Dániel
Elio Voci
Miha Vrhovnik Miha Vrhovnik
Martijn Wargers Martijn Wargers
Michel Weimerskirch
Brett Wilson
Friedel Wolff Friedel Wolff
Daniel Yacob
Gábor Zahemszky Gábor Zahemszky
Taha Zerrouki Taha Zerrouki
and others (see also AUTHORS.myspell) and others (see also AUTHORS.myspell)
@ -80,13 +114,17 @@ http://www.mokk.bme.hu
Hungarian Ministry of Informatics and Telecommunications Hungarian Ministry of Informatics and Telecommunications
IMEDIA Ltd. IMEDIA Kft.
http://www.imedia.hu http://www.imedia.hu
OpenOffice.org community OpenOffice.org community
http://www.openoffice.org http://www.openoffice.org
UHU-Linux Ltd. OpenTaal Foundation, Netherlands and
Dutch Language Union (Nederlandse Taalunie)
http://opentaal.org
UHU-Linux Kft.
Thanks, Thanks,

View File

@ -1,10 +0,0 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: hunspell
Description: Hunpell spellchecking library
Version: @VERSION@
Libs: -L${libdir} -lhunspell-@HUNSPELL_VERSION_MAJOR@.@HUNSPELL_VERSION_MINOR@
Cflags: -I${includedir}/hunspell

View File

@ -1,360 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2003-09-02.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1 +0,0 @@
SUBDIRS=hunspell parsers tools win_api

View File

@ -1,505 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSESLIB = @CURSESLIB@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
HUNSPELL_VERSION_MAJOR = @HUNSPELL_VERSION_MAJOR@
HUNSPELL_VERSION_MINOR = @HUNSPELL_VERSION_MINOR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
READLINELIB = @READLINELIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XFAILED = @XFAILED@
XGETTEXT = @XGETTEXT@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
SUBDIRS = hunspell parsers tools win_api
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
clean clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,15 +0,0 @@
libhunspell_la_LDFLAGS = -version-info 1:1:0
lib_LTLIBRARIES = libhunspell.la
libhunspell_includedir = $(includedir)/hunspell
libhunspell_la_SOURCES=affentry.cxx affixmgr.cxx csutil.cxx \
dictmgr.cxx hashmgr.cxx hunspell.cxx utf_info.cxx \
suggestmgr.cxx license.myspell license.hunspell \
phonet.cxx
libhunspell_include_HEADERS=affentry.hxx htypes.hxx affixmgr.hxx \
csutil.hxx hunspell.hxx atypes.hxx dictmgr.hxx hunspell.h \
suggestmgr.hxx baseaffix.hxx hashmgr.hxx langnum.hxx \
phonet.hxx
EXTRA_DIST=hunspell.dsp makefile.mk README

View File

@ -1,533 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/hunspell
DIST_COMMON = README $(libhunspell_include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(libhunspell_includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libhunspell_la_LIBADD =
am_libhunspell_la_OBJECTS = affentry.lo affixmgr.lo csutil.lo \
dictmgr.lo hashmgr.lo hunspell.lo utf_info.lo suggestmgr.lo \
phonet.lo
libhunspell_la_OBJECTS = $(am_libhunspell_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libhunspell_la_SOURCES)
DIST_SOURCES = $(libhunspell_la_SOURCES)
libhunspell_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(libhunspell_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSESLIB = @CURSESLIB@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
HUNSPELL_VERSION_MAJOR = @HUNSPELL_VERSION_MAJOR@
HUNSPELL_VERSION_MINOR = @HUNSPELL_VERSION_MINOR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
READLINELIB = @READLINELIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XFAILED = @XFAILED@
XGETTEXT = @XGETTEXT@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
libhunspell_la_LDFLAGS = -version-info 1:1:0
lib_LTLIBRARIES = libhunspell.la
libhunspell_includedir = $(includedir)/hunspell
libhunspell_la_SOURCES = affentry.cxx affixmgr.cxx csutil.cxx \
dictmgr.cxx hashmgr.cxx hunspell.cxx utf_info.cxx \
suggestmgr.cxx license.myspell license.hunspell \
phonet.cxx
libhunspell_include_HEADERS = affentry.hxx htypes.hxx affixmgr.hxx \
csutil.hxx hunspell.hxx atypes.hxx dictmgr.hxx hunspell.h \
suggestmgr.hxx baseaffix.hxx hashmgr.hxx langnum.hxx \
phonet.hxx
EXTRA_DIST = hunspell.dsp makefile.mk README
all: all-am
.SUFFIXES:
.SUFFIXES: .cxx .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/hunspell/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/hunspell/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libhunspell.la: $(libhunspell_la_OBJECTS) $(libhunspell_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libhunspell_la_LDFLAGS) $(libhunspell_la_OBJECTS) $(libhunspell_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affentry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affixmgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dictmgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashmgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hunspell.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phonet.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/suggestmgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf_info.Plo@am__quote@
.cxx.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cxx.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cxx.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-libhunspell_includeHEADERS: $(libhunspell_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libhunspell_includedir)" || $(mkdir_p) "$(DESTDIR)$(libhunspell_includedir)"
@list='$(libhunspell_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(libhunspell_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libhunspell_includedir)/$$f'"; \
$(libhunspell_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libhunspell_includedir)/$$f"; \
done
uninstall-libhunspell_includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libhunspell_include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libhunspell_includedir)/$$f'"; \
rm -f "$(DESTDIR)$(libhunspell_includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libhunspell_includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-libhunspell_includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
uninstall-libhunspell_includeHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-libhunspell_includeHEADERS \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am uninstall-libLTLIBRARIES \
uninstall-libhunspell_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,34 +1,20 @@
#include "license.hunspell" #include "license.hunspell"
#include "license.myspell" #include "license.myspell"
#ifndef MOZILLA_CLIENT
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cstdio>
#else
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#endif
#include "affentry.hxx" #include "affentry.hxx"
#include "csutil.hxx" #include "csutil.hxx"
#ifndef MOZILLA_CLIENT
#ifndef W32
using namespace std;
#endif
#endif
PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp) PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
{ {
// register affix manager // register affix manager
pmyMgr = pmgr; pmyMgr = pmgr;
// set up its intial values // set up its initial values
aflag = dp->aflag; // flag aflag = dp->aflag; // flag
strip = dp->strip; // string to strip strip = dp->strip; // string to strip
@ -69,7 +55,8 @@ char * PfxEntry::add(const char * word, int len)
{ {
char tword[MAXWORDUTF8LEN + 4]; char tword[MAXWORDUTF8LEN + 4];
if ((len > stripl) && (len >= numconds) && test_condition(word) && if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
(len >= numconds) && test_condition(word) &&
(!stripl || (strncmp(word, strip, stripl) == 0)) && (!stripl || (strncmp(word, strip, stripl) == 0)) &&
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) { ((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
/* we have a match so add prefix */ /* we have a match so add prefix */
@ -92,8 +79,9 @@ inline char * PfxEntry::nextchar(char * p) {
if (p == c.conds + MAXCONDLEN_1) return c.l.conds2; if (p == c.conds + MAXCONDLEN_1) return c.l.conds2;
// end of the MAXCONDLEN length condition // end of the MAXCONDLEN length condition
} else if (p == c.conds + MAXCONDLEN) return NULL; } else if (p == c.conds + MAXCONDLEN) return NULL;
return *p ? p : NULL;
} }
return p; return NULL;
} }
inline int PfxEntry::test_condition(const char * st) inline int PfxEntry::test_condition(const char * st)
@ -106,22 +94,27 @@ inline int PfxEntry::test_condition(const char * st)
while (1) { while (1) {
switch (*p) { switch (*p) {
case '\0': return 1; case '\0': return 1;
case '[': { p = nextchar(p); pos = st; break; } case '[': {
case '^': { p = nextchar(p); neg = true; break; }
case ']': { if ((neg && ingroup) || (!neg && !ingroup)) return 0;
pos = NULL;
neg = false; neg = false;
ingroup = false; ingroup = false;
p = nextchar(p); p = nextchar(p);
st++; pos = st; break;
if (*st == '\0' && p && *p != '\0') return 0; // word <= condition }
case '^': { p = nextchar(p); neg = true; break; }
case ']': {
if ((neg && ingroup) || (!neg && !ingroup)) return 0;
pos = NULL;
p = nextchar(p);
// skip the next character
if (!ingroup && *st) for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
if (*st == '\0' && p) return 0; // word <= condition
break; break;
} }
case '.': if (!pos) { // dots are not metacharacters in groups: [.] case '.': if (!pos) { // dots are not metacharacters in groups: [.]
p = nextchar(p); p = nextchar(p);
// skip the next character // skip the next character
for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++); for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
if (*st == '\0') return 0; // word <= condition if (*st == '\0' && p) return 0; // word <= condition
break; break;
} }
default: { default: {
@ -138,8 +131,14 @@ inline int PfxEntry::test_condition(const char * st)
p = nextchar(p); p = nextchar(p);
st++; st++;
} }
if (st != pos) ingroup = true; if (pos && st != pos) {
} else if (pos) ingroup = true; ingroup = true;
while (p && *p != ']' && (p = nextchar(p)));
}
} else if (pos) {
ingroup = true;
while (p && *p != ']' && (p = nextchar(p)));
}
} else if (pos) { // group } else if (pos) { // group
p = nextchar(p); p = nextchar(p);
} else return 0; } else return 0;
@ -163,8 +162,7 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
tmpl = len - appndl; tmpl = len - appndl;
// if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if (tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) {
if (tmpl > 0) {
// generate new root word by removing prefix and adding // generate new root word by removing prefix and adding
// back any characters that would have been stripped // back any characters that would have been stripped
@ -201,7 +199,7 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
//if ((opts & aeXPRODUCT) && in_compound) { //if ((opts & aeXPRODUCT) && in_compound) {
if ((opts & aeXPRODUCT)) { if ((opts & aeXPRODUCT)) {
he = pmyMgr->suffix_check(tmpword, tmpl, aeXPRODUCT, (AffEntry *)this, NULL, he = pmyMgr->suffix_check(tmpword, tmpl, aeXPRODUCT, this, NULL,
0, NULL, FLAG_NULL, needflag, in_compound); 0, NULL, FLAG_NULL, needflag, in_compound);
if (he) return he; if (he) return he;
} }
@ -225,8 +223,8 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
tmpl = len - appndl; tmpl = len - appndl;
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing prefix and adding // generate new root word by removing prefix and adding
// back any characters that would have been stripped // back any characters that would have been stripped
@ -250,7 +248,7 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
// cross checked combined with a suffix // cross checked combined with a suffix
if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) { if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) {
he = pmyMgr->suffix_check_twosfx(tmpword, tmpl, aeXPRODUCT, (AffEntry *)this, needflag); he = pmyMgr->suffix_check_twosfx(tmpword, tmpl, aeXPRODUCT, this, needflag);
if (he) return he; if (he) return he;
} }
} }
@ -272,8 +270,8 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
tmpl = len - appndl; tmpl = len - appndl;
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing prefix and adding // generate new root word by removing prefix and adding
// back any characters that would have been stripped // back any characters that would have been stripped
@ -298,7 +296,7 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) { if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) {
return pmyMgr->suffix_check_twosfx_morph(tmpword, tmpl, return pmyMgr->suffix_check_twosfx_morph(tmpword, tmpl,
aeXPRODUCT, (AffEntry *)this, needflag); aeXPRODUCT, this, needflag);
} }
} }
} }
@ -323,8 +321,8 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
tmpl = len - appndl; tmpl = len - appndl;
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing prefix and adding // generate new root word by removing prefix and adding
// back any characters that would have been stripped // back any characters that would have been stripped
@ -351,21 +349,27 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
((!needflag) || TESTAFF(he->astr, needflag, he->alen) || ((!needflag) || TESTAFF(he->astr, needflag, he->alen) ||
(contclass && TESTAFF(contclass, needflag, contclasslen)))) { (contclass && TESTAFF(contclass, needflag, contclasslen)))) {
if (morphcode) { if (morphcode) {
strcat(result, " "); mystrcat(result, " ", MAXLNLEN);
strcat(result, morphcode); mystrcat(result, morphcode, MAXLNLEN);
} else strcat(result,getKey()); } else mystrcat(result,getKey(), MAXLNLEN);
if (!HENTRY_FIND(he, MORPH_STEM)) { if (!HENTRY_FIND(he, MORPH_STEM)) {
strcat(result, " "); mystrcat(result, " ", MAXLNLEN);
strcat(result, MORPH_STEM); mystrcat(result, MORPH_STEM, MAXLNLEN);
strcat(result,HENTRY_WORD(he)); mystrcat(result, HENTRY_WORD(he), MAXLNLEN);
} }
// store the pointer of the hash entry // store the pointer of the hash entry
// sprintf(result + strlen(result), " %s%p", MORPH_HENTRY, he);
if (HENTRY_DATA(he)) { if (HENTRY_DATA(he)) {
strcat(result, " "); mystrcat(result, " ", MAXLNLEN);
strcat(result,HENTRY_DATA(he)); mystrcat(result, HENTRY_DATA2(he), MAXLNLEN);
} else {
// return with debug information
char * flag = pmyMgr->encode_flag(getFlag());
mystrcat(result, " ", MAXLNLEN);
mystrcat(result, MORPH_FLAG, MAXLNLEN);
mystrcat(result, flag, MAXLNLEN);
free(flag);
} }
strcat(result, "\n"); mystrcat(result, "\n", MAXLNLEN);
} }
he = he->next_homonym; he = he->next_homonym;
} while (he); } while (he);
@ -376,10 +380,10 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
// ross checked combined with a suffix // ross checked combined with a suffix
if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) { if ((opts & aeXPRODUCT) && (in_compound != IN_CPD_BEGIN)) {
st = pmyMgr->suffix_check_morph(tmpword, tmpl, aeXPRODUCT, (AffEntry *)this, st = pmyMgr->suffix_check_morph(tmpword, tmpl, aeXPRODUCT, this,
FLAG_NULL, needflag); FLAG_NULL, needflag);
if (st) { if (st) {
strcat(result, st); mystrcat(result, st, MAXLNLEN);
free(st); free(st);
} }
} }
@ -395,7 +399,7 @@ SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
// register affix manager // register affix manager
pmyMgr = pmgr; pmyMgr = pmgr;
// set up its intial values // set up its initial values
aflag = dp->aflag; // char flag aflag = dp->aflag; // char flag
strip = dp->strip; // string to strip strip = dp->strip; // string to strip
appnd = dp->appnd; // string to append appnd = dp->appnd; // string to append
@ -437,7 +441,8 @@ char * SfxEntry::add(const char * word, int len)
char tword[MAXWORDUTF8LEN + 4]; char tword[MAXWORDUTF8LEN + 4];
/* make sure all conditions match */ /* make sure all conditions match */
if ((len > stripl) && (len >= numconds) && test_condition(word + len, word) && if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
(len >= numconds) && test_condition(word + len, word) &&
(!stripl || (strcmp(word + len - stripl, strip) == 0)) && (!stripl || (strcmp(word + len - stripl, strip) == 0)) &&
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) { ((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
/* we have a match so add suffix */ /* we have a match so add suffix */
@ -453,13 +458,16 @@ char * SfxEntry::add(const char * word, int len)
} }
inline char * SfxEntry::nextchar(char * p) { inline char * SfxEntry::nextchar(char * p) {
p++; if (p) {
if (opts & aeLONGCOND) { p++;
// jump to the 2nd part of the condition if (opts & aeLONGCOND) {
if (p == c.l.conds1 + MAXCONDLEN_1) return c.l.conds2; // jump to the 2nd part of the condition
// end of the MAXCONDLEN length condition if (p == c.l.conds1 + MAXCONDLEN_1) return c.l.conds2;
} else if (p == c.conds + MAXCONDLEN) return NULL; // end of the MAXCONDLEN length condition
return p; } else if (p == c.conds + MAXCONDLEN) return NULL;
return *p ? p : NULL;
}
return NULL;
} }
inline int SfxEntry::test_condition(const char * st, const char * beg) inline int SfxEntry::test_condition(const char * st, const char * beg)
@ -470,30 +478,38 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
if (numconds == 0) return 1; if (numconds == 0) return 1;
char * p = c.conds; char * p = c.conds;
st--; st--;
int c = 1; int i = 1;
while (1) { while (1) {
switch (*p) { switch (*p) {
case '\0': return 1; case '\0': return 1;
case '[': { p = nextchar(p); pos = st; break; } case '[': { p = nextchar(p); pos = st; break; }
case '^': { p = nextchar(p); neg = true; break; } case '^': { p = nextchar(p); neg = true; break; }
case ']': { if (!neg && !ingroup) return 0; case ']': { if (!neg && !ingroup) return 0;
c++; i++;
// skip the next character
if (!ingroup) {
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
st--;
}
pos = NULL; pos = NULL;
neg = false; neg = false;
ingroup = false; ingroup = false;
p = nextchar(p); p = nextchar(p);
st--; if (st < beg && p) return 0; // word <= condition
if (st < beg && p && *p != '\0') return 0; // word <= condition
break; break;
} }
case '.': if (!pos) { // dots are not metacharacters in groups: [.] case '.': if (!pos) { // dots are not metacharacters in groups: [.]
p = nextchar(p); p = nextchar(p);
// skip the next character // skip the next character
for (st--; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--); for (st--; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
if (st < beg) return 0; // word <= condition if (st < beg) { // word <= condition
if (*st & 0x80) { // head of the UTF-8 character if (p) return 0; else return 1;
}
if ((opts & aeUTF8) && (*st & 0x80)) { // head of the UTF-8 character
st--; st--;
if (st < beg) return 0; // word <= condition if (st < beg) { // word <= condition
if (p) return 0; else return 1;
}
} }
break; break;
} }
@ -515,20 +531,25 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
} }
if (pos && st != pos) { if (pos && st != pos) {
if (neg) return 0; if (neg) return 0;
else if (c == numconds) return 1; else if (i == numconds) return 1;
ingroup = true; ingroup = true;
while (p && *p != ']' && (p = nextchar(p)));
st--;
} }
if (p && *p != '\0') p = nextchar(p); if (p && *p != ']') p = nextchar(p);
} else if (pos) { } else if (pos) {
if (neg) return 0; if (neg) return 0;
else if (c == numconds) return 1; else if (i == numconds) return 1;
ingroup = true; ingroup = true;
while (p && *p != ']' && (p = nextchar(p)));
// if (p && *p != ']') p = nextchar(p);
st--;
} }
if (!pos) { if (!pos) {
c++; i++;
st--; st--;
if (st < beg && p && *p != '\0') return 0; // word <= condition
} }
if (st < beg && p && *p != ']') return 0; // word <= condition
} else if (pos) { // group } else if (pos) { // group
p = nextchar(p); p = nextchar(p);
} else return 0; } else return 0;
@ -540,14 +561,14 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
// see if this suffix is present in the word // see if this suffix is present in the word
struct hentry * SfxEntry::checkword(const char * word, int len, int optflags, struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
AffEntry* ppfx, char ** wlst, int maxSug, int * ns, const FLAG cclass, const FLAG needflag, PfxEntry* ppfx, char ** wlst, int maxSug, int * ns, const FLAG cclass, const FLAG needflag,
const FLAG badflag) const FLAG badflag)
{ {
int tmpl; // length of tmpword int tmpl; // length of tmpword
struct hentry * he; // hash entry pointer struct hentry * he; // hash entry pointer
unsigned char * cp; unsigned char * cp;
char tmpword[MAXWORDUTF8LEN + 4]; char tmpword[MAXWORDUTF8LEN + 4];
PfxEntry* ep = (PfxEntry *) ppfx; PfxEntry* ep = ppfx;
// if this suffix is being cross checked with a prefix // if this suffix is being cross checked with a prefix
// but it does not support cross products skip it // but it does not support cross products skip it
@ -564,8 +585,8 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
// the second condition is not enough for UTF-8 strings // the second condition is not enough for UTF-8 strings
// it checked in test_condition() // it checked in test_condition()
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing suffix and adding // generate new root word by removing suffix and adding
// back any characters that would have been stripped or // back any characters that would have been stripped or
@ -598,9 +619,9 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
if ((TESTAFF(he->astr, aflag, he->alen) || (ep && ep->getCont() && if ((TESTAFF(he->astr, aflag, he->alen) || (ep && ep->getCont() &&
TESTAFF(ep->getCont(), aflag, ep->getContLen()))) && TESTAFF(ep->getCont(), aflag, ep->getContLen()))) &&
(((optflags & aeXPRODUCT) == 0) || (((optflags & aeXPRODUCT) == 0) ||
TESTAFF(he->astr, ep->getFlag(), he->alen) || (ep && TESTAFF(he->astr, ep->getFlag(), he->alen)) ||
// enabled by prefix // enabled by prefix
((contclass) && TESTAFF(contclass, ep->getFlag(), contclasslen)) ((contclass) && (ep && TESTAFF(contclass, ep->getFlag(), contclasslen)))
) && ) &&
// handle cont. class // handle cont. class
((!cclass) || ((!cclass) ||
@ -642,13 +663,13 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
// see if two-level suffix is present in the word // see if two-level suffix is present in the word
struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags, struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
AffEntry* ppfx, const FLAG needflag) PfxEntry* ppfx, const FLAG needflag)
{ {
int tmpl; // length of tmpword int tmpl; // length of tmpword
struct hentry * he; // hash entry pointer struct hentry * he; // hash entry pointer
unsigned char * cp; unsigned char * cp;
char tmpword[MAXWORDUTF8LEN + 4]; char tmpword[MAXWORDUTF8LEN + 4];
PfxEntry* ep = (PfxEntry *) ppfx; PfxEntry* ep = ppfx;
// if this suffix is being cross checked with a prefix // if this suffix is being cross checked with a prefix
@ -664,8 +685,8 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
tmpl = len - appndl; tmpl = len - appndl;
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing suffix and adding // generate new root word by removing suffix and adding
// back any characters that would have been stripped or // back any characters that would have been stripped or
@ -704,12 +725,12 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
// see if two-level suffix is present in the word // see if two-level suffix is present in the word
char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags, char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
AffEntry* ppfx, const FLAG needflag) PfxEntry* ppfx, const FLAG needflag)
{ {
int tmpl; // length of tmpword int tmpl; // length of tmpword
unsigned char * cp; unsigned char * cp;
char tmpword[MAXWORDUTF8LEN + 4]; char tmpword[MAXWORDUTF8LEN + 4];
PfxEntry* ep = (PfxEntry *) ppfx; PfxEntry* ep = ppfx;
char * st; char * st;
char result[MAXLNLEN]; char result[MAXLNLEN];
@ -729,8 +750,8 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
tmpl = len - appndl; tmpl = len - appndl;
if ((tmpl > 0) && (tmpl + stripl >= numconds)) { if ((tmpl > 0 || (tmpl == 0 && pmyMgr->get_fullstrip())) &&
// if (tmpl > 0) { (tmpl + stripl >= numconds)) {
// generate new root word by removing suffix and adding // generate new root word by removing suffix and adding
// back any characters that would have been stripped or // back any characters that would have been stripped or
@ -757,18 +778,18 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
if ((contclass) && TESTAFF(contclass, ep->getFlag(), contclasslen)) { if ((contclass) && TESTAFF(contclass, ep->getFlag(), contclasslen)) {
st = pmyMgr->suffix_check_morph(tmpword, tmpl, 0, NULL, aflag, needflag); st = pmyMgr->suffix_check_morph(tmpword, tmpl, 0, NULL, aflag, needflag);
if (st) { if (st) {
if (((PfxEntry *) ppfx)->getMorph()) { if (ppfx->getMorph()) {
strcat(result, ((PfxEntry *) ppfx)->getMorph()); mystrcat(result, ppfx->getMorph(), MAXLNLEN);
strcat(result, " "); mystrcat(result, " ", MAXLNLEN);
} }
strcat(result,st); mystrcat(result,st, MAXLNLEN);
free(st); free(st);
mychomp(result); mychomp(result);
} }
} else { } else {
st = pmyMgr->suffix_check_morph(tmpword, tmpl, optflags, ppfx, aflag, needflag); st = pmyMgr->suffix_check_morph(tmpword, tmpl, optflags, ppfx, aflag, needflag);
if (st) { if (st) {
strcat(result, st); mystrcat(result, st, MAXLNLEN);
free(st); free(st);
mychomp(result); mychomp(result);
} }
@ -776,7 +797,7 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
} else { } else {
st = pmyMgr->suffix_check_morph(tmpword, tmpl, 0, NULL, aflag, needflag); st = pmyMgr->suffix_check_morph(tmpword, tmpl, 0, NULL, aflag, needflag);
if (st) { if (st) {
strcat(result, st); mystrcat(result, st, MAXLNLEN);
free(st); free(st);
mychomp(result); mychomp(result);
} }
@ -788,10 +809,10 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
} }
// get next homonym with same affix // get next homonym with same affix
struct hentry * SfxEntry::get_next_homonym(struct hentry * he, int optflags, AffEntry* ppfx, struct hentry * SfxEntry::get_next_homonym(struct hentry * he, int optflags, PfxEntry* ppfx,
const FLAG cclass, const FLAG needflag) const FLAG cclass, const FLAG needflag)
{ {
PfxEntry* ep = (PfxEntry *) ppfx; PfxEntry* ep = ppfx;
FLAG eFlag = ep ? ep->getFlag() : FLAG_NULL; FLAG eFlag = ep ? ep->getFlag() : FLAG_NULL;
while (he->next_homonym) { while (he->next_homonym) {

View File

@ -1,13 +1,15 @@
#ifndef _AFFIX_HXX_ #ifndef _AFFIX_HXX_
#define _AFFIX_HXX_ #define _AFFIX_HXX_
#include "hunvisapi.h"
#include "atypes.hxx" #include "atypes.hxx"
#include "baseaffix.hxx" #include "baseaffix.hxx"
#include "affixmgr.hxx" #include "affixmgr.hxx"
/* A Prefix Entry */ /* A Prefix Entry */
class PfxEntry : public AffEntry class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
{ {
AffixMgr* pmyMgr; AffixMgr* pmyMgr;
@ -63,7 +65,7 @@ public:
/* A Suffix Entry */ /* A Suffix Entry */
class SfxEntry : public AffEntry class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
{ {
AffixMgr* pmyMgr; AffixMgr* pmyMgr;
char * rappnd; char * rappnd;
@ -84,16 +86,16 @@ public:
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); } inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
struct hentry * checkword(const char * word, int len, int optflags, struct hentry * checkword(const char * word, int len, int optflags,
AffEntry* ppfx, char ** wlst, int maxSug, int * ns, 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, char in_compound=IN_CPD_NOT);
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0); 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, AffEntry* ppfx, const FLAG needflag = NULL); struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
char * check_twosfx_morph(const char * word, int len, int optflags, char * check_twosfx_morph(const char * word, int len, int optflags,
AffEntry* ppfx, const FLAG needflag = FLAG_NULL); PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
struct hentry * get_next_homonym(struct hentry * he); struct hentry * get_next_homonym(struct hentry * he);
struct hentry * get_next_homonym(struct hentry * word, int optflags, AffEntry* ppfx, struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
const FLAG cclass, const FLAG needflag); const FLAG cclass, const FLAG needflag);

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,33 @@
#ifndef _AFFIXMGR_HXX_ #ifndef _AFFIXMGR_HXX_
#define _AFFIXMGR_HXX_ #define _AFFIXMGR_HXX_
#ifdef MOZILLA_CLIENT #include "hunvisapi.h"
#ifdef __SUNPRO_CC // for SunONE Studio compiler
using namespace std;
#endif
#include <stdio.h> #include <stdio.h>
#else
#include <cstdio>
#endif
#include "atypes.hxx" #include "atypes.hxx"
#include "baseaffix.hxx" #include "baseaffix.hxx"
#include "hashmgr.hxx" #include "hashmgr.hxx"
#include "phonet.hxx" #include "phonet.hxx"
#include "replist.hxx"
// check flag duplication // check flag duplication
#define dupSFX (1 << 0) #define dupSFX (1 << 0)
#define dupPFX (1 << 1) #define dupPFX (1 << 1)
class AffixMgr class PfxEntry;
class SfxEntry;
class LIBHUNSPELL_DLL_EXPORTED AffixMgr
{ {
AffEntry * pStart[SETSIZE]; PfxEntry * pStart[SETSIZE];
AffEntry * sStart[SETSIZE]; SfxEntry * sStart[SETSIZE];
AffEntry * pFlag[CONTSIZE]; PfxEntry * pFlag[SETSIZE];
AffEntry * sFlag[CONTSIZE]; SfxEntry * sFlag[SETSIZE];
HashMgr * pHMgr; HashMgr * pHMgr;
HashMgr ** alldic;
int * maxdic;
char * keystring; char * keystring;
char * trystring; char * trystring;
char * encoding; char * encoding;
@ -44,22 +45,30 @@ class AffixMgr
int checkcompoundrep; int checkcompoundrep;
int checkcompoundcase; int checkcompoundcase;
int checkcompoundtriple; int checkcompoundtriple;
int simplifiedtriple;
FLAG forbiddenword; FLAG forbiddenword;
FLAG nosuggest; FLAG nosuggest;
FLAG nongramsuggest;
FLAG needaffix; FLAG needaffix;
int cpdmin; int cpdmin;
int numrep; int numrep;
replentry * reptable; replentry * reptable;
RepList * iconvtable;
RepList * oconvtable;
int nummap; int nummap;
mapentry * maptable; mapentry * maptable;
int numbreak; int numbreak;
char ** breaktable; char ** breaktable;
int numcheckcpd; int numcheckcpd;
replentry * checkcpdtable; patentry * checkcpdtable;
int simplifiedcpd;
int numdefcpd; int numdefcpd;
flagentry * defcpdtable; flagentry * defcpdtable;
phonetable * phone; phonetable * phone;
int maxngramsugs; int maxngramsugs;
int maxcpdsugs;
int maxdiff;
int onlymaxdiff;
int nosplitsugs; int nosplitsugs;
int sugswithdots; int sugswithdots;
int cpdwordmax; int cpdwordmax;
@ -72,8 +81,8 @@ class AffixMgr
const char * sfxappnd; // BUG: not stateless const char * sfxappnd; // BUG: not stateless
FLAG sfxflag; // BUG: not stateless FLAG sfxflag; // BUG: not stateless
char * derived; // BUG: not stateless char * derived; // BUG: not stateless
AffEntry * sfx; // BUG: not stateless SfxEntry * sfx; // BUG: not stateless
AffEntry * pfx; // BUG: not stateless PfxEntry * pfx; // BUG: not stateless
int checknum; int checknum;
char * wordchars; char * wordchars;
unsigned short * wordchars_utf16; unsigned short * wordchars_utf16;
@ -88,16 +97,20 @@ class AffixMgr
FLAG circumfix; FLAG circumfix;
FLAG onlyincompound; FLAG onlyincompound;
FLAG keepcase; FLAG keepcase;
FLAG forceucase;
FLAG warn;
int forbidwarn;
FLAG substandard; FLAG substandard;
int checksharps; int checksharps;
int fullstrip;
int havecontclass; // boolean variable int havecontclass; // boolean variable
char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix) char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
flag flag_mode;
public: public:
AffixMgr(const char * affpath, HashMgr * ptr); AffixMgr(const char * affpath, HashMgr** ptr, int * md,
const char * key = NULL);
~AffixMgr(); ~AffixMgr();
struct hentry * affix_check(const char * word, int len, struct hentry * affix_check(const char * word, int len,
const unsigned short needflag = (unsigned short) 0, const unsigned short needflag = (unsigned short) 0,
@ -109,24 +122,24 @@ public:
char in_compound, const FLAG needflag = FLAG_NULL); char in_compound, const FLAG needflag = FLAG_NULL);
inline int isRevSubset(const char * s1, const char * end_of_s2, int len); inline int isRevSubset(const char * s1, const char * end_of_s2, int len);
struct hentry * suffix_check(const char * word, int len, int sfxopts, struct hentry * suffix_check(const char * word, int len, int sfxopts,
AffEntry* ppfx, char ** wlst, int maxSug, int * ns, PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL,
char in_compound = IN_CPD_NOT); char in_compound = IN_CPD_NOT);
struct hentry * suffix_check_twosfx(const char * word, int len, struct hentry * suffix_check_twosfx(const char * word, int len,
int sfxopts, AffEntry* ppfx, const FLAG needflag = FLAG_NULL); int sfxopts, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
char * affix_check_morph(const char * word, int len, char * affix_check_morph(const char * word, int len,
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT); const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
char * prefix_check_morph(const char * word, int len, char * prefix_check_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL); char in_compound, const FLAG needflag = FLAG_NULL);
char * suffix_check_morph (const char * word, int len, int sfxopts, char * suffix_check_morph (const char * word, int len, int sfxopts,
AffEntry * ppfx, const FLAG cclass = FLAG_NULL, PfxEntry * ppfx, const FLAG cclass = FLAG_NULL,
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT); const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
char * prefix_check_twosfx_morph(const char * word, int len, char * prefix_check_twosfx_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL); char in_compound, const FLAG needflag = FLAG_NULL);
char * suffix_check_twosfx_morph(const char * word, int len, char * suffix_check_twosfx_morph(const char * word, int len,
int sfxopts, AffEntry * ppfx, const FLAG needflag = FLAG_NULL); int sfxopts, PfxEntry * ppfx, const FLAG needflag = FLAG_NULL);
char * morphgen(char * ts, int wl, const unsigned short * ap, char * morphgen(char * ts, int wl, const unsigned short * ap,
unsigned short al, char * morph, char * targetmorph, int level); unsigned short al, char * morph, char * targetmorph, int level);
@ -137,87 +150,100 @@ public:
short get_syllable (const char * word, int wlen); short get_syllable (const char * word, int wlen);
int cpdrep_check(const char * word, int len); int cpdrep_check(const char * word, int len);
int cpdpat_check(const char * word, int len); int cpdpat_check(const char * word, int len, hentry * r1, hentry * r2,
const char affixed);
int defcpd_check(hentry *** words, short wnum, hentry * rv, int defcpd_check(hentry *** words, short wnum, hentry * rv,
hentry ** rwords, char all); hentry ** rwords, char all);
int cpdcase_check(const char * word, int len); int cpdcase_check(const char * word, int len);
inline int candidate_check(const char * word, int len); inline int candidate_check(const char * word, int len);
void setcminmax(int * cmin, int * cmax, const char * word, int len);
struct hentry * compound_check(const char * word, int len, short wordnum, struct hentry * compound_check(const char * word, int len, short wordnum,
short numsyllable, short maxwordnum, short wnum, hentry ** words, short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, int * cmpdstemnum, int * cmpdstem, char is_sug); char hu_mov_rule, char is_sug, int * info);
int compound_check_morph(const char * word, int len, short wordnum, int compound_check_morph(const char * word, int len, short wordnum,
short numsyllable, short maxwordnum, short wnum, hentry ** words, short numsyllable, short maxwordnum, short wnum, hentry ** words,
char hu_mov_rule, char ** result, char * partresult); char hu_mov_rule, char ** result, char * partresult);
struct hentry * lookup(const char * word); struct hentry * lookup(const char * word);
int get_numrep(); int get_numrep() const;
struct replentry * get_reptable(); struct replentry * get_reptable() const;
struct phonetable * get_phonetable(); RepList * get_iconvtable() const;
int get_nummap(); RepList * get_oconvtable() const;
struct mapentry * get_maptable(); struct phonetable * get_phonetable() const;
int get_numbreak(); int get_nummap() const;
char ** get_breaktable(); struct mapentry * get_maptable() const;
int get_numbreak() const;
char ** get_breaktable() const;
char * get_encoding(); char * get_encoding();
int get_langnum(); int get_langnum() const;
char * get_key_string(); char * get_key_string();
char * get_try_string(); char * get_try_string() const;
const char * get_wordchars(); const char * get_wordchars() const;
unsigned short * get_wordchars_utf16(int * len); unsigned short * get_wordchars_utf16(int * len) const;
char * get_ignore(); char * get_ignore() const;
unsigned short * get_ignore_utf16(int * len); unsigned short * get_ignore_utf16(int * len) const;
int get_compound(); int get_compound() const;
FLAG get_compoundflag(); FLAG get_compoundflag() const;
FLAG get_compoundbegin(); FLAG get_compoundbegin() const;
FLAG get_forbiddenword(); FLAG get_forbiddenword() const;
FLAG get_nosuggest(); FLAG get_nosuggest() const;
// FLAG get_circumfix(); FLAG get_nongramsuggest() const;
FLAG get_needaffix(); FLAG get_needaffix() const;
FLAG get_onlyincompound(); FLAG get_onlyincompound() const;
FLAG get_compoundroot(); FLAG get_compoundroot() const;
FLAG get_lemma_present(); FLAG get_lemma_present() const;
int get_checknum(); int get_checknum() const;
char * get_possible_root(); const char * get_prefix() const;
const char * get_prefix(); const char * get_suffix() const;
const char * get_suffix(); const char * get_derived() const;
const char * get_derived(); const char * get_version() const;
const char * get_version(); int have_contclass() const;
const int have_contclass(); int get_utf8() const;
int get_utf8(); int get_complexprefixes() const;
int get_complexprefixes(); char * get_suffixed(char ) const;
char * get_suffixed(char ); int get_maxngramsugs() const;
int get_maxngramsugs(); int get_maxcpdsugs() const;
int get_nosplitsugs(); int get_maxdiff() const;
int get_sugswithdots(void); int get_onlymaxdiff() const;
FLAG get_keepcase(void); int get_nosplitsugs() const;
int get_checksharps(void); int get_sugswithdots(void) const;
FLAG get_keepcase(void) const;
FLAG get_forceucase(void) const;
FLAG get_warn(void) const;
int get_forbidwarn(void) const;
int get_checksharps(void) const;
char * encode_flag(unsigned short aflag) const;
int get_fullstrip() const;
private: private:
int parse_file(const char * affpath); int parse_file(const char * affpath, const char * key);
int parse_flag(char * line, unsigned short * out, const char * name); int parse_flag(char * line, unsigned short * out, FileMgr * af);
int parse_num(char * line, int * out, const char * name); int parse_num(char * line, int * out, FileMgr * af);
int parse_cpdsyllable(char * line); int parse_cpdsyllable(char * line, FileMgr * af);
int parse_reptable(char * line, FILE * af); int parse_reptable(char * line, FileMgr * af);
int parse_phonetable(char * line, FILE * af); int parse_convtable(char * line, FileMgr * af, RepList ** rl, const char * keyword);
int parse_maptable(char * line, FILE * af); int parse_phonetable(char * line, FileMgr * af);
int parse_breaktable(char * line, FILE * af); int parse_maptable(char * line, FileMgr * af);
int parse_checkcpdtable(char * line, FILE * af); int parse_breaktable(char * line, FileMgr * af);
int parse_defcpdtable(char * line, FILE * af); int parse_checkcpdtable(char * line, FileMgr * af);
int parse_affix(char * line, const char at, FILE * af, char * dupflags); int parse_defcpdtable(char * line, FileMgr * af);
int parse_affix(char * line, const char at, FileMgr * af, char * dupflags);
void reverse_condition(char *); void reverse_condition(char *);
void debugflag(char * result, unsigned short flag);
int condlen(char *); int condlen(char *);
int encodeit(struct affentry * ptr, char * cs); int encodeit(affentry &entry, char * cs);
int build_pfxtree(AffEntry* pfxptr); int build_pfxtree(PfxEntry* pfxptr);
int build_sfxtree(AffEntry* sfxptr); int build_sfxtree(SfxEntry* sfxptr);
int process_pfx_order(); int process_pfx_order();
int process_sfx_order(); int process_sfx_order();
AffEntry * process_pfx_in_order(AffEntry * ptr, AffEntry * nptr); PfxEntry * process_pfx_in_order(PfxEntry * ptr, PfxEntry * nptr);
AffEntry * process_sfx_in_order(AffEntry * ptr, AffEntry * nptr); SfxEntry * process_sfx_in_order(SfxEntry * ptr, SfxEntry * nptr);
int process_pfx_tree_to_list(); int process_pfx_tree_to_list();
int process_sfx_tree_to_list(); int process_sfx_tree_to_list();
int redundant_condition(char, char * strip, int stripl, int redundant_condition(char, char * strip, int stripl,
const char * cond, char *); const char * cond, int);
}; };
#endif #endif

View File

@ -2,6 +2,7 @@
#define _ATYPES_HXX_ #define _ATYPES_HXX_
#ifndef HUNSPELL_WARNING #ifndef HUNSPELL_WARNING
#include <stdio.h>
#ifdef HUNSPELL_WARNING_ON #ifdef HUNSPELL_WARNING_ON
#define HUNSPELL_WARNING fprintf #define HUNSPELL_WARNING fprintf
#else #else
@ -13,8 +14,8 @@ static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
// HUNSTEM def. // HUNSTEM def.
#define HUNSTEM #define HUNSTEM
#include "csutil.hxx"
#include "hashmgr.hxx" #include "hashmgr.hxx"
#include "w_char.hxx"
#define SETSIZE 256 #define SETSIZE 256
#define CONTSIZE 65536 #define CONTSIZE 65536
@ -34,6 +35,15 @@ static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
#define IN_CPD_END 2 #define IN_CPD_END 2
#define IN_CPD_OTHER 3 #define IN_CPD_OTHER 3
// info options
#define SPELL_COMPOUND (1 << 0)
#define SPELL_FORBIDDEN (1 << 1)
#define SPELL_ALLCAP (1 << 2)
#define SPELL_NOCAP (1 << 3)
#define SPELL_INITCAP (1 << 4)
#define SPELL_ORIGCAP (1 << 5)
#define SPELL_WARN (1 << 6)
#define MAXLNLEN 8192 #define MAXLNLEN 8192
#define MINCPDLEN 3 #define MINCPDLEN 3
@ -70,9 +80,14 @@ struct affentry
char * morphcode; char * morphcode;
}; };
struct guessword {
char * word;
bool allow;
char * orig;
};
struct mapentry { struct mapentry {
char * set; char ** set;
w_char * set_utf16;
int len; int len;
}; };
@ -81,10 +96,12 @@ struct flagentry {
int len; int len;
}; };
struct guessword { struct patentry {
char * word; char * pattern;
bool allow; char * pattern2;
char * orig; char * pattern3;
FLAG cond;
FLAG cond2;
}; };
#endif #endif

View File

@ -1,10 +1,10 @@
#ifndef _BASEAFF_HXX_ #ifndef _BASEAFF_HXX_
#define _BASEAFF_HXX_ #define _BASEAFF_HXX_
class AffEntry #include "hunvisapi.h"
{
public:
class LIBHUNSPELL_DLL_EXPORTED AffEntry
{
protected: protected:
char * appnd; char * appnd;
char * strip; char * strip;

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,30 @@
#ifndef __CSUTILHXX__ #ifndef __CSUTILHXX__
#define __CSUTILHXX__ #define __CSUTILHXX__
#include "hunvisapi.h"
// First some base level utility routines // First some base level utility routines
#include <string.h>
#include "w_char.hxx"
#include "htypes.hxx"
#ifdef MOZILLA_CLIENT
#include "nscore.h" // for mozalloc headers
#endif
// casing
#define NOCAP 0 #define NOCAP 0
#define INITCAP 1 #define INITCAP 1
#define ALLCAP 2 #define ALLCAP 2
#define HUHCAP 3 #define HUHCAP 3
#define HUHINITCAP 4 #define HUHINITCAP 4
// default encoding and keystring
#define SPELL_ENCODING "ISO8859-1"
#define SPELL_KEYSTRING "qwertyuiop|asdfghjkl|zxcvbnm"
// default morphological fields
#define MORPH_STEM "st:" #define MORPH_STEM "st:"
#define MORPH_ALLOMORPH "al:" #define MORPH_ALLOMORPH "al:"
#define MORPH_POS "po:" #define MORPH_POS "po:"
@ -23,6 +39,7 @@
#define MORPH_PHON "ph:" #define MORPH_PHON "ph:"
#define MORPH_HYPH "hy:" #define MORPH_HYPH "hy:"
#define MORPH_PART "pa:" #define MORPH_PART "pa:"
#define MORPH_FLAG "fl:"
#define MORPH_HENTRY "_H:" #define MORPH_HENTRY "_H:"
#define MORPH_TAG_LEN strlen(MORPH_STEM) #define MORPH_TAG_LEN strlen(MORPH_STEM)
@ -30,72 +47,67 @@
#define MSEP_REC '\n' #define MSEP_REC '\n'
#define MSEP_ALT '\v' #define MSEP_ALT '\v'
// default flags // default flags
#define DEFAULTFLAGS 65510 #define DEFAULTFLAGS 65510
#define FORBIDDENWORD 65510 #define FORBIDDENWORD 65510
#define ONLYUPCASEFLAG 65511 #define ONLYUPCASEFLAG 65511
typedef struct {
unsigned char l;
unsigned char h;
} w_char;
#define w_char_eq(a,b) (((a).l == (b).l) && ((a).h == (b).h))
// convert UTF-16 characters to UTF-8 // convert UTF-16 characters to UTF-8
char * u16_u8(char * dest, int size, const w_char * src, int srclen); LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
// convert UTF-8 characters to UTF-16 // convert UTF-8 characters to UTF-16
int u8_u16(w_char * dest, int size, const char * src); LIBHUNSPELL_DLL_EXPORTED int u8_u16(w_char * dest, int size, const char * src);
// sort 2-byte vector // sort 2-byte vector
void flag_qsort(unsigned short flags[], int begin, int end); LIBHUNSPELL_DLL_EXPORTED void flag_qsort(unsigned short flags[], int begin, int end);
// binary search in 2-byte vector // binary search in 2-byte vector
int flag_bsearch(unsigned short flags[], unsigned short flag, int right); LIBHUNSPELL_DLL_EXPORTED int flag_bsearch(unsigned short flags[], unsigned short flag, int right);
// remove end of line char(s) // remove end of line char(s)
void mychomp(char * s); LIBHUNSPELL_DLL_EXPORTED void mychomp(char * s);
// duplicate string // duplicate string
char * mystrdup(const char * s); LIBHUNSPELL_DLL_EXPORTED char * mystrdup(const char * s);
// strcat for limited length destination string
LIBHUNSPELL_DLL_EXPORTED char * mystrcat(char * dest, const char * st, int max);
// duplicate reverse of string // duplicate reverse of string
char * myrevstrdup(const char * s); LIBHUNSPELL_DLL_EXPORTED char * myrevstrdup(const char * s);
// parse into tokens with char delimiter // parse into tokens with char delimiter
char * mystrsep(char ** sptr, const char delim); LIBHUNSPELL_DLL_EXPORTED char * mystrsep(char ** sptr, const char delim);
// parse into tokens with char delimiter // parse into tokens with char delimiter
char * mystrsep2(char ** sptr, const char delim); LIBHUNSPELL_DLL_EXPORTED char * mystrsep2(char ** sptr, const char delim);
// parse into tokens with char delimiter // parse into tokens with char delimiter
char * mystrrep(char *, const char *, const char *); LIBHUNSPELL_DLL_EXPORTED char * mystrrep(char *, const char *, const char *);
// append s to ends of every lines in text // append s to ends of every lines in text
void strlinecat(char * lines, const char * s); LIBHUNSPELL_DLL_EXPORTED void strlinecat(char * lines, const char * s);
// tokenize into lines with new line // tokenize into lines with new line
int line_tok(const char * text, char *** lines, char breakchar); LIBHUNSPELL_DLL_EXPORTED int line_tok(const char * text, char *** lines, char breakchar);
// tokenize into lines with new line and uniq in place // tokenize into lines with new line and uniq in place
char * line_uniq(char * text, char breakchar); LIBHUNSPELL_DLL_EXPORTED char * line_uniq(char * text, char breakchar);
char * line_uniq_app(char ** text, char breakchar); LIBHUNSPELL_DLL_EXPORTED char * line_uniq_app(char ** text, char breakchar);
// change oldchar to newchar in place // change oldchar to newchar in place
char * tr(char * text, char oldc, char newc); LIBHUNSPELL_DLL_EXPORTED char * tr(char * text, char oldc, char newc);
// reverse word // reverse word
int reverseword(char *); LIBHUNSPELL_DLL_EXPORTED int reverseword(char *);
// reverse word // reverse word
int reverseword_utf(char *); LIBHUNSPELL_DLL_EXPORTED int reverseword_utf(char *);
// remove duplicates // remove duplicates
int uniqlist(char ** list, int n); LIBHUNSPELL_DLL_EXPORTED int uniqlist(char ** list, int n);
// free character array list // free character array list
void freelist(char *** list, int n); LIBHUNSPELL_DLL_EXPORTED void freelist(char *** list, int n);
// character encoding information // character encoding information
struct cs_info { struct cs_info {
@ -104,100 +116,105 @@ struct cs_info {
unsigned char cupper; unsigned char cupper;
}; };
// two character arrays LIBHUNSPELL_DLL_EXPORTED int initialize_utf_tbl();
struct replentry { LIBHUNSPELL_DLL_EXPORTED void free_utf_tbl();
char * pattern; LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetoupper(unsigned short c, int langnum);
char * pattern2; LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetolower(unsigned short c, int langnum);
}; LIBHUNSPELL_DLL_EXPORTED int unicodeisalpha(unsigned short c);
// Unicode character encoding information LIBHUNSPELL_DLL_EXPORTED struct cs_info * get_current_cs(const char * es);
struct unicode_info {
unsigned short c;
unsigned short cupper;
unsigned short clower;
};
struct unicode_info2 {
char cletter;
unsigned short cupper;
unsigned short clower;
};
int initialize_utf_tbl();
void free_utf_tbl();
unsigned short unicodetoupper(unsigned short c, int langnum);
unsigned short unicodetolower(unsigned short c, int langnum);
int unicodeisalpha(unsigned short c);
struct enc_entry {
const char * enc_name;
struct cs_info * cs_table;
};
// language to encoding default map
struct lang_map {
const char * lang;
const char * def_enc;
int num;
};
struct cs_info * get_current_cs(const char * es);
const char * get_default_enc(const char * lang);
// get language identifiers of language codes // get language identifiers of language codes
int get_lang_num(const char * lang); LIBHUNSPELL_DLL_EXPORTED int get_lang_num(const char * lang);
// get characters of the given 8bit encoding with lower- and uppercase forms // get characters of the given 8bit encoding with lower- and uppercase forms
char * get_casechars(const char * enc); LIBHUNSPELL_DLL_EXPORTED char * get_casechars(const char * enc);
// convert null terminated string to all caps using encoding // convert null terminated string to all caps using encoding
void enmkallcap(char * d, const char * p, const char * encoding); LIBHUNSPELL_DLL_EXPORTED void enmkallcap(char * d, const char * p, const char * encoding);
// convert null terminated string to all little using encoding // convert null terminated string to all little using encoding
void enmkallsmall(char * d, const char * p, const char * encoding); LIBHUNSPELL_DLL_EXPORTED void enmkallsmall(char * d, const char * p, const char * encoding);
// convert null terminated string to have intial capital using encoding // convert null terminated string to have initial capital using encoding
void enmkinitcap(char * d, const char * p, const char * encoding); LIBHUNSPELL_DLL_EXPORTED void enmkinitcap(char * d, const char * p, const char * encoding);
// convert null terminated string to all caps // convert null terminated string to all caps
void mkallcap(char * p, const struct cs_info * csconv); LIBHUNSPELL_DLL_EXPORTED void mkallcap(char * p, const struct cs_info * csconv);
// convert null terminated string to all little // convert null terminated string to all little
void mkallsmall(char * p, const struct cs_info * csconv); LIBHUNSPELL_DLL_EXPORTED void mkallsmall(char * p, const struct cs_info * csconv);
// convert null terminated string to have intial capital // convert null terminated string to have initial capital
void mkinitcap(char * p, const struct cs_info * csconv); LIBHUNSPELL_DLL_EXPORTED void mkinitcap(char * p, const struct cs_info * csconv);
// convert first nc characters of UTF-8 string to little // convert first nc characters of UTF-8 string to little
void mkallsmall_utf(w_char * u, int nc, int langnum); LIBHUNSPELL_DLL_EXPORTED void mkallsmall_utf(w_char * u, int nc, int langnum);
// convert first nc characters of UTF-8 string to capital // convert first nc characters of UTF-8 string to capital
void mkallcap_utf(w_char * u, int nc, int langnum); LIBHUNSPELL_DLL_EXPORTED void mkallcap_utf(w_char * u, int nc, int langnum);
// get type of capitalization // get type of capitalization
int get_captype(char * q, int nl, cs_info *); LIBHUNSPELL_DLL_EXPORTED int get_captype(char * q, int nl, cs_info *);
// get type of capitalization (UTF-8) // get type of capitalization (UTF-8)
int get_captype_utf8(w_char * q, int nl, int langnum); LIBHUNSPELL_DLL_EXPORTED int get_captype_utf8(w_char * q, int nl, int langnum);
// strip all ignored characters in the string // strip all ignored characters in the string
void remove_ignored_chars_utf(char * word, unsigned short ignored_chars[], int ignored_len); LIBHUNSPELL_DLL_EXPORTED void remove_ignored_chars_utf(char * word, unsigned short ignored_chars[], int ignored_len);
// strip all ignored characters in the string // strip all ignored characters in the string
void remove_ignored_chars(char * word, char * ignored_chars); LIBHUNSPELL_DLL_EXPORTED void remove_ignored_chars(char * word, char * ignored_chars);
int parse_string(char * line, char ** out, const char * name); LIBHUNSPELL_DLL_EXPORTED int parse_string(char * line, char ** out, int ln);
int parse_array(char * line, char ** out, LIBHUNSPELL_DLL_EXPORTED int parse_array(char * line, char ** out, unsigned short ** out_utf16,
unsigned short ** out_utf16, int * out_utf16_len, const char * name, int utf8); int * out_utf16_len, int utf8, int ln);
int fieldlen(const char * r); LIBHUNSPELL_DLL_EXPORTED int fieldlen(const char * r);
char * copy_field(char * dest, const char * morph, const char * var); LIBHUNSPELL_DLL_EXPORTED char * copy_field(char * dest, const char * morph, const char * var);
int morphcmp(const char * s, const char * t); LIBHUNSPELL_DLL_EXPORTED int morphcmp(const char * s, const char * t);
int get_sfxcount(const char * morph); LIBHUNSPELL_DLL_EXPORTED int get_sfxcount(const char * morph);
// conversion function for protected memory
LIBHUNSPELL_DLL_EXPORTED void store_pointer(char * dest, char * source);
// conversion function for protected memory
LIBHUNSPELL_DLL_EXPORTED char * get_stored_pointer(const char * s);
// hash entry macros
LIBHUNSPELL_DLL_EXPORTED inline char* HENTRY_DATA(struct hentry *h)
{
char *ret;
if (!h->var)
ret = NULL;
else if (h->var & H_OPT_ALIASM)
ret = get_stored_pointer(HENTRY_WORD(h) + h->blen + 1);
else
ret = HENTRY_WORD(h) + h->blen + 1;
return ret;
}
// NULL-free version for warning-free OOo build
LIBHUNSPELL_DLL_EXPORTED inline const char* HENTRY_DATA2(const struct hentry *h)
{
const char *ret;
if (!h->var)
ret = "";
else if (h->var & H_OPT_ALIASM)
ret = get_stored_pointer(HENTRY_WORD(h) + h->blen + 1);
else
ret = HENTRY_WORD(h) + h->blen + 1;
return ret;
}
LIBHUNSPELL_DLL_EXPORTED inline char* HENTRY_FIND(struct hentry *h, const char *p)
{
return (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL);
}
#define w_char_eq(a,b) (((a).l == (b).l) && ((a).h == (b).h))
#endif #endif

View File

@ -1,25 +1,20 @@
#include <cstdlib> #include <stdlib.h>
#include <cstring> #include <string.h>
#include <cctype> #include <ctype.h>
#include <cstdio> #include <stdio.h>
#include "dictmgr.hxx" #include "dictmgr.hxx"
using namespace std; DictMgr::DictMgr(const char * dictpath, const char * etype) : numdict(0)
DictMgr::DictMgr(const char * dictpath, const char * etype)
{ {
// load list of etype entries // load list of etype entries
numdict = 0;
pdentry = (dictentry *)malloc(MAXDICTIONARIES*sizeof(struct dictentry)); pdentry = (dictentry *)malloc(MAXDICTIONARIES*sizeof(struct dictentry));
if (pdentry) { if (pdentry) {
if (parse_file(dictpath, etype)) { if (parse_file(dictpath, etype)) {
numdict = 0; numdict = 0;
// no dictionary.lst found is okay // no dictionary.lst found is okay
} }
} else {
numdict = 0;
} }
} }
@ -101,6 +96,16 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
numdict++; numdict++;
pdict++; pdict++;
} else { } else {
switch (i) {
case 3:
free(pdict->region);
pdict->region=NULL;
case 2: //deliberate fallthrough
free(pdict->lang);
pdict->lang=NULL;
default:
break;
}
fprintf(stderr,"dictionary list corruption in line \"%s\"\n",line); fprintf(stderr,"dictionary list corruption in line \"%s\"\n",line);
fflush(stderr); fflush(stderr);
} }
@ -128,17 +133,16 @@ char * DictMgr::mystrsep(char ** stringp, const char delim)
{ {
char * rv = NULL; char * rv = NULL;
char * mp = *stringp; char * mp = *stringp;
int n = strlen(mp); size_t n = strlen(mp);
if (n > 0) { if (n > 0) {
char * dp = (char *)memchr(mp,(int)((unsigned char)delim),n); char * dp = (char *)memchr(mp,(int)((unsigned char)delim),n);
if (dp) { if (dp) {
*stringp = dp+1; *stringp = dp+1;
int nc = (int)((unsigned long)dp - (unsigned long)mp); size_t nc = dp - mp;
rv = (char *) malloc(nc+1); rv = (char *) malloc(nc+1);
if (rv) { if (rv) {
memcpy(rv,mp,nc); memcpy(rv,mp,nc);
*(rv+nc) = '\0'; *(rv+nc) = '\0';
return rv;
} }
} else { } else {
rv = (char *) malloc(n+1); rv = (char *) malloc(n+1);
@ -146,11 +150,10 @@ char * DictMgr::mystrsep(char ** stringp, const char delim)
memcpy(rv, mp, n); memcpy(rv, mp, n);
*(rv+n) = '\0'; *(rv+n) = '\0';
*stringp = mp + n; *stringp = mp + n;
return rv;
} }
} }
} }
return NULL; return rv;
} }
@ -159,9 +162,9 @@ char * DictMgr::mystrdup(const char * s)
{ {
char * d = NULL; char * d = NULL;
if (s) { if (s) {
int sl = strlen(s); int sl = strlen(s)+1;
d = (char *) malloc(((sl+1) * sizeof(char))); d = (char *) malloc(sl);
if (d) memcpy(d,s,((sl+1)*sizeof(char))); if (d) memcpy(d,s,sl);
} }
return d; return d;
} }

View File

@ -1,6 +1,8 @@
#ifndef _DICTMGR_HXX_ #ifndef _DICTMGR_HXX_
#define _DICTMGR_HXX_ #define _DICTMGR_HXX_
#include "hunvisapi.h"
#define MAXDICTIONARIES 100 #define MAXDICTIONARIES 100
#define MAXDICTENTRYLEN 1024 #define MAXDICTENTRYLEN 1024
@ -11,7 +13,7 @@ struct dictentry {
}; };
class DictMgr class LIBHUNSPELL_DLL_EXPORTED DictMgr
{ {
int numdict; int numdict;

View File

@ -0,0 +1,49 @@
#include "license.hunspell"
#include "license.myspell"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "filemgr.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");
if (!fin) {
// check hzipped file
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
if (st) {
strcpy(st, file);
strcat(st, HZIP_EXTENSION);
hin = new Hunzip(st, key);
free(st);
}
}
if (!fin && !hin) fail(MSG_OPEN, file);
}
FileMgr::~FileMgr()
{
if (fin) fclose(fin);
if (hin) delete hin;
}
char * FileMgr::getline() {
const char * l;
linenum++;
if (fin) return fgets(in, BUFSIZE - 1, fin);
if (hin && (l = hin->getline())) return strcpy(in, l);
linenum--;
return NULL;
}
int FileMgr::getlinenum() {
return linenum;
}

View File

@ -0,0 +1,25 @@
/* file manager class - read lines of files [filename] OR [filename.hz] */
#ifndef _FILEMGR_HXX_
#define _FILEMGR_HXX_
#include "hunvisapi.h"
#include "hunzip.hxx"
#include <stdio.h>
class LIBHUNSPELL_DLL_EXPORTED FileMgr
{
protected:
FILE * fin;
Hunzip * hin;
char in[BUFSIZE + 50]; // input buffer
int fail(const char * err, const char * par);
int linenum;
public:
FileMgr(const char * filename, const char * key = NULL);
~FileMgr();
char * getline();
int getlinenum();
};
#endif

View File

@ -1,35 +1,18 @@
#include "license.hunspell" #include "license.hunspell"
#include "license.myspell" #include "license.myspell"
#ifndef MOZILLA_CLIENT
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cctype>
#else
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#endif
#include "hashmgr.hxx" #include "hashmgr.hxx"
#include "csutil.hxx" #include "csutil.hxx"
#include "atypes.hxx" #include "atypes.hxx"
#ifdef MOZILLA_CLIENT
#ifdef __SUNPRO_CC // for SunONE Studio compiler
using namespace std;
#endif
#else
#ifndef W32
using namespace std;
#endif
#endif
// build a hash table from a munched word list // build a hash table from a munched word list
HashMgr::HashMgr(const char * tpath, const char * apath) HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
{ {
tablesize = 0; tablesize = 0;
tableptr = NULL; tableptr = NULL;
@ -48,8 +31,8 @@ HashMgr::HashMgr(const char * tpath, const char * apath)
numaliasm = 0; numaliasm = 0;
aliasm = NULL; aliasm = NULL;
forbiddenword = FORBIDDENWORD; // forbidden word signing flag forbiddenword = FORBIDDENWORD; // forbidden word signing flag
load_config(apath); load_config(apath, key);
int ec = load_tables(tpath); int ec = load_tables(tpath, key);
if (ec) { if (ec) {
/* error condition - what should we do here */ /* error condition - what should we do here */
HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n",ec); HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n",ec);
@ -107,6 +90,10 @@ HashMgr::~HashMgr()
if (ignorechars) free(ignorechars); if (ignorechars) free(ignorechars);
if (ignorechars_utf16) free(ignorechars_utf16); if (ignorechars_utf16) free(ignorechars_utf16);
#ifdef MOZILLA_CLIENT
delete [] csconv;
#endif
} }
// lookup a root word in the hashtable // lookup a root word in the hashtable
@ -118,7 +105,7 @@ struct hentry * HashMgr::lookup(const char *word) const
dp = tableptr[hash(word)]; dp = tableptr[hash(word)];
if (!dp) return NULL; if (!dp) return NULL;
for ( ; dp != NULL; dp = dp->next) { for ( ; dp != NULL; dp = dp->next) {
if (strcmp(word,&(dp->word)) == 0) return dp; if (strcmp(word, dp->word) == 0) return dp;
} }
} }
return NULL; return NULL;
@ -129,12 +116,12 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
int al, const char * desc, bool onlyupcase) int al, const char * desc, bool onlyupcase)
{ {
bool upcasehomonym = false; bool upcasehomonym = false;
int descl = desc ? (aliasm ? sizeof(char *) : strlen(desc) + 1) : 0; int descl = desc ? (aliasm ? sizeof(short) : strlen(desc) + 1) : 0;
// variable-length hash record with word and optional fields // variable-length hash record with word and optional fields
struct hentry* hp = struct hentry* hp =
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl); (struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
if (!hp) return 1; if (!hp) return 1;
char * hpw = &(hp->word); char * hpw = hp->word;
strcpy(hpw, word); strcpy(hpw, word);
if (ignorechars != NULL) { if (ignorechars != NULL) {
if (utf8) { if (utf8) {
@ -161,7 +148,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
hp->var = H_OPT; hp->var = H_OPT;
if (aliasm) { if (aliasm) {
hp->var += H_OPT_ALIASM; hp->var += H_OPT_ALIASM;
*((char **) (hpw + wbl + 1)) = get_aliasm(atoi(desc)); store_pointer(hpw + wbl + 1, get_aliasm(atoi(desc)));
} else { } else {
strcpy(hpw + wbl + 1, desc); strcpy(hpw + wbl + 1, desc);
if (complexprefixes) { if (complexprefixes) {
@ -178,7 +165,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
return 0; return 0;
} }
while (dp->next != NULL) { while (dp->next != NULL) {
if ((!dp->next_homonym) && (strcmp(&(hp->word), &(dp->word)) == 0)) { if ((!dp->next_homonym) && (strcmp(hp->word, dp->word) == 0)) {
// remove hidden onlyupcase homonym // remove hidden onlyupcase homonym
if (!onlyupcase) { if (!onlyupcase) {
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) { if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
@ -196,7 +183,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
} }
dp=dp->next; dp=dp->next;
} }
if (strcmp(&(hp->word), &(dp->word)) == 0) { if (strcmp(hp->word, dp->word) == 0) {
// remove hidden onlyupcase homonym // remove hidden onlyupcase homonym
if (!onlyupcase) { if (!onlyupcase) {
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) { if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
@ -236,12 +223,12 @@ int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
if (al) memcpy(flags2, flags, al * sizeof(unsigned short)); if (al) memcpy(flags2, flags, al * sizeof(unsigned short));
flags2[al] = ONLYUPCASEFLAG; flags2[al] = ONLYUPCASEFLAG;
if (utf8) { if (utf8) {
char st[MAXDELEN]; char st[BUFSIZE];
w_char w[MAXDELEN]; w_char w[BUFSIZE];
int wlen = u8_u16(w, MAXDELEN, word); int wlen = u8_u16(w, BUFSIZE, word);
mkallsmall_utf(w, wlen, langnum); mkallsmall_utf(w, wlen, langnum);
mkallcap_utf(w, 1, langnum); mkallcap_utf(w, 1, langnum);
u16_u8(st, MAXDELEN, w, wlen); u16_u8(st, BUFSIZE, w, wlen);
return add_word(st,wbl,wcl,flags2,al+1,dp, true); return add_word(st,wbl,wcl,flags2,al+1,dp, true);
} else { } else {
mkallsmall(word, csconv); mkallsmall(word, csconv);
@ -256,8 +243,8 @@ int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
int HashMgr::get_clen_and_captype(const char * word, int wbl, int * captype) { int HashMgr::get_clen_and_captype(const char * word, int wbl, int * captype) {
int len; int len;
if (utf8) { if (utf8) {
w_char dest_utf[MAXDELEN]; w_char dest_utf[BUFSIZE];
len = u8_u16(dest_utf, MAXDELEN, word); len = u8_u16(dest_utf, BUFSIZE, word);
*captype = get_captype_utf8(dest_utf, len, langnum); *captype = get_captype_utf8(dest_utf, len, langnum);
} else { } else {
len = wbl; len = wbl;
@ -266,52 +253,70 @@ int HashMgr::get_clen_and_captype(const char * word, int wbl, int * captype) {
return len; return len;
} }
// remove word with FORBIDDENWORD flag (not implemented) // remove word (personal dictionary function for standalone applications)
int HashMgr::remove(const char * word) int HashMgr::remove(const char * word)
{ {
struct hentry * dp = lookup(word); struct hentry * dp = lookup(word);
/* while (dp) {
if (!word || (!dp->astr || !TESTAFF(dp->astr, forbiddenword, pt->alen))) { if (dp->alen == 0 || !TESTAFF(dp->astr, forbiddenword, dp->alen)) {
int wbl = strlen(word); unsigned short * flags =
int wcl = get_clen_and_captype(word, wbl, &captype); (unsigned short *) malloc(sizeof(short) * (dp->alen + 1));
if (aliasf) { if (!flags) return 1;
add_word(word, wbl, wcl, dp->astr, dp->alen, NULL, false); for (int i = 0; i < dp->alen; i++) flags[i] = dp->astr[i];
} else { flags[dp->alen] = forbiddenword;
unsigned short * flags = (unsigned short *) malloc (dp->alen * sizeof(short)); dp->astr = flags;
if (flags) { dp->alen++;
memcpy((void *) flags, (void *) dp->astr, dp->alen * sizeof(short)); flag_qsort(flags, 0, dp->alen);
add_word(word, wbl, wcl, flags, dp->alen, NULL, false);
} else return 1;
} }
return add_hidden_capitalized_word((char *) word, wbl, wcl, dp->astr, dp->alen, NULL, captype); dp = dp->next_homonym;
} }
*/ return 0;
return 1; }
/* remove forbidden flag to add a personal word to the hash */
int HashMgr::remove_forbidden_flag(const char * word) {
struct hentry * dp = lookup(word);
if (!dp) return 1;
while (dp) {
if (dp->astr && TESTAFF(dp->astr, forbiddenword, dp->alen)) {
if (dp->alen == 1) dp->alen = 0; // XXX forbidden words of personal dic.
else {
unsigned short * flags2 =
(unsigned short *) malloc(sizeof(short) * (dp->alen - 1));
if (!flags2) return 1;
int i, j = 0;
for (i = 0; i < dp->alen; i++) {
if (dp->astr[i] != forbiddenword) flags2[j++] = dp->astr[i];
}
dp->alen--;
dp->astr = flags2; // XXX allowed forbidden words
}
}
dp = dp->next_homonym;
}
return 0;
} }
// add a custom dic. word to the hash table (public) // add a custom dic. word to the hash table (public)
int HashMgr::add(const char * word, char * aff) int HashMgr::add(const char * word)
{ {
unsigned short * flags; unsigned short * flags = NULL;
int al = 0; int al = 0;
if (aff) { if (remove_forbidden_flag(word)) {
al = decode_flags(&flags, aff); int captype;
flag_qsort(flags, 0, al); int wbl = strlen(word);
} else { int wcl = get_clen_and_captype(word, wbl, &captype);
flags = NULL; add_word(word, wbl, wcl, flags, al, NULL, false);
return add_hidden_capitalized_word((char *) word, wbl, wcl, flags, al, NULL, captype);
} }
return 0;
int captype;
int wbl = strlen(word);
int wcl = get_clen_and_captype(word, wbl, &captype);
add_word(word, wbl, wcl, flags, al, NULL, false);
return add_hidden_capitalized_word((char *) word, wbl, wcl, flags, al, NULL, captype);
} }
int HashMgr::add_with_affix(const char * word, const char * example) int HashMgr::add_with_affix(const char * word, const char * example)
{ {
// detect captype and modify word length for UTF-8 encoding // detect captype and modify word length for UTF-8 encoding
struct hentry * dp = lookup(example); struct hentry * dp = lookup(example);
remove_forbidden_flag(word);
if (dp && dp->astr) { if (dp && dp->astr) {
int captype; int captype;
int wbl = strlen(word); int wbl = strlen(word);
@ -344,22 +349,23 @@ struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const
} }
// load a munched word list and build a hash table on the fly // load a munched word list and build a hash table on the fly
int HashMgr::load_tables(const char * tpath) int HashMgr::load_tables(const char * tpath, const char * key)
{ {
int al; int al;
char * ap; char * ap;
char * dp; char * dp;
char * dp2;
unsigned short * flags; unsigned short * flags;
char * ts;
// raw dictionary - munched file // open dictionary file
FILE * rawdict = fopen(tpath, "r"); FileMgr * dict = new FileMgr(tpath, key);
if (rawdict == NULL) return 1; if (dict == NULL) return 1;
// first read the first line of file to get hash table size */ // first read the first line of file to get hash table size */
char ts[MAXDELEN]; if (!(ts = dict->getline())) {
if (! fgets(ts, MAXDELEN-1,rawdict)) {
HUNSPELL_WARNING(stderr, "error: empty dic file\n"); HUNSPELL_WARNING(stderr, "error: empty dic file\n");
fclose(rawdict); delete dict;
return 2; return 2;
} }
mychomp(ts); mychomp(ts);
@ -367,13 +373,13 @@ int HashMgr::load_tables(const char * tpath)
/* remove byte order mark */ /* remove byte order mark */
if (strncmp(ts,"\xEF\xBB\xBF",3) == 0) { if (strncmp(ts,"\xEF\xBB\xBF",3) == 0) {
memmove(ts, ts+3, strlen(ts+3)+1); memmove(ts, ts+3, strlen(ts+3)+1);
HUNSPELL_WARNING(stderr, "warning: dic file begins with byte order mark: possible incompatibility with old Hunspell versions\n"); // warning: dic file begins with byte order mark: possible incompatibility with old Hunspell versions
} }
if ((*ts < '1') || (*ts > '9')) HUNSPELL_WARNING(stderr, "error - missing word count in dictionary file\n");
tablesize = atoi(ts); tablesize = atoi(ts);
if (!tablesize) { if (tablesize == 0) {
fclose(rawdict); HUNSPELL_WARNING(stderr, "error: line 1: missing or bad word count in the dic file\n");
delete dict;
return 4; return 4;
} }
tablesize = tablesize + 5 + USERWORD; tablesize = tablesize + 5 + USERWORD;
@ -382,7 +388,7 @@ int HashMgr::load_tables(const char * tpath)
// allocate the hash table // allocate the hash table
tableptr = (struct hentry **) malloc(tablesize * sizeof(struct hentry *)); tableptr = (struct hentry **) malloc(tablesize * sizeof(struct hentry *));
if (! tableptr) { if (! tableptr) {
fclose(rawdict); delete dict;
return 3; return 3;
} }
for (int i=0; i<tablesize; i++) tableptr[i] = NULL; for (int i=0; i<tablesize; i++) tableptr[i] = NULL;
@ -390,18 +396,29 @@ int HashMgr::load_tables(const char * tpath)
// loop through all words on much list and add to hash // loop through all words on much list and add to hash
// table and create word and affix strings // table and create word and affix strings
while (fgets(ts,MAXDELEN-1,rawdict)) { while ((ts = dict->getline())) {
mychomp(ts); mychomp(ts);
// split each line into word and morphological description // split each line into word and morphological description
dp = strchr(ts,'\t'); dp = ts;
char * dp2 = strchr(ts,' '); while ((dp = strchr(dp, ':'))) {
if (dp2 && (!dp || (dp2 < dp))) dp = dp2; if ((dp > ts + 3) && (*(dp - 3) == ' ' || *(dp - 3) == '\t')) {
for (dp -= 4; dp >= ts && (*dp == ' ' || *dp == '\t'); dp--);
if (dp < ts) { // missing word
dp = NULL;
} else {
*(dp + 1) = '\0';
dp = dp + 2;
}
break;
}
dp++;
}
if (dp) { // tabulator is the old morphological field separator
*dp = '\0'; dp2 = strchr(ts, '\t');
dp++; if (dp2 && (!dp || dp2 < dp)) {
} else { *dp2 = '\0';
dp = NULL; dp = dp2 + 1;
} }
// split each line into word and affix char strings // split each line into word and affix char strings
@ -422,13 +439,18 @@ int HashMgr::load_tables(const char * tpath)
*ap = '\0'; *ap = '\0';
if (aliasf) { if (aliasf) {
int index = atoi(ap + 1); int index = atoi(ap + 1);
al = get_aliasf(index, &flags); al = get_aliasf(index, &flags, dict);
if (!al) { if (!al) {
HUNSPELL_WARNING(stderr, "error - bad flag vector alias: %s\n", ts); HUNSPELL_WARNING(stderr, "error: line %d: bad flag vector alias\n", dict->getlinenum());
*ap = '\0'; *ap = '\0';
} }
} else { } else {
al = decode_flags(&flags, ap + 1); al = decode_flags(&flags, ap + 1, dict);
if (al == -1) {
HUNSPELL_WARNING(stderr, "Can't allocate memory.\n");
delete dict;
return 6;
}
flag_qsort(flags, 0, al); flag_qsort(flags, 0, al);
} }
} else { } else {
@ -443,16 +465,15 @@ int HashMgr::load_tables(const char * tpath)
// add the word and its index plus its capitalized form optionally // add the word and its index plus its capitalized form optionally
if (add_word(ts,wbl,wcl,flags,al,dp, false) || if (add_word(ts,wbl,wcl,flags,al,dp, false) ||
add_hidden_capitalized_word(ts, wbl, wcl, flags, al, dp, captype)) { add_hidden_capitalized_word(ts, wbl, wcl, flags, al, dp, captype)) {
fclose(rawdict); delete dict;
return 5; return 5;
} }
} }
fclose(rawdict); delete dict;
return 0; return 0;
} }
// the hash function is a simple load and rotate // the hash function is a simple load and rotate
// algorithm borrowed // algorithm borrowed
@ -468,12 +489,16 @@ int HashMgr::hash(const char * word) const
return (unsigned long) hv % tablesize; return (unsigned long) hv % tablesize;
} }
int HashMgr::decode_flags(unsigned short ** result, char * flags) { int HashMgr::decode_flags(unsigned short ** result, char * flags, FileMgr * af) {
int len; int len;
if (*flags == '\0') {
*result = NULL;
return 0;
}
switch (flag_mode) { switch (flag_mode) {
case FLAG_LONG: { // two-character flags (1x2yZz -> 1x 2y Zz) case FLAG_LONG: { // two-character flags (1x2yZz -> 1x 2y Zz)
len = strlen(flags); len = strlen(flags);
if (len%2 == 1) HUNSPELL_WARNING(stderr, "error: length of FLAG_LONG flagvector is odd: %s\n", flags); if (len%2 == 1) HUNSPELL_WARNING(stderr, "error: line %d: bad flagvector\n", af->getlinenum());
len /= 2; len /= 2;
*result = (unsigned short *) malloc(len * sizeof(short)); *result = (unsigned short *) malloc(len * sizeof(short));
if (!*result) return -1; if (!*result) return -1;
@ -483,6 +508,7 @@ int HashMgr::decode_flags(unsigned short ** result, char * flags) {
break; break;
} }
case FLAG_NUM: { // decimal numbers separated by comma (4521,23,233 -> 4521 23 233) case FLAG_NUM: { // decimal numbers separated by comma (4521,23,233 -> 4521 23 233)
int i;
len = 1; len = 1;
char * src = flags; char * src = flags;
unsigned short * dest; unsigned short * dest;
@ -495,19 +521,25 @@ int HashMgr::decode_flags(unsigned short ** result, char * flags) {
dest = *result; dest = *result;
for (p = flags; *p; p++) { for (p = flags; *p; p++) {
if (*p == ',') { if (*p == ',') {
*dest = (unsigned short) atoi(src); i = atoi(src);
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: 0 is wrong flag id\n"); if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: line %d: flag id %d is too large (max: %d)\n",
af->getlinenum(), i, DEFAULTFLAGS - 1);
*dest = (unsigned short) i;
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: line %d: 0 is wrong flag id\n", af->getlinenum());
src = p + 1; src = p + 1;
dest++; dest++;
} }
} }
*dest = (unsigned short) atoi(src); i = atoi(src);
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: 0 is wrong flag id\n"); if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: line %d: flag id %d is too large (max: %d)\n",
af->getlinenum(), i, DEFAULTFLAGS - 1);
*dest = (unsigned short) i;
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: line %d: 0 is wrong flag id\n", af->getlinenum());
break; break;
} }
case FLAG_UNI: { // UTF-8 characters case FLAG_UNI: { // UTF-8 characters
w_char w[MAXDELEN/2]; w_char w[BUFSIZE/2];
len = u8_u16(w, MAXDELEN/2, flags); len = u8_u16(w, BUFSIZE/2, flags);
*result = (unsigned short *) malloc(len * sizeof(short)); *result = (unsigned short *) malloc(len * sizeof(short));
if (!*result) return -1; if (!*result) return -1;
memcpy(*result, w, len * sizeof(short)); memcpy(*result, w, len * sizeof(short));
@ -530,12 +562,15 @@ int HashMgr::decode_flags(unsigned short ** result, char * flags) {
unsigned short HashMgr::decode_flag(const char * f) { unsigned short HashMgr::decode_flag(const char * f) {
unsigned short s = 0; unsigned short s = 0;
int i;
switch (flag_mode) { switch (flag_mode) {
case FLAG_LONG: case FLAG_LONG:
s = ((unsigned short) f[0] << 8) + (unsigned short) f[1]; s = ((unsigned short) f[0] << 8) + (unsigned short) f[1];
break; break;
case FLAG_NUM: case FLAG_NUM:
s = (unsigned short) atoi(f); i = atoi(f);
if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: flag id %d is too large (max: %d)\n", i, DEFAULTFLAGS - 1);
s = (unsigned short) i;
break; break;
case FLAG_UNI: case FLAG_UNI:
u8_u16((w_char *) &s, 1, f); u8_u16((w_char *) &s, 1, f);
@ -543,7 +578,7 @@ unsigned short HashMgr::decode_flag(const char * f) {
default: default:
s = (unsigned short) *((unsigned char *)f); s = (unsigned short) *((unsigned char *)f);
} }
if (!s) HUNSPELL_WARNING(stderr, "error: 0 is wrong flag id\n"); if (s == 0) HUNSPELL_WARNING(stderr, "error: 0 is wrong flag id\n");
return s; return s;
} }
@ -566,16 +601,13 @@ char * HashMgr::encode_flag(unsigned short f) {
} }
// read in aff file and set flag mode // read in aff file and set flag mode
int HashMgr::load_config(const char * affpath) int HashMgr::load_config(const char * affpath, const char * key)
{ {
char * line; // io buffers
int firstline = 1; int firstline = 1;
// io buffers
char line[MAXDELEN+1];
// open the affix file // open the affix file
FILE * afflst; FileMgr * afflst = new FileMgr(affpath, key);
afflst = fopen(affpath,"r");
if (!afflst) { if (!afflst) {
HUNSPELL_WARNING(stderr, "Error - could not open affix description file %s\n",affpath); HUNSPELL_WARNING(stderr, "Error - could not open affix description file %s\n",affpath);
return 1; return 1;
@ -584,7 +616,7 @@ int HashMgr::load_config(const char * affpath)
// read in each line ignoring any that do not // read in each line ignoring any that do not
// start with a known line type indicator // start with a known line type indicator
while (fgets(line,MAXDELEN,afflst)) { while ((line = afflst->getline())) {
mychomp(line); mychomp(line);
/* remove byte order mark */ /* remove byte order mark */
@ -596,27 +628,27 @@ int HashMgr::load_config(const char * affpath)
/* parse in the try string */ /* parse in the try string */
if ((strncmp(line,"FLAG",4) == 0) && isspace(line[4])) { if ((strncmp(line,"FLAG",4) == 0) && isspace(line[4])) {
if (flag_mode != FLAG_CHAR) { if (flag_mode != FLAG_CHAR) {
HUNSPELL_WARNING(stderr, "error: duplicate FLAG parameter\n"); HUNSPELL_WARNING(stderr, "error: line %d: multiple definitions of the FLAG affix file parameter\n", afflst->getlinenum());
} }
if (strstr(line, "long")) flag_mode = FLAG_LONG; if (strstr(line, "long")) flag_mode = FLAG_LONG;
if (strstr(line, "num")) flag_mode = FLAG_NUM; if (strstr(line, "num")) flag_mode = FLAG_NUM;
if (strstr(line, "UTF-8")) flag_mode = FLAG_UNI; if (strstr(line, "UTF-8")) flag_mode = FLAG_UNI;
if (flag_mode == FLAG_CHAR) { if (flag_mode == FLAG_CHAR) {
HUNSPELL_WARNING(stderr, "error: FLAG need `num', `long' or `UTF-8' parameter: %s\n", line); HUNSPELL_WARNING(stderr, "error: line %d: FLAG needs `num', `long' or `UTF-8' parameter\n", afflst->getlinenum());
} }
} }
if (strncmp(line,"FORBIDDENWORD",13) == 0) { if (strncmp(line,"FORBIDDENWORD",13) == 0) {
char * st = NULL; char * st = NULL;
if (parse_string(line, &st, "FORBIDDENWORD")) { if (parse_string(line, &st, afflst->getlinenum())) {
fclose(afflst); delete afflst;
return 1; return 1;
} }
forbiddenword = decode_flag(st); forbiddenword = decode_flag(st);
free(st); free(st);
} }
if (strncmp(line, "SET", 3) == 0) { if (strncmp(line, "SET", 3) == 0) {
if (parse_string(line, &enc, "SET")) { if (parse_string(line, &enc, afflst->getlinenum())) {
fclose(afflst); delete afflst;
return 1; return 1;
} }
if (strcmp(enc, "UTF-8") == 0) { if (strcmp(enc, "UTF-8") == 0) {
@ -629,8 +661,8 @@ int HashMgr::load_config(const char * affpath)
} else csconv = get_current_cs(enc); } else csconv = get_current_cs(enc);
} }
if (strncmp(line, "LANG", 4) == 0) { if (strncmp(line, "LANG", 4) == 0) {
if (parse_string(line, &lang, "LANG")) { if (parse_string(line, &lang, afflst->getlinenum())) {
fclose(afflst); delete afflst;
return 1; return 1;
} }
langnum = get_lang_num(lang); langnum = get_lang_num(lang);
@ -638,22 +670,23 @@ int HashMgr::load_config(const char * affpath)
/* parse in the ignored characters (for example, Arabic optional diacritics characters */ /* parse in the ignored characters (for example, Arabic optional diacritics characters */
if (strncmp(line,"IGNORE",6) == 0) { if (strncmp(line,"IGNORE",6) == 0) {
if (parse_array(line, &ignorechars, &ignorechars_utf16, &ignorechars_utf16_len, "IGNORE", utf8)) { if (parse_array(line, &ignorechars, &ignorechars_utf16,
fclose(afflst); &ignorechars_utf16_len, utf8, afflst->getlinenum())) {
delete afflst;
return 1; return 1;
} }
} }
if ((strncmp(line,"AF",2) == 0) && isspace(line[2])) { if ((strncmp(line,"AF",2) == 0) && isspace(line[2])) {
if (parse_aliasf(line, afflst)) { if (parse_aliasf(line, afflst)) {
fclose(afflst); delete afflst;
return 1; return 1;
} }
} }
if ((strncmp(line,"AM",2) == 0) && isspace(line[2])) { if ((strncmp(line,"AM",2) == 0) && isspace(line[2])) {
if (parse_aliasm(line, afflst)) { if (parse_aliasm(line, afflst)) {
fclose(afflst); delete afflst;
return 1; return 1;
} }
} }
@ -661,16 +694,16 @@ int HashMgr::load_config(const char * affpath)
if (strncmp(line,"COMPLEXPREFIXES",15) == 0) complexprefixes = 1; if (strncmp(line,"COMPLEXPREFIXES",15) == 0) complexprefixes = 1;
if (((strncmp(line,"SFX",3) == 0) || (strncmp(line,"PFX",3) == 0)) && isspace(line[3])) break; if (((strncmp(line,"SFX",3) == 0) || (strncmp(line,"PFX",3) == 0)) && isspace(line[3])) break;
} }
if (csconv == NULL) csconv = get_current_cs("ISO8859-1"); if (csconv == NULL) csconv = get_current_cs(SPELL_ENCODING);
fclose(afflst); delete afflst;
return 0; return 0;
} }
/* parse in the ALIAS table */ /* parse in the ALIAS table */
int HashMgr::parse_aliasf(char * line, FILE * af) int HashMgr::parse_aliasf(char * line, FileMgr * af)
{ {
if (numaliasf != 0) { if (numaliasf != 0) {
HUNSPELL_WARNING(stderr, "error: duplicate AF (alias for flag vector) tables used\n"); HUNSPELL_WARNING(stderr, "error: line %d: multiple table definitions\n", af->getlinenum());
return 1; return 1;
} }
char * tp = line; char * tp = line;
@ -688,8 +721,7 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
numaliasf = 0; numaliasf = 0;
aliasf = NULL; aliasf = NULL;
aliasflen = NULL; aliasflen = NULL;
HUNSPELL_WARNING(stderr, "incorrect number of entries in AF table\n"); HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n", af->getlinenum());
// free(piece);
return 1; return 1;
} }
aliasf = (unsigned short **) malloc(numaliasf * sizeof(unsigned short *)); aliasf = (unsigned short **) malloc(numaliasf * sizeof(unsigned short *));
@ -709,7 +741,6 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
} }
i++; i++;
} }
// free(piece);
piece = mystrsep(&tp, 0); piece = mystrsep(&tp, 0);
} }
if (np != 2) { if (np != 2) {
@ -718,14 +749,14 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
free(aliasflen); free(aliasflen);
aliasf = NULL; aliasf = NULL;
aliasflen = NULL; aliasflen = NULL;
HUNSPELL_WARNING(stderr, "error: missing AF table information\n"); HUNSPELL_WARNING(stderr, "error: line %d: missing data\n", af->getlinenum());
return 1; return 1;
} }
/* now parse the numaliasf lines to read in the remainder of the table */ /* now parse the numaliasf lines to read in the remainder of the table */
char * nl = line; char * nl;
for (int j=0; j < numaliasf; j++) { for (int j=0; j < numaliasf; j++) {
if (!fgets(nl,MAXDELEN,af)) return 1; if (!(nl = af->getline())) return 1;
mychomp(nl); mychomp(nl);
tp = nl; tp = nl;
i = 0; i = 0;
@ -742,14 +773,13 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
free(aliasflen); free(aliasflen);
aliasf = NULL; aliasf = NULL;
aliasflen = NULL; aliasflen = NULL;
HUNSPELL_WARNING(stderr, "error: AF table is corrupt\n"); HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
// free(piece);
return 1; return 1;
} }
break; break;
} }
case 1: { case 1: {
aliasflen[j] = (unsigned short) decode_flags(&(aliasf[j]), piece); aliasflen[j] = (unsigned short) decode_flags(&(aliasf[j]), piece, af);
flag_qsort(aliasf[j], 0, aliasflen[j]); flag_qsort(aliasf[j], 0, aliasflen[j]);
break; break;
} }
@ -757,7 +787,6 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
} }
i++; i++;
} }
// free(piece);
piece = mystrsep(&tp, 0); piece = mystrsep(&tp, 0);
} }
if (!aliasf[j]) { if (!aliasf[j]) {
@ -766,7 +795,7 @@ int HashMgr::parse_aliasf(char * line, FILE * af)
aliasf = NULL; aliasf = NULL;
aliasflen = NULL; aliasflen = NULL;
numaliasf = 0; numaliasf = 0;
HUNSPELL_WARNING(stderr, "error: AF table is corrupt\n"); HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
return 1; return 1;
} }
} }
@ -777,21 +806,21 @@ int HashMgr::is_aliasf() {
return (aliasf != NULL); return (aliasf != NULL);
} }
int HashMgr::get_aliasf(int index, unsigned short ** fvec) { int HashMgr::get_aliasf(int index, unsigned short ** fvec, FileMgr * af) {
if ((index > 0) && (index <= numaliasf)) { if ((index > 0) && (index <= numaliasf)) {
*fvec = aliasf[index - 1]; *fvec = aliasf[index - 1];
return aliasflen[index - 1]; return aliasflen[index - 1];
} }
HUNSPELL_WARNING(stderr, "error: bad flag alias index: %d\n", index); HUNSPELL_WARNING(stderr, "error: line %d: bad flag alias index: %d\n", af->getlinenum(), index);
*fvec = NULL; *fvec = NULL;
return 0; return 0;
} }
/* parse morph alias definitions */ /* parse morph alias definitions */
int HashMgr::parse_aliasm(char * line, FILE * af) int HashMgr::parse_aliasm(char * line, FileMgr * af)
{ {
if (numaliasm != 0) { if (numaliasm != 0) {
HUNSPELL_WARNING(stderr, "error: duplicate AM (aliases for morphological descriptions) tables used\n"); HUNSPELL_WARNING(stderr, "error: line %d: multiple table definitions\n", af->getlinenum());
return 1; return 1;
} }
char * tp = line; char * tp = line;
@ -806,8 +835,7 @@ int HashMgr::parse_aliasm(char * line, FILE * af)
case 1: { case 1: {
numaliasm = atoi(piece); numaliasm = atoi(piece);
if (numaliasm < 1) { if (numaliasm < 1) {
HUNSPELL_WARNING(stderr, "incorrect number of entries in AM table\n"); HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n", af->getlinenum());
// free(piece);
return 1; return 1;
} }
aliasm = (char **) malloc(numaliasm * sizeof(char *)); aliasm = (char **) malloc(numaliasm * sizeof(char *));
@ -822,21 +850,20 @@ int HashMgr::parse_aliasm(char * line, FILE * af)
} }
i++; i++;
} }
// free(piece);
piece = mystrsep(&tp, 0); piece = mystrsep(&tp, 0);
} }
if (np != 2) { if (np != 2) {
numaliasm = 0; numaliasm = 0;
free(aliasm); free(aliasm);
aliasm = NULL; aliasm = NULL;
HUNSPELL_WARNING(stderr, "error: missing AM alias information\n"); HUNSPELL_WARNING(stderr, "error: line %d: missing data\n", af->getlinenum());
return 1; return 1;
} }
/* now parse the numaliasm lines to read in the remainder of the table */ /* now parse the numaliasm lines to read in the remainder of the table */
char * nl = line; char * nl = line;
for (int j=0; j < numaliasm; j++) { for (int j=0; j < numaliasm; j++) {
if (!fgets(nl,MAXDELEN,af)) return 1; if (!(nl = af->getline())) return 1;
mychomp(nl); mychomp(nl);
tp = nl; tp = nl;
i = 0; i = 0;
@ -847,8 +874,7 @@ int HashMgr::parse_aliasm(char * line, FILE * af)
switch(i) { switch(i) {
case 0: { case 0: {
if (strncmp(piece,"AM",2) != 0) { if (strncmp(piece,"AM",2) != 0) {
HUNSPELL_WARNING(stderr, "error: AM table is corrupt\n"); HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
// free(piece);
numaliasm = 0; numaliasm = 0;
free(aliasm); free(aliasm);
aliasm = NULL; aliasm = NULL;
@ -867,19 +893,24 @@ int HashMgr::parse_aliasm(char * line, FILE * af)
else reverseword(piece); else reverseword(piece);
} }
aliasm[j] = mystrdup(piece); aliasm[j] = mystrdup(piece);
if (!aliasm[j]) {
numaliasm = 0;
free(aliasm);
aliasm = NULL;
return 1;
}
break; } break; }
default: break; default: break;
} }
i++; i++;
} }
// free(piece);
piece = mystrsep(&tp, ' '); piece = mystrsep(&tp, ' ');
} }
if (!aliasm[j]) { if (!aliasm[j]) {
numaliasm = 0; numaliasm = 0;
free(aliasm); free(aliasm);
aliasm = NULL; aliasm = NULL;
HUNSPELL_WARNING(stderr, "error: map table is corrupt\n"); HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
return 1; return 1;
} }
} }

View File

@ -1,68 +1,68 @@
#ifndef _HASHMGR_HXX_ #ifndef _HASHMGR_HXX_
#define _HASHMGR_HXX_ #define _HASHMGR_HXX_
#ifndef MOZILLA_CLIENT #include "hunvisapi.h"
#include <cstdio>
#else
#include <stdio.h> #include <stdio.h>
#endif
#include "htypes.hxx" #include "htypes.hxx"
#include "filemgr.hxx"
enum flag { FLAG_CHAR, FLAG_LONG, FLAG_NUM, FLAG_UNI }; enum flag { FLAG_CHAR, FLAG_LONG, FLAG_NUM, FLAG_UNI };
class HashMgr class LIBHUNSPELL_DLL_EXPORTED HashMgr
{ {
int tablesize; int tablesize;
struct hentry ** tableptr; struct hentry ** tableptr;
int userword; int userword;
flag flag_mode; flag flag_mode;
int complexprefixes; int complexprefixes;
int utf8; int utf8;
unsigned short forbiddenword; unsigned short forbiddenword;
int langnum; int langnum;
char * enc; char * enc;
char * lang; char * lang;
struct cs_info * csconv; struct cs_info * csconv;
char * ignorechars; char * ignorechars;
unsigned short * ignorechars_utf16; unsigned short * ignorechars_utf16;
int ignorechars_utf16_len; int ignorechars_utf16_len;
int numaliasf; // flag vector `compression' with aliases int numaliasf; // flag vector `compression' with aliases
unsigned short ** aliasf; unsigned short ** aliasf;
unsigned short * aliasflen; unsigned short * aliasflen;
int numaliasm; // morphological desciption `compression' with aliases int numaliasm; // morphological desciption `compression' with aliases
char ** aliasm; char ** aliasm;
public: public:
HashMgr(const char * tpath, const char * apath); HashMgr(const char * tpath, const char * apath, const char * key = NULL);
~HashMgr(); ~HashMgr();
struct hentry * lookup(const char *) const; struct hentry * lookup(const char *) const;
int hash(const char *) const; int hash(const char *) const;
struct hentry * walk_hashtable(int & col, struct hentry * hp) const; struct hentry * walk_hashtable(int & col, struct hentry * hp) const;
int add(const char * word, char * aff); int add(const char * word);
int add_with_affix(const char * word, const char * pattern); int add_with_affix(const char * word, const char * pattern);
int remove(const char * word); int remove(const char * word);
int decode_flags(unsigned short ** result, char * flags); int decode_flags(unsigned short ** result, char * flags, FileMgr * af);
unsigned short decode_flag(const char * flag); unsigned short decode_flag(const char * flag);
char * encode_flag(unsigned short flag); char * encode_flag(unsigned short flag);
int is_aliasf(); int is_aliasf();
int get_aliasf(int index, unsigned short ** fvec); int get_aliasf(int index, unsigned short ** fvec, FileMgr * af);
int is_aliasm(); int is_aliasm();
char * get_aliasm(int index); char * get_aliasm(int index);
private: private:
int get_clen_and_captype(const char * word, int wbl, int * captype); int get_clen_and_captype(const char * word, int wbl, int * captype);
int load_tables(const char * tpath); int load_tables(const char * tpath, const char * key);
int add_word(const char * word, int wbl, int wcl, unsigned short * ap, int add_word(const char * word, int wbl, int wcl, unsigned short * ap,
int al, const char * desc, bool onlyupcase); int al, const char * desc, bool onlyupcase);
int load_config(const char * affpath); int load_config(const char * affpath, const char * key);
int parse_aliasf(char * line, FILE * af); int parse_aliasf(char * line, FileMgr * af);
int add_hidden_capitalized_word(char * word, int wbl, int wcl, int add_hidden_capitalized_word(char * word, int wbl, int wcl,
unsigned short * flags, int al, char * dp, int captype); unsigned short * flags, int al, char * dp, int captype);
int parse_aliasm(char * line, FILE * af); int parse_aliasm(char * line, FileMgr * af);
int remove_forbidden_flag(const char * word);
}; };

View File

@ -1,8 +1,6 @@
#ifndef _HTYPES_HXX_ #ifndef _HTYPES_HXX_
#define _HTYPES_HXX_ #define _HTYPES_HXX_
#define MAXDELEN 8192
#define ROTATE_LEN 5 #define ROTATE_LEN 5
#define ROTATE(v,q) \ #define ROTATE(v,q) \
@ -13,10 +11,8 @@
#define H_OPT_ALIASM (1 << 1) #define H_OPT_ALIASM (1 << 1)
#define H_OPT_PHON (1 << 2) #define H_OPT_PHON (1 << 2)
#define HENTRY_WORD(h) &(h->word) // see also csutil.hxx
#define HENTRY_DATA(h) (h->var ? ((h->var & H_OPT_ALIASM) ? \ #define HENTRY_WORD(h) &(h->word[0])
*((char **) (&(h->word) + h->blen + 1)) : &(h->word) + h->blen + 1) : NULL)
#define HENTRY_FIND(h,p) (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL)
// approx. number of user defined words // approx. number of user defined words
#define USERWORD 1000 #define USERWORD 1000
@ -30,7 +26,7 @@ struct hentry
struct hentry * next; // next word with same hash code struct hentry * next; // next word with same hash code
struct hentry * next_homonym; // next homonym word (with same hash code) struct hentry * next_homonym; // next homonym word (with same hash code)
char var; // variable fields (only for special pronounciation yet) char var; // variable fields (only for special pronounciation yet)
char word; // variable-length word (8-bit or UTF-8 encoding) char word[1]; // variable-length word (8-bit or UTF-8 encoding)
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,164 @@
# Microsoft Developer Studio Project File - Name="hunspell" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=hunspell - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "hunspell.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hunspell.mak" CFG="hunspell - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hunspell - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "hunspell - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "hunspell - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "W32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "W32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x40e /d "NDEBUG"
# ADD RSC /l 0x40e /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "hunspell - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "W32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "W32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40e /d "_DEBUG"
# ADD RSC /l 0x40e /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "hunspell - Win32 Release"
# Name "hunspell - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\affentry.cxx
# End Source File
# Begin Source File
SOURCE=.\affixmgr.cxx
# End Source File
# Begin Source File
SOURCE=.\csutil.cxx
# End Source File
# Begin Source File
SOURCE=.\dictmgr.cxx
# End Source File
# Begin Source File
SOURCE=.\hashmgr.cxx
# End Source File
# Begin Source File
SOURCE=.\hunspell.cxx
# End Source File
# Begin Source File
SOURCE=.\suggestmgr.cxx
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\affentry.hxx
# End Source File
# Begin Source File
SOURCE=.\affixmgr.hxx
# End Source File
# Begin Source File
SOURCE=.\atypes.hxx
# End Source File
# Begin Source File
SOURCE=.\baseaffix.hxx
# End Source File
# Begin Source File
SOURCE=.\csutil.hxx
# End Source File
# Begin Source File
SOURCE=.\dictmgr.hxx
# End Source File
# Begin Source File
SOURCE=.\hashmgr.hxx
# End Source File
# Begin Source File
SOURCE=.\htypes.hxx
# End Source File
# Begin Source File
SOURCE=.\langnum.hxx
# End Source File
# Begin Source File
SOURCE=.\hunspell.hxx
# End Source File
# Begin Source File
SOURCE=.\suggestmgr.hxx
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,21 +1,27 @@
#ifndef _MYSPELLMGR_H_ #ifndef _MYSPELLMGR_H_
#define _MYSPELLMGR_H_ #define _MYSPELLMGR_H_
#include "hunvisapi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct Hunhandle Hunhandle; typedef struct Hunhandle Hunhandle;
Hunhandle *Hunspell_create(const char * affpath, const char * dpath); LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath);
void Hunspell_destroy(Hunhandle *pHunspell);
LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
const char * key);
LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell);
/* spell(word) - spellcheck word /* spell(word) - spellcheck word
* output: 0 = bad word, not 0 = good word * output: 0 = bad word, not 0 = good word
*/ */
int Hunspell_spell(Hunhandle *pHunspell, const char *); LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *);
char *Hunspell_get_dic_encoding(Hunhandle *pHunspell); LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
/* suggest(suggestions, word) - search suggestions /* suggest(suggestions, word) - search suggestions
* input: pointer to an array of strings pointer and the (bad) word * input: pointer to an array of strings pointer and the (bad) word
@ -24,17 +30,17 @@ char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
* a newly allocated array of strings (*slts will be NULL when number * a newly allocated array of strings (*slts will be NULL when number
* of suggestion equals 0.) * of suggestion equals 0.)
*/ */
int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word); LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
/* morphological functions */ /* morphological functions */
/* analyze(result, word) - morphological analysis of the word */ /* analyze(result, word) - morphological analysis of the word */
int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word); LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word);
/* stem(result, word) - stemmer function */ /* stem(result, word) - stemmer function */
int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word); LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
/* stem(result, analysis, n) - get stems from a morph. analysis /* stem(result, analysis, n) - get stems from a morph. analysis
* example: * example:
@ -43,11 +49,11 @@ int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
* int n2 = Hunspell_stem2(result2, result, n1); * int n2 = Hunspell_stem2(result2, result, n1);
*/ */
int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n); LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n);
/* generate(result, word, word2) - morphological generation by example(s) */ /* generate(result, word, word2) - morphological generation by example(s) */
int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word, LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
const char * word2); const char * word2);
/* generate(result, word, desc, n) - generation by morph. description(s) /* generate(result, word, desc, n) - generation by morph. description(s)
@ -58,27 +64,29 @@ int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
* for (int i = 0; i < n; i++) printf("%s\n", result[i]); * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
*/ */
int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word, LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word,
char** desc, int n); char** desc, int n);
/* functions for run-time modification of the dictionary */ /* functions for run-time modification of the dictionary */
/* add word to the run-time dictionary */ /* add word to the run-time dictionary */
int Hunspell_add(const char * word); LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word);
/* add word to the run-time dictionary with affix flags of /* add word to the run-time dictionary with affix flags of
* the example (a dictionary word): Hunspell will recognize * the example (a dictionary word): Hunspell will recognize
* affixed forms of the new word, too. * affixed forms of the new word, too.
*/ */
int Hunspell_add_with_affix(const char * word, const char * example); LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example);
/* remove word from the run-time dictionary */ /* remove word from the run-time dictionary */
/* NOTE: not implemented yet */
int Hunspell_remove(const char * word); LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word);
/* free suggestion lists */
LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,40 +1,29 @@
#include "hunvisapi.h"
#include "hashmgr.hxx" #include "hashmgr.hxx"
#include "affixmgr.hxx" #include "affixmgr.hxx"
#include "suggestmgr.hxx" #include "suggestmgr.hxx"
#include "csutil.hxx"
#include "langnum.hxx" #include "langnum.hxx"
#define SPELL_COMPOUND (1 << 0) #define SPELL_XML "<?xml?>"
#define SPELL_FORBIDDEN (1 << 1)
#define SPELL_ALLCAP (1 << 2)
#define SPELL_NOCAP (1 << 3)
#define SPELL_INITCAP (1 << 4)
#define MAXDIC 20
#define MAXSUGGESTION 15 #define MAXSUGGESTION 15
#define MAXSHARPS 5 #define MAXSHARPS 5
#define HUNSPELL_OK (1 << 0)
#define HUNSPELL_OK_WARN (1 << 1)
#ifndef _MYSPELLMGR_HXX_ #ifndef _MYSPELLMGR_HXX_
#define _MYSPELLMGR_HXX_ #define _MYSPELLMGR_HXX_
#ifdef HUNSPELL_STATIC
#define DLLEXPORT
#else
#ifdef HUNSPELL_EXPORTS
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT __declspec( dllimport )
#endif
#endif
#ifdef W32
class DLLEXPORT Hunspell
#else
class Hunspell class Hunspell
#endif
{ {
AffixMgr* pAMgr; AffixMgr* pAMgr;
HashMgr* pHMgr; HashMgr* pHMgr[MAXDIC];
int maxdic;
SuggestMgr* pSMgr; SuggestMgr* pSMgr;
char * affixpath;
char * encoding; char * encoding;
struct cs_info * csconv; struct cs_info * csconv;
int langnum; int langnum;
@ -48,10 +37,12 @@ public:
* input: path of affix file and dictionary file * input: path of affix file and dictionary file
*/ */
Hunspell(const char * affpath, const char * dpath); Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
~Hunspell(); ~Hunspell();
/* load extra dictionaries (only dic files) */
int add_dic(const char * dpath, const char * key = NULL);
/* spell(word) - spellcheck word /* spell(word) - spellcheck word
* output: 0 = bad word, not 0 = good word * output: 0 = bad word, not 0 = good word
* *
@ -74,6 +65,10 @@ public:
int suggest(char*** slst, const char * word); int suggest(char*** slst, const char * word);
/* deallocate suggestion lists */
void free_list(char *** slst, int n);
char * get_dic_encoding(); char * get_dic_encoding();
/* morphological functions */ /* morphological functions */
@ -89,8 +84,8 @@ public:
/* stem(result, analysis, n) - get stems from a morph. analysis /* stem(result, analysis, n) - get stems from a morph. analysis
* example: * example:
* char ** result, result2; * char ** result, result2;
* int n1 = analyze(result, "words"); * int n1 = analyze(&result, "words");
* int n2 = stem(result2, result, n1); * int n2 = stem(&result2, result, n1);
*/ */
int stem(char*** slst, char ** morph, int n); int stem(char*** slst, char ** morph, int n);
@ -103,7 +98,7 @@ public:
* example: * example:
* char ** result; * char ** result;
* char * affix = "is:plural"; // description depends from dictionaries, too * char * affix = "is:plural"; // description depends from dictionaries, too
* int n = generate(result, "word", &affix, 1); * int n = generate(&result, "word", &affix, 1);
* for (int i = 0; i < n; i++) printf("%s\n", result[i]); * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
*/ */
@ -123,7 +118,6 @@ public:
int add_with_affix(const char * word, const char * example); int add_with_affix(const char * word, const char * example);
/* remove word from the run-time dictionary */ /* remove word from the run-time dictionary */
/* NOTE: not implemented yet */
int remove(const char * word); int remove(const char * word);
@ -136,6 +130,8 @@ public:
struct cs_info * get_csconv(); struct cs_info * get_csconv();
const char * get_version(); const char * get_version();
int get_langnum() const;
/* experimental and deprecated functions */ /* experimental and deprecated functions */
#ifdef HUNSPELL_EXPERIMENTAL #ifdef HUNSPELL_EXPERIMENTAL
@ -146,7 +142,6 @@ public:
/* spec. suggestions */ /* spec. suggestions */
int suggest_auto(char*** slst, const char * word); int suggest_auto(char*** slst, const char * word);
int suggest_pos_stems(char*** slst, const char * word); int suggest_pos_stems(char*** slst, const char * word);
char * get_possible_root();
#endif #endif
private: private:
@ -164,8 +159,13 @@ private:
hentry * spellsharps(char * base, char *, int, int, char * tmp, int * info, char **root); hentry * spellsharps(char * base, char *, int, int, char * tmp, int * info, char **root);
int is_keepcase(const hentry * rv); int is_keepcase(const hentry * rv);
int insert_sug(char ***slst, char * word, int ns); int insert_sug(char ***slst, char * word, int ns);
char * cat_result(char * result, char * st); void cat_result(char * result, char * st);
char * stem_description(const char * desc); char * stem_description(const char * desc);
int spellml(char*** slst, const char * word);
int get_xml_par(char * dest, const char * par, int maxl);
const char * get_xml_pos(const char * s, const char * attr);
int get_xml_list(char ***slst, char * list, const char * tag);
int check_xml_par(const char * q, const char * attr, const char * value);
}; };

View File

@ -0,0 +1,22 @@
#ifndef _HUNSPELL_VISIBILITY_H_
#define _HUNSPELL_VISIBILITY_H_
#ifndef HUNSPELL_STATIC
#define HUNSPELL_STATIC
#endif
#if defined(HUNSPELL_STATIC)
# define LIBHUNSPELL_DLL_EXPORTED
#elif defined(_MSC_VER)
# if defined(BUILDING_LIBHUNSPELL)
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllexport)
# else
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
# endif
#elif BUILDING_LIBHUNSPELL && 1
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
#else
# define LIBHUNSPELL_DLL_EXPORTED
#endif
#endif

View File

@ -0,0 +1,18 @@
#ifndef _HUNSPELL_VISIBILITY_H_
#define _HUNSPELL_VISIBILITY_H_
#if defined(HUNSPELL_STATIC)
# define LIBHUNSPELL_DLL_EXPORTED
#elif defined(_MSC_VER)
# if defined(BUILDING_LIBHUNSPELL)
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllexport)
# else
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
# endif
#elif BUILDING_LIBHUNSPELL && @HAVE_VISIBILITY@
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
#else
# define LIBHUNSPELL_DLL_EXPORTED
#endif
#endif

View File

@ -0,0 +1,193 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hunzip.hxx"
#define CODELEN 65536
#define BASEBITREC 5000
#define UNCOMPRESSED '\002'
#define MAGIC "hz0"
#define MAGIC_ENCRYPT "hz1"
#define MAGICLEN (sizeof(MAGIC) - 1)
int Hunzip::fail(const char * err, const char * par) {
fprintf(stderr, err, 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);
if (getcode(key) == -1) bufsiz = -1;
else bufsiz = getbuf();
}
int Hunzip::getcode(const char * key) {
unsigned char c[2];
int i, j, n, p;
int allocatedbit = BASEBITREC;
const char * enc = key;
if (!filename) return -1;
fin = fopen(filename, "rb");
if (!fin) return -1;
// read magic number
if ((fread(in, 1, 3, fin) < MAGICLEN)
|| !(strncmp(MAGIC, in, MAGICLEN) == 0 ||
strncmp(MAGIC_ENCRYPT, in, MAGICLEN) == 0)) {
return fail(MSG_FORMAT, filename);
}
// check encryption
if (strncmp(MAGIC_ENCRYPT, in, MAGICLEN) == 0) {
unsigned char cs;
if (!key) return fail(MSG_KEY, filename);
if (fread(&c, 1, 1, fin) < 1) return fail(MSG_FORMAT, filename);
for (cs = 0; *enc; enc++) cs ^= *enc;
if (cs != c[0]) return fail(MSG_KEY, filename);
enc = key;
} else key = NULL;
// read record count
if (fread(&c, 1, 2, fin) < 2) return fail(MSG_FORMAT, filename);
if (key) {
c[0] ^= *enc;
if (*(++enc) == '\0') enc = key;
c[1] ^= *enc;
}
n = ((int) c[0] << 8) + c[1];
dec = (struct bit *) malloc(BASEBITREC * sizeof(struct bit));
if (!dec) return fail(MSG_MEMORY, filename);
dec[0].v[0] = 0;
dec[0].v[1] = 0;
// read codes
for (i = 0; i < n; i++) {
unsigned char l;
if (fread(c, 1, 2, fin) < 2) return fail(MSG_FORMAT, filename);
if (key) {
if (*(++enc) == '\0') enc = key;
c[0] ^= *enc;
if (*(++enc) == '\0') enc = key;
c[1] ^= *enc;
}
if (fread(&l, 1, 1, fin) < 1) return fail(MSG_FORMAT, filename);
if (key) {
if (*(++enc) == '\0') enc = key;
l ^= *enc;
}
if (fread(in, 1, l/8+1, fin) < (size_t) l/8+1) return fail(MSG_FORMAT, filename);
if (key) for (j = 0; j <= l/8; j++) {
if (*(++enc) == '\0') enc = key;
in[j] ^= *enc;
}
p = 0;
for (j = 0; j < l; j++) {
int b = (in[j/8] & (1 << (7 - (j % 8)))) ? 1 : 0;
int oldp = p;
p = dec[p].v[b];
if (p == 0) {
lastbit++;
if (lastbit == allocatedbit) {
allocatedbit += BASEBITREC;
dec = (struct bit *) realloc(dec, allocatedbit * sizeof(struct bit));
}
dec[lastbit].v[0] = 0;
dec[lastbit].v[1] = 0;
dec[oldp].v[b] = lastbit;
p = lastbit;
}
}
dec[p].c[0] = c[0];
dec[p].c[1] = c[1];
}
return 0;
}
Hunzip::~Hunzip()
{
if (dec) free(dec);
if (fin) fclose(fin);
if (filename) free(filename);
}
int Hunzip::getbuf() {
int p = 0;
int o = 0;
do {
if (inc == 0) inbits = fread(in, 1, BUFSIZE, fin) * 8;
for (; inc < inbits; inc++) {
int b = (in[inc / 8] & (1 << (7 - (inc % 8)))) ? 1 : 0;
int oldp = p;
p = dec[p].v[b];
if (p == 0) {
if (oldp == lastbit) {
fclose(fin);
fin = NULL;
// add last odd byte
if (dec[lastbit].c[0]) out[o++] = dec[lastbit].c[1];
return o;
}
out[o++] = dec[oldp].c[0];
out[o++] = dec[oldp].c[1];
if (o == BUFSIZE) return o;
p = dec[p].v[b];
}
}
inc = 0;
} while (inbits == BUFSIZE * 8);
return fail(MSG_FORMAT, filename);
}
const char * Hunzip::getline() {
char linebuf[BUFSIZE];
int l = 0, eol = 0, left = 0, right = 0;
if (bufsiz == -1) return NULL;
while (l < bufsiz && !eol) {
linebuf[l++] = out[outc];
switch (out[outc]) {
case '\t': break;
case 31: { // escape
if (++outc == bufsiz) {
bufsiz = getbuf();
outc = 0;
}
linebuf[l - 1] = out[outc];
break;
}
case ' ': break;
default: if (((unsigned char) out[outc]) < 47) {
if (out[outc] > 32) {
right = out[outc] - 31;
if (++outc == bufsiz) {
bufsiz = getbuf();
outc = 0;
}
}
if (out[outc] == 30) left = 9; else left = out[outc];
linebuf[l-1] = '\n';
eol = 1;
}
}
if (++outc == bufsiz) {
outc = 0;
bufsiz = fin ? getbuf(): -1;
}
}
if (right) strcpy(linebuf + l - 1, line + strlen(line) - right - 1);
else linebuf[l] = '\0';
strcpy(line + left, linebuf);
return line;
}

View File

@ -0,0 +1,45 @@
/* hunzip: file decompression for sorted dictionaries with optional encryption,
* algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
#ifndef _HUNZIP_HXX_
#define _HUNZIP_HXX_
#include "hunvisapi.h"
#include <stdio.h>
#define BUFSIZE 65536
#define HZIP_EXTENSION ".hz"
#define MSG_OPEN "error: %s: cannot open\n"
#define MSG_FORMAT "error: %s: not in hzip format\n"
#define MSG_MEMORY "error: %s: missing memory\n"
#define MSG_KEY "error: %s: missing or bad password\n"
struct bit {
unsigned char c[2];
int v[2];
};
class LIBHUNSPELL_DLL_EXPORTED Hunzip
{
protected:
char * filename;
FILE * fin;
int bufsiz, lastbit, inc, inbits, outc;
struct bit * dec; // code table
char in[BUFSIZE]; // input buffer
char out[BUFSIZE + 1]; // Huffman-decoded buffer
char line[BUFSIZE + 50]; // decoded line
int getcode(const char * key);
int getbuf();
int fail(const char * err, const char * par);
public:
Hunzip(const char * filename, const char * key = NULL);
~Hunzip();
const char * getline();
};
#endif

View File

@ -1,70 +1,37 @@
#************************************************************************* #*************************************************************************
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# #
# $RCSfile: makefile.mk,v $ # 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
# $Revision: 1.7 $ # the License. You may obtain a copy of the License at
# # http://www.mozilla.org/MPL/
# last change: $Author: vg $ $Date: 2003/06/12 10:38:24 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source 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.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
# #
# 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.
# #
# 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.
# #
#************************************************************************* #*************************************************************************
PRJ = .. PRJ = ../../../../../..
PRJNAME = hunspell PRJNAME = hunspell
TARGET = hunspell TARGET = hunspell
LIBTARGET=NO LIBTARGET=YES
EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
UWINAPILIB=
#----- Settings --------------------------------------------------------- #----- Settings ---------------------------------------------------------
@ -72,13 +39,7 @@ LIBTARGET=NO
# --- Files -------------------------------------------------------- # --- Files --------------------------------------------------------
# all_target: ALLTAR DICTIONARY CFLAGS+=-I..$/..$/
all_target: ALLTAR
##CXXFLAGS += -I..$/..$/lingutil
##CFLAGSCXX += -I..$/..$/lingutil
##CFLAGSCC += -I..$/..$/lingutil
CDEFS+=-DOPENOFFICEORG CDEFS+=-DOPENOFFICEORG
SLOFILES= \ SLOFILES= \
@ -86,27 +47,18 @@ SLOFILES= \
$(SLO)$/affixmgr.obj \ $(SLO)$/affixmgr.obj \
$(SLO)$/dictmgr.obj \ $(SLO)$/dictmgr.obj \
$(SLO)$/csutil.obj \ $(SLO)$/csutil.obj \
$(SLO)$/utf_info.obj \
$(SLO)$/hashmgr.obj \ $(SLO)$/hashmgr.obj \
$(SLO)$/suggestmgr.obj \ $(SLO)$/suggestmgr.obj \
$(SLO)$/phonet.obj \
$(SLO)$/hunzip.obj \
$(SLO)$/filemgr.obj \
$(SLO)$/replist.obj \
$(SLO)$/hunspell.obj $(SLO)$/hunspell.obj
LIB1TARGET= $(SLB)$/lib$(TARGET).lib LIB1TARGET= $(SLB)$/lib$(TARGET).lib
LIB1ARCHIV= $(LB)/lib$(TARGET).a LIB1ARCHIV= $(LB)/lib$(TARGET).a
LIB1OBJFILES= $(SLOFILES) LIB1OBJFILES= $(SLOFILES)
# DIC2BIN= \
# en_US.aff \
# en_US.dic
#
# de_DE.aff \
# de_DE.dic
# DICTIONARY :
# +$(COPY) $(foreach,i,$(DIC2BIN) $i) $(BIN)
# --- Targets ------------------------------------------------------ # --- Targets ------------------------------------------------------
.INCLUDE : target.mk .INCLUDE : target.mk

View File

@ -27,17 +27,10 @@
Porting from Aspell to Hunspell using C-like structs Porting from Aspell to Hunspell using C-like structs
*/ */
#ifndef MOZILLA_CLIENT
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cctype>
#else
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#endif
#include "csutil.hxx" #include "csutil.hxx"
#include "phonet.hxx" #include "phonet.hxx"
@ -46,7 +39,7 @@ void init_phonet_hash(phonetable & parms)
{ {
int i, k; int i, k;
for (i = 0; i < parms.hash_size; i++) { for (i = 0; i < HASHSIZE; i++) {
parms.hash[i] = -1; parms.hash[i] = -1;
} }
@ -60,13 +53,18 @@ void init_phonet_hash(phonetable & parms)
} }
} }
// like strcpy but safe if the strings overlap // like strcpy but safe if the strings overlap
// but only if dest < src // but only if dest < src
static inline void strmove(char * dest, char * src) { static inline void strmove(char * dest, char * src) {
while (*src) while (*src)
*dest++ = *src++; *dest++ = *src++;
*dest = '\0'; *dest = '\0';
} }
static int myisalpha(char ch) {
if ((unsigned char) ch < 128) return isalpha(ch);
return 1;
}
/* phonetic transcription algorithm */ /* phonetic transcription algorithm */
/* see: http://aspell.net/man-html/Phonetic-Code.html */ /* see: http://aspell.net/man-html/Phonetic-Code.html */
@ -108,13 +106,13 @@ int phonet (const char * inword, char * target,
s++; /** important for (see below) "*(s-1)" **/ s++; /** important for (see below) "*(s-1)" **/
while (*s != '\0' && word[i+k] == *s while (*s != '\0' && word[i+k] == *s
&& !isdigit (*s) && strchr ("(-<^$", *s) == NULL) { && !isdigit ((unsigned char) *s) && strchr ("(-<^$", *s) == NULL) {
k++; k++;
s++; s++;
} }
if (*s == '(') { if (*s == '(') {
/** check letters in "(..)" **/ /** check letters in "(..)" **/
if (isalpha(word[i+k]) // ...could be implied? if (myisalpha(word[i+k]) // ...could be implied?
&& strchr(s+1, word[i+k]) != NULL) { && strchr(s+1, word[i+k]) != NULL) {
k++; k++;
while (*s != ')') while (*s != ')')
@ -130,7 +128,7 @@ int phonet (const char * inword, char * target,
} }
if (*s == '<') if (*s == '<')
s++; s++;
if (isdigit (*s)) { if (isdigit ((unsigned char) *s)) {
/** determine priority **/ /** determine priority **/
p = *s - '0'; p = *s - '0';
s++; s++;
@ -140,12 +138,12 @@ int phonet (const char * inword, char * target,
if (*s == '\0' if (*s == '\0'
|| (*s == '^' || (*s == '^'
&& (i == 0 || ! isalpha(word[i-1])) && (i == 0 || ! myisalpha(word[i-1]))
&& (*(s+1) != '$' && (*(s+1) != '$'
|| (! isalpha(word[i+k0]) ))) || (! myisalpha(word[i+k0]) )))
|| (*s == '$' && i > 0 || (*s == '$' && i > 0
&& isalpha(word[i-1]) && myisalpha(word[i-1])
&& (! isalpha(word[i+k0]) ))) && (! myisalpha(word[i+k0]) )))
{ {
/** search for followup rules, if: **/ /** search for followup rules, if: **/
/** parms.followup and k > 1 and NO '-' in searchstring **/ /** parms.followup and k > 1 and NO '-' in searchstring **/
@ -164,13 +162,13 @@ int phonet (const char * inword, char * target,
s = parms.rules[n0]; s = parms.rules[n0];
s++; s++;
while (*s != '\0' && word[i+k0] == *s while (*s != '\0' && word[i+k0] == *s
&& ! isdigit(*s) && strchr("(-<^$",*s) == NULL) { && ! isdigit((unsigned char) *s) && strchr("(-<^$",*s) == NULL) {
k0++; k0++;
s++; s++;
} }
if (*s == '(') { if (*s == '(') {
/** check letters **/ /** check letters **/
if (isalpha(word[i+k0]) if (myisalpha(word[i+k0])
&& strchr (s+1, word[i+k0]) != NULL) { && strchr (s+1, word[i+k0]) != NULL) {
k0++; k0++;
while (*s != ')' && *s != '\0') while (*s != ')' && *s != '\0')
@ -186,14 +184,14 @@ int phonet (const char * inword, char * target,
} }
if (*s == '<') if (*s == '<')
s++; s++;
if (isdigit (*s)) { if (isdigit ((unsigned char) *s)) {
p0 = *s - '0'; p0 = *s - '0';
s++; s++;
} }
if (*s == '\0' if (*s == '\0'
/** *s == '^' cuts **/ /** *s == '^' cuts **/
|| (*s == '$' && ! isalpha(word[i+k0]))) || (*s == '$' && ! myisalpha(word[i+k0])))
{ {
if (k0 == k) { if (k0 == k) {
/** this is just a piece of the string **/ /** this is just a piece of the string **/

View File

@ -30,21 +30,23 @@
#ifndef __PHONETHXX__ #ifndef __PHONETHXX__
#define __PHONETHXX__ #define __PHONETHXX__
#define HASHSIZE 256
#define MAXPHONETLEN 256 #define MAXPHONETLEN 256
#define MAXPHONETUTF8LEN (MAXPHONETLEN * 4) #define MAXPHONETUTF8LEN (MAXPHONETLEN * 4)
#include "hunvisapi.h"
struct phonetable { struct phonetable {
char utf8; char utf8;
cs_info * lang; cs_info * lang;
int num; int num;
char * * rules; char * * rules;
static const int hash_size = 256; int hash[HASHSIZE];
int hash[hash_size];
}; };
void init_phonet_hash(phonetable & parms); LIBHUNSPELL_DLL_EXPORTED void init_phonet_hash(phonetable & parms);
int phonet (const char * inword, char * target, LIBHUNSPELL_DLL_EXPORTED int phonet (const char * inword, char * target,
int len, phonetable & phone); int len, phonetable & phone);
#endif #endif

View File

@ -0,0 +1,87 @@
#include "license.hunspell"
#include "license.myspell"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "replist.hxx"
#include "csutil.hxx"
RepList::RepList(int n) {
dat = (replentry **) malloc(sizeof(replentry *) * n);
if (dat == 0) size = 0; else size = n;
pos = 0;
}
RepList::~RepList()
{
for (int i = 0; i < pos; i++) {
free(dat[i]->pattern);
free(dat[i]->pattern2);
free(dat[i]);
}
free(dat);
}
int RepList::get_pos() {
return pos;
}
replentry * RepList::item(int n) {
return dat[n];
}
int RepList::near(const char * word) {
int p1 = 0;
int p2 = pos;
while ((p2 - p1) > 1) {
int m = (p1 + p2) / 2;
int c = strcmp(word, dat[m]->pattern);
if (c <= 0) {
if (c < 0) p2 = m; else p1 = p2 = m;
} else p1 = m;
}
return p1;
}
int RepList::match(const char * word, int n) {
if (strncmp(word, dat[n]->pattern, strlen(dat[n]->pattern)) == 0) return strlen(dat[n]->pattern);
return 0;
}
int RepList::add(char * pat1, char * pat2) {
if (pos >= size || pat1 == NULL || pat2 == NULL) return 1;
replentry * r = (replentry *) malloc(sizeof(replentry));
if (r == NULL) return 1;
r->pattern = mystrrep(pat1, "_", " ");
r->pattern2 = mystrrep(pat2, "_", " ");
r->start = false;
r->end = false;
dat[pos++] = r;
for (int i = pos - 1; i > 0; i--) {
r = dat[i];
if (strcmp(r->pattern, dat[i - 1]->pattern) < 0) {
dat[i] = dat[i - 1];
dat[i - 1] = r;
} else break;
}
return 0;
}
int RepList::conv(const char * word, char * dest) {
int stl = 0;
int change = 0;
for (size_t i = 0; i < strlen(word); i++) {
int n = near(word + i);
int l = match(word + i, n);
if (l) {
strcpy(dest + stl, dat[n]->pattern2);
stl += strlen(dat[n]->pattern2);
i += l - 1;
change = 1;
} else dest[stl++] = word[i];
}
dest[stl] = '\0';
return change;
}

View File

@ -0,0 +1,28 @@
/* string replacement list class */
#ifndef _REPLIST_HXX_
#define _REPLIST_HXX_
#include "hunvisapi.h"
#include "w_char.hxx"
#undef near
class LIBHUNSPELL_DLL_EXPORTED RepList
{
protected:
replentry ** dat;
int size;
int pos;
public:
RepList(int n);
~RepList();
int get_pos();
int add(char * pat1, char * pat2);
replentry * item(int n);
int near(const char * word);
int match(const char * word, int n);
int conv(const char * word, char * dest);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
#define MAX_GUESS 200 #define MAX_GUESS 200
#define MAXNGRAMSUGS 4 #define MAXNGRAMSUGS 4
#define MAXPHONSUGS 2 #define MAXPHONSUGS 2
#define MAXCOMPOUNDSUGS 3
// timelimit: max ~1/4 sec (process time on Linux) for a time consuming function // timelimit: max ~1/4 sec (process time on Linux) for a time consuming function
#define TIMELIMIT (CLOCKS_PER_SEC >> 2) #define TIMELIMIT (CLOCKS_PER_SEC >> 2)
@ -17,6 +18,9 @@
#define NGRAM_LONGER_WORSE (1 << 0) #define NGRAM_LONGER_WORSE (1 << 0)
#define NGRAM_ANY_MISMATCH (1 << 1) #define NGRAM_ANY_MISMATCH (1 << 1)
#define NGRAM_LOWERING (1 << 2) #define NGRAM_LOWERING (1 << 2)
#define NGRAM_WEIGHTED (1 << 3)
#include "hunvisapi.h"
#include "atypes.hxx" #include "atypes.hxx"
#include "affixmgr.hxx" #include "affixmgr.hxx"
@ -26,7 +30,7 @@
enum { LCS_UP, LCS_LEFT, LCS_UPLEFT }; enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
class SuggestMgr class LIBHUNSPELL_DLL_EXPORTED SuggestMgr
{ {
char * ckey; char * ckey;
int ckeyl; int ckeyl;
@ -43,6 +47,7 @@ class SuggestMgr
int langnum; int langnum;
int nosplitsugs; int nosplitsugs;
int maxngramsugs; int maxngramsugs;
int maxcpdsugs;
int complexprefixes; int complexprefixes;
@ -51,7 +56,7 @@ public:
~SuggestMgr(); ~SuggestMgr();
int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug); int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug);
int ngsuggest(char ** wlst, char * word, int ns, HashMgr* pHMgr); int ngsuggest(char ** wlst, char * word, int ns, HashMgr** pHMgr, int md);
int suggest_auto(char*** slst, const char * word, int nsug); int suggest_auto(char*** slst, const char * word, int nsug);
int suggest_stems(char*** slst, const char * word, int nsug); int suggest_stems(char*** slst, const char * word, int nsug);
int suggest_pos_stems(char*** slst, const char * word, int nsug); int suggest_pos_stems(char*** slst, const char * word, int nsug);
@ -90,8 +95,7 @@ private:
int movechar_utf(char **, const w_char *, int, int, int); int movechar_utf(char **, const w_char *, int, int, int);
int mapchars(char**, const char *, int, int); int mapchars(char**, const char *, int, int);
int map_related(const char *, int, char ** wlst, int, int, const mapentry*, int, int *, clock_t *); int map_related(const char *, char *, int, int, char ** wlst, int, int, const mapentry*, int, int *, clock_t *);
int map_related_utf(w_char *, int, int, int, char ** wlst, int, const mapentry*, int, int *, clock_t *);
int ngram(int n, char * s1, const char * s2, int opt); int ngram(int n, char * s1, const char * s2, int opt);
int mystrlen(const char * word); int mystrlen(const char * word);
int leftcommonsubstring(char * s1, const char * s2); int leftcommonsubstring(char * s1, const char * s2);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
#ifndef __WCHARHXX__
#define __WCHARHXX__
#ifndef GCC
typedef struct {
#else
typedef struct __attribute__ ((packed)) {
#endif
unsigned char l;
unsigned char h;
} w_char;
// two character arrays
struct replentry {
char * pattern;
char * pattern2;
bool start;
bool end;
};
#endif

View File

@ -1,10 +0,0 @@
lib_LIBRARIES=libparsers.a
libparsers_a_SOURCES=firstparser.cxx htmlparser.cxx \
latexparser.cxx manparser.cxx \
textparser.cxx
noinst_PROGRAMS=testparser
testparser_SOURCES=firstparser.cxx firstparser.hxx htmlparser.cxx htmlparser.hxx latexparser.cxx latexparser.hxx manparser.cxx manparser.hxx testparser.cxx textparser.cxx textparser.hxx
# need mystrdup()
LDADD = ../hunspell/libhunspell.la

View File

@ -1,533 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = testparser$(EXEEXT)
subdir = src/parsers
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLIBRARIES_INSTALL = $(INSTALL_DATA)
LIBRARIES = $(lib_LIBRARIES)
ARFLAGS = cru
libparsers_a_AR = $(AR) $(ARFLAGS)
libparsers_a_LIBADD =
am_libparsers_a_OBJECTS = firstparser.$(OBJEXT) htmlparser.$(OBJEXT) \
latexparser.$(OBJEXT) manparser.$(OBJEXT) textparser.$(OBJEXT)
libparsers_a_OBJECTS = $(am_libparsers_a_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
am_testparser_OBJECTS = firstparser.$(OBJEXT) htmlparser.$(OBJEXT) \
latexparser.$(OBJEXT) manparser.$(OBJEXT) testparser.$(OBJEXT) \
textparser.$(OBJEXT)
testparser_OBJECTS = $(am_testparser_OBJECTS)
testparser_LDADD = $(LDADD)
testparser_DEPENDENCIES = ../hunspell/libhunspell.la
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libparsers_a_SOURCES) $(testparser_SOURCES)
DIST_SOURCES = $(libparsers_a_SOURCES) $(testparser_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSESLIB = @CURSESLIB@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
HUNSPELL_VERSION_MAJOR = @HUNSPELL_VERSION_MAJOR@
HUNSPELL_VERSION_MINOR = @HUNSPELL_VERSION_MINOR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
READLINELIB = @READLINELIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XFAILED = @XFAILED@
XGETTEXT = @XGETTEXT@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
lib_LIBRARIES = libparsers.a
libparsers_a_SOURCES = firstparser.cxx htmlparser.cxx \
latexparser.cxx manparser.cxx \
textparser.cxx
testparser_SOURCES = firstparser.cxx firstparser.hxx htmlparser.cxx htmlparser.hxx latexparser.cxx latexparser.hxx manparser.cxx manparser.hxx testparser.cxx textparser.cxx textparser.hxx
# need mystrdup()
LDADD = ../hunspell/libhunspell.la
all: all-am
.SUFFIXES:
.SUFFIXES: .cxx .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/parsers/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/parsers/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
@$(POST_INSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
p=$(am__strip_dir) \
echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
$(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
else :; fi; \
done
uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
libparsers.a: $(libparsers_a_OBJECTS) $(libparsers_a_DEPENDENCIES)
-rm -f libparsers.a
$(libparsers_a_AR) libparsers.a $(libparsers_a_OBJECTS) $(libparsers_a_LIBADD)
$(RANLIB) libparsers.a
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
testparser$(EXEEXT): $(testparser_OBJECTS) $(testparser_DEPENDENCIES)
@rm -f testparser$(EXEEXT)
$(CXXLINK) $(testparser_LDFLAGS) $(testparser_OBJECTS) $(testparser_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/firstparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htmlparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/latexparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textparser.Po@am__quote@
.cxx.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cxx.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cxx.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLIBRARIES clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-libLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-libLIBRARIES install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
uninstall-libLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -13,7 +13,7 @@ using namespace std;
enum { ST_NON_WORD, ST_WORD, ST_TAG, ST_CHAR_ENTITY, ST_OTHER_TAG, ST_ATTRIB }; enum { ST_NON_WORD, ST_WORD, ST_TAG, ST_CHAR_ENTITY, ST_OTHER_TAG, ST_ATTRIB };
static char * PATTERN[][2] = { static const char * PATTERN[][2] = {
{ "<script", "</script>" }, { "<script", "</script>" },
{ "<style", "</style>" }, { "<style", "</style>" },
{ "<code", "</code>" }, { "<code", "</code>" },
@ -30,7 +30,7 @@ static char * PATTERN[][2] = {
#define PATTERN_LEN (sizeof(PATTERN) / (sizeof(char *) * 2)) #define PATTERN_LEN (sizeof(PATTERN) / (sizeof(char *) * 2))
static char * PATTERN2[][2] = { static const char * PATTERN2[][2] = {
{ "<img", "alt=" }, // ALT and TITLE attrib handled spec. { "<img", "alt=" }, // ALT and TITLE attrib handled spec.
{ "<img", "title=" }, { "<img", "title=" },
{ "<a ", "title=" } { "<a ", "title=" }
@ -53,11 +53,11 @@ HTMLParser::~HTMLParser()
} }
int HTMLParser::look_pattern(char * p[][2], unsigned int len, int column) int HTMLParser::look_pattern(const char * p[][2], unsigned int len, int column)
{ {
for (unsigned int i = 0; i < len; i++) { for (unsigned int i = 0; i < len; i++) {
char * j = line[actual] + head; char * j = line[actual] + head;
char * k = p[i][column]; const char * k = p[i][column];
while ((*k != '\0') && (tolower(*j) == *k)) { while ((*k != '\0') && (tolower(*j) == *k)) {
j++; j++;
k++; k++;
@ -75,7 +75,7 @@ int HTMLParser::look_pattern(char * p[][2], unsigned int len, int column)
char * HTMLParser::next_token() char * HTMLParser::next_token()
{ {
char * latin1; const char * latin1;
for (;;) { for (;;) {
//fprintf(stderr, "%d:%c:%s\n", state, line[actual][head], line[actual]); //fprintf(stderr, "%d:%c:%s\n", state, line[actual][head], line[actual]);
@ -141,7 +141,7 @@ char * HTMLParser::next_token()
} }
break; break;
case ST_CHAR_ENTITY: // SGML element case ST_CHAR_ENTITY: // SGML element
if ((tolower(line[actual][head]) < 'a') || (tolower(line[actual][head]) > 'z')) { if ((tolower(line[actual][head]) == ';')) {
state = prevstate; state = prevstate;
head--; head--;
} }

View File

@ -30,7 +30,7 @@ public:
private: private:
int look_pattern(char * p[][2], unsigned int len, int column); int look_pattern(const char * p[][2], unsigned int len, int column);
int pattern_num; int pattern_num;
int pattern2_num; int pattern2_num;
int prevstate; int prevstate;

View File

@ -11,7 +11,7 @@ using namespace std;
#endif #endif
static struct { static struct {
char * pat[2]; const char * pat[2];
int arg; int arg;
} PATTERN[] = { } PATTERN[] = {
{ { "\\(", "\\)" } , 0 }, { { "\\(", "\\)" } , 0 },
@ -21,6 +21,7 @@ static struct {
{ { "\\[", "\\]" } , 0 }, { { "\\[", "\\]" } , 0 },
{ { "\\begin{displaymath}", "\\end{displaymath}" } , 0 }, { { "\\begin{displaymath}", "\\end{displaymath}" } , 0 },
{ { "\\begin{equation}", "\\end{equation}" } , 0 }, { { "\\begin{equation}", "\\end{equation}" } , 0 },
{ { "\\begin{equation*}", "\\end{equation*}" } , 0 },
{ { "\\cite", NULL } , 1 }, { { "\\cite", NULL } , 1 },
{ { "\\nocite", NULL } , 1 }, { { "\\nocite", NULL } , 1 },
{ { "\\index", NULL } , 1 }, { { "\\index", NULL } , 1 },
@ -79,10 +80,14 @@ static struct {
{ { "\\fcolorbox", NULL } , 2 }, { { "\\fcolorbox", NULL } , 2 },
{ { "\\declaregraphicsextensions", NULL } , 1 }, { { "\\declaregraphicsextensions", NULL } , 1 },
{ { "\\psfig", NULL } , 1 }, { { "\\psfig", NULL } , 1 },
{ { "\\url", NULL } , 1 } { { "\\url", NULL } , 1 },
{ { "\\eqref", NULL } , 1 },
{ { "\\vskip", NULL } , 1 },
{ { "\\vglue", NULL } , 1 },
{ { "\'\'", NULL } , 1 }
}; };
#define PATTERN_LEN (sizeof(PATTERN) / ((sizeof(char *) * 2) + sizeof(int))) #define PATTERN_LEN (sizeof(PATTERN) / sizeof(PATTERN[0]))
LaTeXParser::LaTeXParser(const char * wordchars) LaTeXParser::LaTeXParser(const char * wordchars)
{ {
@ -102,7 +107,7 @@ int LaTeXParser::look_pattern(int col)
{ {
for (unsigned int i = 0; i < PATTERN_LEN; i++) { for (unsigned int i = 0; i < PATTERN_LEN; i++) {
char * j = line[actual] + head; char * j = line[actual] + head;
char * k = PATTERN[i].pat[col]; const char * k = PATTERN[i].pat[col];
if (! k) continue; if (! k) continue;
while ((*k != '\0') && (tolower(*j) == *k)) { while ((*k != '\0') && (tolower(*j) == *k)) {
j++; j++;
@ -130,6 +135,7 @@ char * LaTeXParser::next_token()
{ {
int i; int i;
int slash = 0; int slash = 0;
int apostrophe;
for (;;) { for (;;) {
// fprintf(stderr,"depth: %d, state: %d, , arg: %d, token: %s\n",depth,state,arg,line[actual]+head); // fprintf(stderr,"depth: %d, state: %d, , arg: %d, token: %s\n",depth,state,arg,line[actual]+head);
@ -164,9 +170,12 @@ char * LaTeXParser::next_token()
} }
break; break;
case 1: // wordchar case 1: // wordchar
if (! is_wordchar(line[actual] + head)) { apostrophe = 0;
if (! is_wordchar(line[actual] + head) ||
(line[actual][head] == '\'' && line[actual][head+1] == '\'' && ++apostrophe)) {
state = 0; state = 0;
char * t = alloc_token(token, &head); char * t = alloc_token(token, &head);
if (apostrophe) head += 2;
if (t) return t; if (t) return t;
} }
break; break;

View File

@ -16,7 +16,7 @@ main(int argc, char** argv)
FILE * f; FILE * f;
/* first parse the command line options */ /* first parse the command line options */
if (! argv[1]) { if (argc < 2) {
fprintf(stderr,"correct syntax is:\n"); fprintf(stderr,"correct syntax is:\n");
fprintf(stderr,"testparser file\n"); fprintf(stderr,"testparser file\n");
fprintf(stderr,"example: testparser /dev/stdin\n"); fprintf(stderr,"example: testparser /dev/stdin\n");
@ -47,6 +47,7 @@ main(int argc, char** argv)
} }
delete p; delete p;
fclose(f);
return 0; return 0;
} }

View File

@ -12,7 +12,7 @@ using namespace std;
// ISO-8859-1 HTML character entities // ISO-8859-1 HTML character entities
static char * LATIN1[] = { static const char * LATIN1[] = {
"&Agrave;", "&Agrave;",
"&Atilde;", "&Atilde;",
"&Aring;", "&Aring;",
@ -78,7 +78,7 @@ int TextParser::is_wordchar(char * w)
} }
} }
char * TextParser::get_latin1(char * s) const char * TextParser::get_latin1(char * s)
{ {
if (s[0] == '&') { if (s[0] == '&') {
unsigned int i = 0; unsigned int i = 0;
@ -159,7 +159,7 @@ char * TextParser::get_line()
char * TextParser::next_token() char * TextParser::next_token()
{ {
char * latin1; const char * latin1;
for (;;) { for (;;) {
switch (state) switch (state)

View File

@ -57,7 +57,7 @@ public:
int get_tokenpos(); int get_tokenpos();
int is_wordchar(char * w); int is_wordchar(char * w);
char * get_latin1(char * s); const char * get_latin1(char * s);
char * next_char(); char * next_char();
int tokenize_urls(); int tokenize_urls();
void check_urls(); void check_urls();

View File

@ -2,8 +2,8 @@
#include <windows.h> #include <windows.h>
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,1,0 FILEVERSION 1,3,1,0
PRODUCTVERSION 1,2,1,0 PRODUCTVERSION 1,3,1,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -21,12 +21,12 @@ BEGIN
VALUE "Comments", "Hunspell (http://hunspell.sourceforge.net/) by László Németh" VALUE "Comments", "Hunspell (http://hunspell.sourceforge.net/) by László Németh"
VALUE "CompanyName", "http://hunspell.sourceforge.net/" VALUE "CompanyName", "http://hunspell.sourceforge.net/"
VALUE "FileDescription", "libhunspell" VALUE "FileDescription", "libhunspell"
VALUE "FileVersion", "1.2.1" VALUE "FileVersion", "1.3.2"
VALUE "InternalName", "libhunspell" VALUE "InternalName", "libhunspell"
VALUE "LegalCopyright", "Copyright (c) 2007" VALUE "LegalCopyright", "Copyright (c) 2007-2011"
VALUE "OriginalFilename", "libhunspell.dll" VALUE "OriginalFilename", "libhunspell.dll"
VALUE "ProductName", "Hunspell Dynamic Link Library" VALUE "ProductName", "Hunspell Dynamic Link Library"
VALUE "ProductVersion", "1.2.1" VALUE "ProductVersion", "1.3.2"
END END
END END
END END

View File

@ -89,13 +89,6 @@
/* Define to 1 if you have the <locale.h> header file. */ /* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1 #define HAVE_LOCALE_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the `memchr' function. */ /* Define to 1 if you have the `memchr' function. */
#define HAVE_MEMCHR 1 #define HAVE_MEMCHR 1
@ -190,7 +183,7 @@
#undef HUNSPELL_EXPERIMENTAL #undef HUNSPELL_EXPERIMENTAL
/* "Define if you need warning messages" */ /* "Define if you need warning messages" */
#undef HUNSPELL_WARNING_ON #define HUNSPELL_WARNING_ON
/* Define as const if the declaration of iconv() needs const. */ /* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST 1 #define ICONV_CONST 1
@ -211,5 +204,5 @@
#define PACKAGE_TARNAME #define PACKAGE_TARNAME
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "1.1.11" #define PACKAGE_VERSION "1.3.2"
#define VERSION "1.1.11" #define VERSION "1.3.2"

View File

@ -34,59 +34,73 @@
#include "hunspelldll.h" #include "hunspelldll.h"
#include <windows.h> #include <windows.h>
#ifdef BORLAND
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#endif
DLLEXPORT void * hunspell_initialize(char *aff_file, char *dict_file) LIBHUNSPELL_DLL_EXPORTED void * hunspell_initialize(char *aff_file, char *dict_file)
{ {
Hunspell * pMS = new Hunspell(aff_file, dict_file); Hunspell * pMS = new Hunspell(aff_file, dict_file);
return pMS; return pMS;
} }
DLLEXPORT void hunspell_uninitialize(Hunspell *pMS) LIBHUNSPELL_DLL_EXPORTED void * hunspell_initialize_key(char *aff_file, char *dict_file, char * key)
{
Hunspell * pMS = new Hunspell(aff_file, dict_file, key);
return pMS;
}
LIBHUNSPELL_DLL_EXPORTED void hunspell_uninitialize(Hunspell *pMS)
{ {
delete pMS; delete pMS;
} }
DLLEXPORT int hunspell_spell(Hunspell *pMS, char *word) LIBHUNSPELL_DLL_EXPORTED int hunspell_spell(Hunspell *pMS, char *word)
{ {
return pMS->spell(word); return pMS->spell(word);
} }
DLLEXPORT int hunspell_suggest(Hunspell *pMS, char *word, char ***slst) LIBHUNSPELL_DLL_EXPORTED int hunspell_suggest(Hunspell *pMS, char *word, char ***slst)
{ {
return pMS->suggest(slst, word); return pMS->suggest(slst, word);
} }
#ifdef HUNSPELL_EXPERIMENTAL #ifdef HUNSPELL_EXPERIMENTAL
DLLEXPORT int hunspell_suggest_auto(Hunspell *pMS, char *word, char ***slst) LIBHUNSPELL_DLL_EXPORTED int hunspell_suggest_auto(Hunspell *pMS, char *word, char ***slst)
{ {
return pMS->suggest_auto(slst, word); return pMS->suggest_auto(slst, word);
} }
#endif #endif
DLLEXPORT void hunspell_suggest_free(Hunspell *pMS, char **slst, int len) LIBHUNSPELL_DLL_EXPORTED void hunspell_free_list(Hunspell *pMS, char ***slst, int len)
{
pMS->free_list(slst, len);
}
// deprecated (use hunspell_free_list)
LIBHUNSPELL_DLL_EXPORTED void hunspell_suggest_free(Hunspell *pMS, char **slst, int len)
{ {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
free(slst[i]); free(slst[i]);
} }
} }
DLLEXPORT char * hunspell_get_dic_encoding(Hunspell *pMS) LIBHUNSPELL_DLL_EXPORTED char * hunspell_get_dic_encoding(Hunspell *pMS)
{ {
return pMS->get_dic_encoding(); return pMS->get_dic_encoding();
} }
DLLEXPORT int hunspell_put_word(Hunspell *pMS, char *word) LIBHUNSPELL_DLL_EXPORTED int hunspell_add(Hunspell *pMS, char *word)
{ {
return pMS->add(word); return pMS->add(word);
} }
LIBHUNSPELL_DLL_EXPORTED int hunspell_add_with_affix(Hunspell *pMS, char *word, char *modelword)
{
return pMS->add_with_affix(word, modelword);
}
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ , BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ , DWORD reason /* Reason this function is being called. */ ,

View File

@ -36,36 +36,30 @@
#ifndef _DLL_H_ #ifndef _DLL_H_
#define _DLL_H_ #define _DLL_H_
#ifdef HUNSPELL_STATIC
#define DLLEXPORT
#else
#ifdef HUNSPELL_EXPORTS
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT __declspec( dllimport )
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
//returns pointer to spell object, params are aff file name and dict file name //returns pointer to spell object, params are aff file name and dict file name
DLLEXPORT void *hunspell_initialize(char *aff_file, char *dict_file); LIBHUNSPELL_DLL_EXPORTED void *hunspell_initialize(char *aff_file, char *dict_file);
//frees spell object //frees spell object
DLLEXPORT void hunspell_uninitialize(Hunspell *pMS); LIBHUNSPELL_DLL_EXPORTED void hunspell_uninitialize(Hunspell *pMS);
//spellcheck word, returns 1 if word ok otherwise 0 //spellcheck word, returns 1 if word ok otherwise 0
DLLEXPORT int hunspell_spell(Hunspell *pMS, char *word); LIBHUNSPELL_DLL_EXPORTED int hunspell_spell(Hunspell *pMS, char *word);
//suggest words for word, returns number of words in slst //suggest words for word, returns number of words in slst
// YOU NEED TO CALL hunspell_suggest_free after you've done with words // YOU NEED TO CALL hunspell_suggest_free after you've done with words
DLLEXPORT int hunspell_suggest(Hunspell *pMS, char *word, char ***slst); LIBHUNSPELL_DLL_EXPORTED int hunspell_suggest(Hunspell *pMS, char *word, char ***slst);
DLLEXPORT int hunspell_suggest_auto(Hunspell *pMS, char *word, char ***slst); LIBHUNSPELL_DLL_EXPORTED int hunspell_suggest_auto(Hunspell *pMS, char *word, char ***slst);
//free slst array //free slst array
DLLEXPORT void hunspell_suggest_free(Hunspell *pMS, char **slst, int len); LIBHUNSPELL_DLL_EXPORTED void hunspell_free_list(Hunspell *pMS, char ***slst, int len);
// deprecated (use hunspell_free_list)
LIBHUNSPELL_DLL_EXPORTED void hunspell_suggest_free(Hunspell *pMS, char **slst, int len);
//make local copy of returned string!! //make local copy of returned string!!
DLLEXPORT char * hunspell_get_dic_encoding(Hunspell *pMS); LIBHUNSPELL_DLL_EXPORTED char * hunspell_get_dic_encoding(Hunspell *pMS);
//add word to dict (word is valid until spell object is not destroyed) //add word to dict (word is valid until spell object is not destroyed)
DLLEXPORT int hunspell_put_word(Hunspell *pMS, char *word); LIBHUNSPELL_DLL_EXPORTED int hunspell_add(Hunspell *pMS, char *word);
//add word to dict with affixes of the modelword (word is valid until spell object is not destroyed)
LIBHUNSPELL_DLL_EXPORTED int hunspell_add_with_affix(Hunspell *pMS, char *word, char *modelword);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -392,6 +392,14 @@
RelativePath="..\hunspell\dictmgr.hxx" RelativePath="..\hunspell\dictmgr.hxx"
> >
</File> </File>
<File
RelativePath="..\hunspell\filemgr.cxx"
>
</File>
<File
RelativePath="..\hunspell\filemgr.hxx"
>
</File>
<File <File
RelativePath="..\hunspell\hashmgr.cxx" RelativePath="..\hunspell\hashmgr.cxx"
> >
@ -416,6 +424,18 @@
RelativePath="..\hunspell\hunspell.hxx" RelativePath="..\hunspell\hunspell.hxx"
> >
</File> </File>
<File
RelativePath="..\hunspell\hunvisapi.h"
>
</File>
<File
RelativePath="..\hunspell\hunzip.cxx"
>
</File>
<File
RelativePath="..\hunspell\hunzip.hxx"
>
</File>
<File <File
RelativePath="..\hunspell\langnum.hxx" RelativePath="..\hunspell\langnum.hxx"
> >
@ -428,6 +448,14 @@
RelativePath="..\hunspell\phonet.hxx" RelativePath="..\hunspell\phonet.hxx"
> >
</File> </File>
<File
RelativePath="..\hunspell\replist.cxx"
>
</File>
<File
RelativePath="..\hunspell\replist.hxx"
>
</File>
<File <File
RelativePath="..\hunspell\suggestmgr.cxx" RelativePath="..\hunspell\suggestmgr.cxx"
> >
@ -436,10 +464,6 @@
RelativePath="..\hunspell\suggestmgr.hxx" RelativePath="..\hunspell\suggestmgr.hxx"
> >
</File> </File>
<File
RelativePath="..\hunspell\utf_info.cxx"
>
</File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>