Disable the lyxserver on Windows.

Clean up spellchecker code.
LyX 1.3.x should now compile out of the box on Windows.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9929 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-05-10 15:00:16 +00:00
parent 17f46e57dc
commit 4bf2365fe7
25 changed files with 133 additions and 252 deletions

View File

@ -1,3 +1,7 @@
2005-05-09 Angus Leeming <leeming@lyx.org>
* autogen.sh (ACINCLUDE_FILES): remove pspell.m4. Add spell.m4.
2005-02-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Makefile.am: remove hack for making bindist work with autoconf

View File

@ -4,7 +4,7 @@ ACLOCAL="aclocal"
AUTOHEADER="autoheader"
AUTOMAKE="automake -a -c --foreign"
AUTOCONF="autoconf"
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pspell.m4 cygwin.m4 pkg.m4"
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 spell.m4 cygwin.m4 pkg.m4"
# Discover what version of autoconf we are using.
autoversion=`$AUTOCONF --version | head -n 1`

View File

@ -1,3 +1,14 @@
2005-05-09 Angus Leeming <leeming@lyx.org>
* Makefile.am: remove pspell.m4 and add spell.m4.
* pspell.m4: removed.
* spell.m4: new. Incorporates the code in pspell but also adds
a test for whether the ISpell-handling code should be compiled.
* configure.ac:
* configure.in: remove CHECK_WITH_PSPELL. Add LYX_CHECK_SPELL_ENGINES
2005-04-22 Angus Leeming <leeming@lyx.org>
* qt.m4: Move the Qt-specific preprocessor flags out of the

View File

@ -3,5 +3,5 @@ include $(top_srcdir)/config/common.am
EXTRA_DIST = common.am codeset.m4 libtool.m4 gettext.m4 \
lyxinclude.m4 lyxinclude25x.m4 lyxinclude213.m4 \
glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 \
qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pkg.m4 xforms.m4 pspell.m4 \
qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pkg.m4 xforms.m4 spell.m4 \
relyx_configure.ac relyx_configure.in cygwin.m4

View File

@ -133,9 +133,6 @@ AC_LIBTOOL_WIN32_DLL
#AM_PROG_LIBTOOL
LYX_PROG_LIBTOOL
### Check if we want pspell libraries
CHECK_WITH_PSPELL
### Check for some Cygwin-specific details.
CHECK_WITH_CYGWIN
@ -271,6 +268,7 @@ AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo mkstemp mktemp \
lstat readlink)
AC_LANG_POP(C)
LYX_CHECK_SPELL_ENGINES
dnl Until this is fixed in autoconf we provide our own version
AC_FUNC_SELECT_ARGTYPES

View File

@ -136,9 +136,6 @@ AC_LIBTOOL_WIN32_DLL
#AM_PROG_LIBTOOL
LYX_PROG_LIBTOOL
### Check if we want pspell libraries
CHECK_WITH_PSPELL
### Check for some Cygwin-specific details.
CHECK_WITH_CYGWIN
@ -276,6 +273,8 @@ AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo mkstemp mktemp \
lstat readlink)
AC_LANG_CPLUSPLUS
LYX_CHECK_SPELL_ENGINES
dnl Until this is fixed in autoconf we provide our own version
LYX_FUNC_SELECT_ARGTYPES

View File

@ -1,55 +0,0 @@
# Macro to add for using pspell spellchecker libraries! -*- sh -*-
# @author@: Jürgen Vigna
AC_DEFUN([CHECK_WITH_PSPELL],
[
USE_PSPELL="no"
AC_MSG_CHECKING([for pspell support])
AC_ARG_WITH(pspell,
[ --with-pspell use PSpell libraries],[
if test "$withval" != "no"; then
USE_PSPELL="yes"
fi
])
AC_ARG_WITH(pspell-includes, [ --with-pspell-include where the pspell.h is located],
pspell_use_include="$withval",
pspell_use_include=NONE)
if test "$pspell_use_include" = "" || \
test "$pspell_use_include" = "NONE"; then
pspell_includes="/usr/include /usr/local/include"
AC_FIND_FILE(pspell/pspell.h,$pspell_includes,pspell_use_include)
fi
AC_ARG_WITH(pspell-libs, [ --with-pspell-lib where the libpspell.a is located],
pspell_use_lib="$withval",
pspell_use_lib=NONE)
if test -n "$pspell_use_lib" && \
test "$pspell_use_lib" != "NONE"; then
pspell_lib_found="Setting to $pspell_use_lib"
else
pspell_libs="/usr/lib /usr/lib/pspell /usr/local/lib /usr/local/lib/pspell"
AC_FIND_FILE(libpspell.la libpspell.so libpspell.a,$pspell_libs,pspell_use_lib)
pspell_lib_found="yes"
fi
if test "$pspell_use_include" = "NO" || \
test "$pspell_use_lib" = "NO"; then
if test "$USE_PSPELL" = "yes"; then
USE_PSPELL="not found"
fi
fi
if test "$USE_PSPELL" = "yes"; then
AC_DEFINE(USE_PSPELL, 1, [Define as 1 to use the pspell library])
PSPELL_INCLUDES="-I$pspell_use_include"
PSPELL_LIBS="-L$pspell_use_lib -lpspell"
USE_PSPELL="yes ($pspell_use_include $pspell_use_lib)"
AC_SUBST(PSPELL_INCLUDES)
AC_SUBST(PSPELL_LIBS)
lyx_flags="$lyx_flags use-pspell"
fi
AC_MSG_RESULT($USE_PSPELL)
])

