+2005-01-20 Angus Leeming <leeming@lyx.org>
+
+ * 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 <aalstrup@laerdal.dk>
+ * buffer.C: add #include <fstream>.
+
* lyx_main.C (init): Compile fix.
* lyxserver.[Ch] (inPipeName, outPipeName): move out of line.
/// 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() {}
/// 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
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()) {
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;
}
/// 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
#include <iomanip>
#include <stack>
#include <sstream>
+#include <fstream>
using lyx::pos_type;
+2005-01-20 Angus Leeming <leeming@lyx.org>
+
+ * ControlSpellchecker.C (check): s/IGNORE/IGNORED_WORD/.
+
2005-01-17 Angus Leeming <leeming@lyx.org>
* tex_helpers.C (rescanTexStyles): prepend the name of the
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
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);
}
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 '*':
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;
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);
/// 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
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()) {
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;
}
/// 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