From 1b264d6f7dd66d3824c2dd4649cf5b0cd2e3fe48 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 20 Jan 2005 16:17:37 +0000 Subject: [PATCH] Rename some of the elements of the SpellBase::Result enum. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9513 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 13 ++++++++++++ src/SpellBase.h | 20 ++++++++++++------- src/aspell.C | 6 +++--- src/aspell_local.h | 2 +- src/buffer.C | 1 + src/frontends/controllers/ChangeLog | 4 ++++ .../controllers/ControlSpellchecker.C | 4 ++-- src/ispell.C | 18 ++++++++--------- src/ispell.h | 2 +- src/pspell.C | 6 +++--- src/pspell.h | 2 +- 11 files changed, 51 insertions(+), 27 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 591580f75b..73b407350e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,18 @@ +2005-01-20 Angus Leeming + + * SpellBase.h: rename some of the elements of the Result enum. + + * aspell_local.h: + * ispell.h: + * pspell.h: + * aspell.C (check): + * ispell.C (check): + * pspell.C (check): ditto + 2005-01-20 Asger Ottar Alstrup + * buffer.C: add #include . + * lyx_main.C (init): Compile fix. * lyxserver.[Ch] (inPipeName, outPipeName): move out of line. diff --git a/src/SpellBase.h b/src/SpellBase.h index dbdf6b7420..7850cd1517 100644 --- a/src/SpellBase.h +++ b/src/SpellBase.h @@ -26,12 +26,18 @@ public: /// the result from checking a single word enum Result { - OK = 1, //< word is correct - ROOT, //< root of given word was found - COMPOUNDWORD, //< word found through compound formation - UNKNOWN, //< word not found - MISSED, //< not found, with suggestions - IGNORE //< number of other ignored "word" + /// word is correct + OK = 1, + /// root of given word was found + ROOT, + /// word found through compound formation + COMPOUND_WORD, + /// word not found + UNKNOWN_WORD, + /// not found, with suggestions + SUGGESTED_WORDS, + /// number of other ignored "word" + IGNORED_WORD }; virtual ~SpellBase() {} @@ -48,7 +54,7 @@ public: /// accept the given word temporarily virtual void accept(WordLangTuple const &) = 0; - /// return the next near miss after a MISSED result + /// return the next near miss after a SUGGESTED_WORDS result virtual std::string const nextMiss() = 0; /// give an error message on messy exit diff --git a/src/aspell.C b/src/aspell.C index 507437c633..84fb210369 100644 --- a/src/aspell.C +++ b/src/aspell.C @@ -75,7 +75,7 @@ void ASpell::addSpeller(string const & lang) ASpell::Result ASpell::check(WordLangTuple const & word) { - Result res = UNKNOWN; + Result res = UNKNOWN_WORD; Spellers::iterator it = spellers_.find(word.lang_code()); if (it == spellers_.end()) { @@ -99,9 +99,9 @@ ASpell::Result ASpell::check(WordLangTuple const & word) BOOST_ASSERT(sugs != 0); els = aspell_word_list_elements(sugs); if (aspell_word_list_empty(sugs)) - res = UNKNOWN; + res = UNKNOWN_WORD; else - res = MISSED; + res = SUGGESTED_WORDS; } return res; } diff --git a/src/aspell_local.h b/src/aspell_local.h index 8d72099705..59d67294c4 100644 --- a/src/aspell_local.h +++ b/src/aspell_local.h @@ -49,7 +49,7 @@ public: /// accept the given word temporarily virtual void accept(WordLangTuple const &); - /// return the next near miss after a MISSED result + /// return the next near miss after a SUGGESTED_WORDS result virtual std::string const nextMiss(); /// give an error message on messy exit diff --git a/src/buffer.C b/src/buffer.C index 4a7de29cb7..d93d9ac832 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -79,6 +79,7 @@ #include #include #include +#include using lyx::pos_type; diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 5babff8eb7..6be78120d8 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2005-01-20 Angus Leeming + + * ControlSpellchecker.C (check): s/IGNORE/IGNORED_WORD/. + 2005-01-17 Angus Leeming * tex_helpers.C (rescanTexStyles): prepend the name of the diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 2ca4645259..40a73dba5d 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -195,7 +195,7 @@ void ControlSpellchecker::check() BufferParams & bufferparams = kernel().buffer().params(); - while (res == SpellBase::OK || res == SpellBase::IGNORE) { + while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) { word_ = nextWord(cur, start, bufferparams); // end of document @@ -237,7 +237,7 @@ void ControlSpellchecker::check() kernel().bufferview()->update(); // set suggestions - if (res != SpellBase::OK && res != SpellBase::IGNORE) { + if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) { lyxerr[Debug::GUI] << "Found a word needing checking." << endl; dialog().view().partialUpdate(SPELL_FOUND_WORD); } diff --git a/src/ispell.C b/src/ispell.C index 6a2aac96b4..c14e5da106 100644 --- a/src/ispell.C +++ b/src/ispell.C @@ -373,18 +373,18 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word) if (error) { error_ = _("Could not communicate with the spell-checker program."); - return UNKNOWN; + return UNKNOWN_WORD; } if (err_read) { error_ = buf; - return UNKNOWN; + return UNKNOWN_WORD; } // I think we have to check if ispell is still alive here because // the signal-handler could have disabled blocking on the fd if (!alive()) - return UNKNOWN; + return UNKNOWN_WORD; switch (*buf) { case '*': @@ -394,18 +394,18 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word) res = ROOT; break; case '-': - res = COMPOUNDWORD; + res = COMPOUND_WORD; break; case '\n': - res = IGNORE; + res = IGNORED_WORD; break; case '#': // Not found, no near misses and guesses - res = UNKNOWN; + res = UNKNOWN_WORD; break; case '?': // Not found, and no near misses, but guesses (guesses are ignored) case '&': // Not found, but we have near misses { - res = MISSED; + res = SUGGESTED_WORDS; char * p = strpbrk(buf, ":"); str = new char[strlen(p) + 1]; e = str; @@ -413,11 +413,11 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word) break; } default: // This shouldn't happen, but you know Murphy - res = UNKNOWN; + res = UNKNOWN_WORD; } *buf = 0; - if (res != IGNORE) { + if (res != IGNORED_WORD) { /* wait for ispell to finish */ while (*buf!= '\n') fgets(buf, 255, in); diff --git a/src/ispell.h b/src/ispell.h index ae14e337d4..e33d848cb7 100644 --- a/src/ispell.h +++ b/src/ispell.h @@ -45,7 +45,7 @@ public: /// accept the given word temporarily virtual void accept(WordLangTuple const & word); - /// return the next near miss after a MISSED result + /// return the next near miss after a SUGGESTED_WORDS result virtual std::string const nextMiss(); /// give an error message on messy exit diff --git a/src/pspell.C b/src/pspell.C index a3b050afca..9ca0feaeee 100644 --- a/src/pspell.C +++ b/src/pspell.C @@ -83,7 +83,7 @@ void PSpell::addManager(string const & lang) enum PSpell::Result PSpell::check(WordLangTuple const & word) { - Result res = UNKNOWN; + Result res = UNKNOWN_WORD; Managers::iterator it = managers_.find(word.lang_code()); if (it == managers_.end()) { @@ -107,9 +107,9 @@ enum PSpell::Result PSpell::check(WordLangTuple const & word) BOOST_ASSERT(sugs != 0); els = pspell_word_list_elements(sugs); if (pspell_word_list_empty(sugs)) - res = UNKNOWN; + res = UNKNOWN_WORD; else - res = MISSED; + res = SUGGESTED_WORDS; } return res; } diff --git a/src/pspell.h b/src/pspell.h index 2b676d8d43..3323e8a769 100644 --- a/src/pspell.h +++ b/src/pspell.h @@ -49,7 +49,7 @@ public: /// accept the given word temporarily virtual void accept(WordLangTuple const &); - /// return the next near miss after a MISSED result + /// return the next near miss after a SUGGESTED_WORDS result virtual std::string const nextMiss(); /// give an error message on messy exit -- 2.39.2