View File

@ -1,29 +1,3 @@
# Macro to add for using aspell spellchecker libraries! -*- sh -*-
# Only checks for "new" aspell, > 0.50
AC_DEFUN([CHECK_WITH_ASPELL],
[
lyx_use_aspell=true
AC_ARG_WITH(aspell, AC_HELP_STRING([--with-aspell],[use ASpell libraries]))
test "$with_aspell" = "no" && lyx_use_aspell=false
if $lyx_use_aspell ; then
AC_CHECK_HEADERS(aspell.h aspell/aspell.h,
[lyx_use_aspell=true; break;],
[lyx_use_aspell=false])
AC_CHECK_LIB(aspell, new_aspell_config, LIBS="-laspell $LIBS", lyx_use_aspell=false)
AC_MSG_CHECKING([whether to use aspell])
if $lyx_use_aspell ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_ASPELL, 1, [Define as 1 to use the aspell library])
lyx_flags="$lyx_flags use-aspell"
else
AC_MSG_RESULT(no)
fi
fi
])
# Macro to add for using pspell spellchecker libraries! -*- sh -*-
# @author@: Jürgen Vigna
AC_DEFUN([CHECK_WITH_PSPELL],
@ -47,22 +21,17 @@ AC_DEFUN([CHECK_WITH_PSPELL],
fi
])
### Check if we want spell libraries, prefer new aspell
### Check if we want spell libraries, prefer pspell
AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
[
lyx_use_aspell=false
lyx_use_pspell=false
lyx_use_ispell=false
dnl Prefer use of the aspell library over pspell.
CHECK_WITH_ASPELL
if $lyx_use_aspell ; then : ; else
CHECK_WITH_PSPELL
fi
dnl check for the ability to communicate through unix pipes
dnl with an external ispell process.
dnl Do this independent of the existence of the aspell, pspell libraries.
dnl Do this independent of the existence of the pspell library.
lyx_use_ispell=true
AC_LANG_PUSH(C)
AC_CHECK_FUNCS(fork,, [lyx_use_ispell=false])
@ -76,7 +45,6 @@ AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
AM_CONDITIONAL(USE_PSPELL, $lyx_use_pspell)
AM_CONDITIONAL(USE_ISPELL, $lyx_use_ispell)
])

View File

