allow to use new pspell

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4871 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-08-06 02:37:41 +00:00
parent 0547580aad
commit e5d2dc5dcd
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2002-08-06 John Levon <levon@movementarian.org>
* pspell.C: fix a crash, and allow new aspell to work
2002-08-06 John Levon <levon@movementarian.org> 2002-08-06 John Levon <levon@movementarian.org>
* lyxfunc.C: * lyxfunc.C:

View File

@ -18,21 +18,27 @@
#include "support/LAssert.h" #include "support/LAssert.h"
#define USE_ORIGINAL_MANAGER_FUNCS 1 #define USE_ORIGINAL_MANAGER_FUNCS 1
// new aspell pspell missing extern "C"
extern "C" {
#include <pspell/pspell.h> #include <pspell/pspell.h>
}
#include "pspell.h" #include "pspell.h"
using std::endl;
PSpell::PSpell(BufferParams const & params, string const & lang) PSpell::PSpell(BufferParams const &, string const & lang)
: sc(0), els(0), spell_error_object(0), alive_(false) : sc(0), els(0), spell_error_object(0), alive_(false)
{ {
PspellConfig * config = new_pspell_config(); PspellConfig * config = new_pspell_config();
config->replace("language-tag", lang.c_str()); pspell_config_replace(config, "lang", lang.c_str());
spell_error_object = new_pspell_manager(config); spell_error_object = new_pspell_manager(config);
if (pspell_error_number(spell_error_object) == 0) { if (pspell_error_number(spell_error_object) == 0) {
sc = to_pspell_manager(spell_error_object); sc = to_pspell_manager(spell_error_object);
spell_error_object = 0; spell_error_object = 0;
alive_ = true; alive_ = true;
} else {
lyxerr << pspell_error_message(spell_error_object) << endl;
} }
} }
@ -118,7 +124,7 @@ string const PSpell::error()
{ {
char const * err = 0; char const * err = 0;
if (pspell_error_number(spell_error_object) != 0) { if (spell_error_object && pspell_error_number(spell_error_object) != 0) {
err = pspell_error_message(spell_error_object); err = pspell_error_message(spell_error_object);
} }