@ -1,130 +0,0 @@
Index: src/ispell.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ispell.C,v
retrieving revision 1.5.2.5
diff -u -a -u -r1.5.2.5 ispell.C
--- src/ispell.C 7 Dec 2004 10:48:23 -0000 1.5.2.5
+++ src/ispell.C 15 Apr 2005 22:28:12 -0000
@@ -21,12 +21,28 @@
#include "support/forkedcall.h"
#include "support/lstrings.h"
+#ifdef _WIN32
+// sys/select.h
+# define FD_ZERO(a)
+# define FD_SET(a,b)
+# define FD_ISSET(fd, set) 0
+//sys/types.h
+# define fd_set int
+// unistd.h
+# define fork() -1
+# define pipe(a) _pipe(a,0,0)
+#endif
+
// HP-UX 11.x doesn't have this header
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <sys/time.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifndef CXX_GLOBAL_CSTD
using std::strcpy;
using std::strlen;
@@ -309,11 +325,15 @@
tv.tv_sec = 2;
tv.tv_usec = 0;
+#ifdef _WIN32
+ retval = -1;
+#else
retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
SELECT_TYPE_ARG234 (&infds),
0,
0,
SELECT_TYPE_ARG5 (&tv));
+#endif
// error
if (retval <= 0)
Index: src/lyx_cb.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
retrieving revision 1.190.2.3
diff -u -a -u -r1.190.2.3 lyx_cb.C
--- src/lyx_cb.C 10 Jan 2005 19:17:24 -0000 1.190.2.3
+++ src/lyx_cb.C 15 Apr 2005 20:29:06 -0000
@@ -37,6 +37,11 @@
#include "support/systemcall.h"
#include "support/lstrings.h"
+#ifdef _WIN32
+// unistd.h
+# define fork() -1
+#endif
+
#include "BoostFormat.h"
#include <fstream>
Index: src/lyxserver.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v
retrieving revision 1.48.2.3
diff -u -a -u -r1.48.2.3 lyxserver.C
--- src/lyxserver.C 20 Jan 2005 10:47:28 -0000 1.48.2.3
+++ src/lyxserver.C 15 Apr 2005 22:22:20 -0000
@@ -36,14 +36,6 @@
#include <config.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <cerrno>
-
#include "lyxserver.h"
#include "debug.h"
#include "lyxfunc.h"
@@ -51,14 +43,28 @@
#include "support/lyxlib.h"
#include "frontends/lyx_gui.h"
-#ifdef __EMX__
-#include <cstdlib>
-#include <io.h>
-#define OS2EMX_PLAIN_CHAR
-#define INCL_DOSNMPIPES
-#define INCL_DOSERRORS
-#include <os2.h>
-#include "support/os2_errortable.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <cerrno>
+#include <fcntl.h>
+
+#if defined (_WIN32)
+# define F_SETFD 2
+# define F_SETFL 4
+# define O_NONBLOCK 0x4000
+ inline int fcntl (int, int, ...) {return -1;}
+
+#elif defined (__EMX__)
+# include <cstdlib>
+# include <io.h>
+# define OS2EMX_PLAIN_CHAR
+# define INCL_DOSNMPIPES
+# define INCL_DOSERRORS
+# include <os2.h>
+# include "support/os2_errortable.h"
+
+#else // POSIX
+# include <unistd.h>
#endif
using std::endl;

View File

@ -6,6 +6,7 @@ src/LColor.C
src/LaTeX.C
src/LyXAction.C
src/MenuBackend.C
src/SpellBase.C
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C

View File

@ -1,3 +1,19 @@
2005-05-09 Angus Leeming <leeming@lyx.org>
* Makefile.am: make compilation of pspell.[Ch] and ispell.[Ch] dependent
on conditionals set at configure time.
* SpellBase.[Ch]: no longer an abstract base class. Instead,
it can be compiled in its own right but has no-op functionality.
* lyx_cb.C: artificially define fork() on Windows as a no-op failing
function so that auto-saving works, albeit in a blocking manner.
* lyxfunc.C (getStatus): disable the spellchecker if USE_[IP]SPELL
are not defined.
* lyxserver.C: disable on Windows.
2005-04-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxlayout.C (Read): transform underscores to spaces in CopyStyle

View File

@ -35,6 +35,13 @@ localedir = $(datadir)/locale
BUILT_SOURCES = version.C
if USE_PSPELL
PSPELL = pspell.C pspell.h
endif
if USE_ISPELL
ISPELL = ispell.C ispell.h
endif
lyx_SOURCES = \
BoostFormat.h \
BufferView.C \
@ -180,11 +187,8 @@ lyx_SOURCES = \
paragraph.h \
paragraph_pimpl.C \
paragraph_pimpl.h \
$(PSPELL) $(ISPELL) SpellBase.C \
SpellBase.h \
ispell.C \
ispell.h \
pspell.C \
pspell.h \
sgml.C \
sgml.h \
tabular.C \

View File

@ -25,7 +25,7 @@ bool SpellBase::alive()
SpellBase::Result SpellBase::check(WordLangTuple const &)
{
return UNKNOWN_WORD;
return UNKNOWN;
}

View File

@ -17,6 +17,7 @@ class WordLangTuple;
/**
* Base class of all spell checker implementations.
* The class can be instantiated but will have no functionality.
*/
class SpellBase {
public:
@ -34,22 +35,22 @@ public:
virtual ~SpellBase() {}
/// return true if the spellchecker instance still exists
virtual bool alive() = 0;
virtual bool alive();
/// check the given word of the given lang code and return the result
virtual enum Result check(WordLangTuple const &) = 0;
virtual enum Result check(WordLangTuple const &);
/// insert the given word into the personal dictionary
virtual void insert(WordLangTuple const &) = 0;
virtual void insert(WordLangTuple const &);
/// accept the given word temporarily
virtual void accept(WordLangTuple const &) = 0;
virtual void accept(WordLangTuple const &);
/// return the next near miss after a MISSED result
virtual string const nextMiss() = 0;
virtual string const nextMiss();
/// give an error message on messy exit
virtual string const error() = 0;
virtual string const error();
};

View File

@ -1,3 +1,8 @@
2005-05-09 Angus Leeming <leeming@lyx.org>
* ControlSpellchecker.C: clean-up the creation of the wrappers to
the different possible spelling engines.
2005-03-15 Eitan Frachtenberg <sky8an@gmail.com>
* biblio.C (getInfo): Show BibTeX annotation in citation preview

View File

@ -20,10 +20,14 @@
#include "lyxtext.h"
#include "debug.h"
#include "ispell.h"
#ifdef USE_PSPELL
# include "pspell.h"
#endif
#if defined(USE_ISPELL)
# include "ispell.h"
#else
# include "SpellBase.h"
#endif
#include "frontends/Alert.h"
@ -75,13 +79,17 @@ void ControlSpellchecker::startSession()
speller_.reset(new PSpell(buffer()->params, tmp));
} else {
#endif
#if defined(USE_ISPELL)
tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : buffer()->params.language->lang();
speller_.reset(new ISpell(buffer()->params, tmp));
#else
speller_.reset(new SpellBase);
#endif // USE_ISPELL
#ifdef USE_PSPELL
}
#endif
#endif //USE_PSPELL
// reset values to initial
newval_ = 0.0;

View File

@ -1,3 +1,8 @@
2005-05-04 Angus Leeming <leeming@lyx.org>
* QPrefsDialog.C (QPrefsDialog): disable the spellCommandCO if
USE_ISPELL is not defined.
2005-04-22 Angus Leeming <leeming@lyx.org>
* Makefile.am:

View File

@ -281,7 +281,11 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
connect(pathsModule->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->pathPrefixED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
#if defined (USE_ISPELL)
connect(spellcheckerModule->spellCommandCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
#else
spellcheckerModule->spellCommandCO->setEnabled(false);
#endif
connect(spellcheckerModule->altLanguageED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(spellcheckerModule->escapeCharactersED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(spellcheckerModule->persDictionaryED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));

View File

@ -1,3 +1,8 @@
2005-05-09 Angus Leeming <leeming@lyx.org>
* FormPreferences.C (SpellOptions::build): disable the
choice_spell_command if USE_ISPELL is not defined.
2005-02-26 Michael Schmitt <michael.schmitt@teststep.org>
* FormBibtex.C:

View File

@ -2879,6 +2879,10 @@ void FormPreferences::SpellOptions::build()
fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
#if !defined (USE_ISPELL)
setEnabled(dialog_->choice_spell_command, false);
#endif
// set up the feedback mechanism
setPrehandler(dialog_->choice_spell_command);
setPrehandler(dialog_->check_alt_lang);

View File

@ -39,6 +39,10 @@
#include "BoostFormat.h"
#if !defined (HAVE_FORK)
# define fork() -1
#endif
#include <fstream>
#include <algorithm>
#include <utility>

View File

@ -375,6 +375,12 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
disable = (TEXT(false)->cursor.par()->layout()->optionalargs == 0);
break;
case LFUN_SPELLCHECK:
#if !defined (USE_ISPELL) && !defined (USE_PSPELL)
disable = true;
#endif
break;
case LFUN_TABULAR_FEATURE:
if (mathcursor) {
#if 0

View File

@ -63,14 +63,39 @@
using std::endl;
// provide an empty mkfifo() if we do not have one. This disables the
// lyxserver.
#ifndef HAVE_MKFIFO
int mkfifo(char const * __path, mode_t __mode) {
return 0;
}
#endif
#if !defined (HAVE_MKFIFO)
// We provide a stub class that disables the lyxserver.
void LyXComm::openConnection()
{}
void LyXComm::closeConnection()
{}
int LyXComm::startPipe(string const & filename, bool write)
{
return -1;
}
void LyXComm::endPipe(int & fd, string const & filename, bool write)
{}
void LyXComm::emergencyCleanup()
{}
void LyXComm::read_ready()
{}
void LyXComm::send(string const & msg)
{}
#else // defined (HAVE_MKFIFO)
void LyXComm::openConnection()
{
@ -343,6 +368,8 @@ void LyXComm::send(string const & msg)
#endif
}
#endif // defined (HAVE_MKFIFO)
// LyXServer class

View File

@ -9,8 +9,6 @@
#include <config.h>
#ifdef USE_PSPELL
#include "support/LAssert.h"
#include "debug.h"
@ -150,5 +148,3 @@ string const PSpell::error()
return err;
return "";
}
#endif // USE_PSPELL

View File

@ -72,4 +72,4 @@ private:
PspellCanHaveError * spell_error_object;
};
#endif // PSPELL_H
#endif // LYX_PSPELL_H