diff --git a/development/Win32/aspell/CMakeLists.txt b/development/Win32/aspell/CMakeLists.txt new file mode 100644 index 0000000000..3665e2b51b --- /dev/null +++ b/development/Win32/aspell/CMakeLists.txt @@ -0,0 +1,176 @@ +project(aspell) + + +######################################################################## +# +# Aspell Library +# + +set(libaspell_sources + ../common/cache.cpp + ../common/string.cpp + ../common/getdata.cpp + ../common/itemize.cpp + ../common/file_util.cpp + ../common/string_map.cpp + ../common/string_list.cpp + ../common/config.cpp + ../common/posib_err.cpp + ../common/errors.cpp + ../common/error.cpp + ../common/fstream.cpp + ../common/iostream.cpp + ../common/info.cpp + ../common/can_have_error.cpp + ../common/convert.cpp + ../common/convert_filter.cpp + ../common/speller.cpp + ../common/checker.cpp + ../common/filter.cpp + ../common/objstack.cpp + ../common/strtonum.cpp + ../common/gettext_init.cpp + ../common/file_data_util.cpp + ../modules/speller/default/readonly_ws.cpp + ../modules/speller/default/suggest.cpp + ../modules/speller/default/data.cpp + ../modules/speller/default/multi_ws.cpp + ../modules/speller/default/phonetic.cpp + ../modules/speller/default/writable.cpp + ../modules/speller/default/speller_impl.cpp + ../modules/speller/default/checker_impl.cpp + ../modules/speller/default/phonet.cpp + ../modules/speller/default/typo_editdist.cpp + ../modules/speller/default/editdist.cpp + ../modules/speller/default/primes.cpp + ../modules/speller/default/lang_impl.cpp + ../modules/speller/default/leditdist.cpp + ../modules/speller/default/affix.cpp + ../lib/word_list-c.cpp + ../lib/info-c.cpp + ../lib/mutable_container-c.cpp + ../lib/error-c.cpp + ../lib/string_map-c.cpp + ../lib/new_config.cpp + ../lib/config-c.cpp + ../lib/string_enumeration-c.cpp + ../lib/can_have_error-c.cpp + ../lib/dummy.cpp + ../lib/new_filter.cpp + ../lib/new_fmode.cpp + ../lib/string_list-c.cpp + ../lib/find_speller.cpp + ../lib/speller-c.cpp + ../lib/speller-cm.cpp + ../lib/string_pair_enumeration-c.cpp + ../lib/new_checker.cpp + ../lib/checker-c.cpp + ../lib/document_checker-c.cpp + ../lib/convert-c.cpp + ../lib/language-c.cpp + ../lib/language_types-c.cpp + ../lib/language-cm.cpp + ../lib/munch_list.cpp + + +# This is for filters which are ALWAYS static. +# The url filter is always usefull and fairly simple. +# The genconv filter is mostly defined in the main aspell libarary +# since it is used by other filters. The actual genconv filter +# is just a small wrapper. + + ../modules/filter/url.cpp + ../modules/filter/genconv.cpp + + +### msvc win32 support + ../win32/libstub.cpp +) + +file(GLOB commons_headers ../common/*.hpp) + +if(COMPILE_IN_FILTERS) + +### Add your filter sources here, +### starting with file containing filter class definition followed by +### file containing filter member implementation. +set(libaspell_sources + ${libaspell_sources} + ../modules/filter/email.cpp + ../modules/filter/tex.cpp + ../modules/filter/sgml.cpp + ../modules/filter/context.cpp + ../modules/filter/nroff.cpp + ../modules/filter/texinfo.cpp +) +endif(COMPILE_IN_FILTERS) + + +include_directories( + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/../win32 + ${CMAKE_SOURCE_DIR}/../gen + ${CMAKE_SOURCE_DIR}/../lib + ${CMAKE_SOURCE_DIR}/../common + ${CMAKE_SOURCE_DIR}/../modules + ${CMAKE_SOURCE_DIR}/../modules/filter + ${CMAKE_SOURCE_DIR}/../modules/speller + ${CMAKE_SOURCE_DIR}/../modules/speller/default + ${CMAKE_SOURCE_DIR}/../interfaces/cc +) + +if(MSVC) + # debug library name: aspelld.lib + # release library name: aspell.lib + set(CMAKE_DEBUG_POSTFIX "d") + if(MSVC_IDE) + else(MSVC_IDE) + SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST) + endif(MSVC_IDE) + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4522 -wd4521 -wd4996 -wd4800") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -wd4522 -wd4521 -wd4996 -wd4800") + SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) +endif(MSVC) + +add_definitions(-DWIN32PORT) +add_library(aspell STATIC ${libaspell_sources} ${commons_headers}) + + + +######################################################################## +# +# Aspell Program +# + +set(aspell_SOURCES + ../prog/aspell.cpp + ../prog/check_funs.cpp + ../prog/checker_string.cpp + ) + +add_executable(aspellexe ${aspell_SOURCES}) + +target_link_libraries(aspellexe aspell ole32) + + + +######################################################################## +# +# Install +# + +set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../gnuwin32) + +install(TARGETS aspellexe aspell + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES ../interfaces/cc/aspell.h + DESTINATION include) + + + + diff --git a/development/Win32/aspell/Readme.txt b/development/Win32/aspell/Readme.txt new file mode 100644 index 0000000000..5cdd8ce4ac --- /dev/null +++ b/development/Win32/aspell/Readme.txt @@ -0,0 +1,36 @@ +Aspell on Windows + +You need cmake and cygwin. + +- check out the latest CVS version: + http://savannah.gnu.org/cvs/?group=aspell + +- copy the files from the LyX SVN to the other + files in the win32 folder of aspell + +- with cygwin patch aspell, call in aspell/: + patch -p0 -i win32/win32-aspell.patch + +- generate missing source files with cygwin: + ./autogen + +- make a separate build directory and run + on a standard Windows command promp + cmake \win32 + build and install debug AND release libraries + +- build mingw makefiles files in + - cmd.exe shell: + cmake -G"MinGW Makefiles" \win32 + - in a MSYS shell + cmake -G"MSYS Makefiles" \win32 + + +The patched Aspell reads the location of the dictonary from +the registry. You can either install the dictionaries using +the official 1.4.2 installer or download them at: +http://wiki.lyx.org/Windows/Aspell6 + + + + diff --git a/development/Win32/aspell/static_filters.src.cpp b/development/Win32/aspell/static_filters.src.cpp new file mode 100644 index 0000000000..7e7fe8c2e3 --- /dev/null +++ b/development/Win32/aspell/static_filters.src.cpp @@ -0,0 +1,36 @@ +/*File generated during static filter build + Automatically generated file +*/ + + extern "C" IndividualFilter * new_aspell_url_filter(); + + static FilterEntry standard_filters[] = { + {"url",0,new_aspell_url_filter,0} + }; + + const unsigned int standard_filters_size = sizeof(standard_filters)/sizeof(FilterEntry); + + static KeyInfo url_options[] = { + "" + }; + + const KeyInfo * url_options_begin = url_options; + + const KeyInfo * url_options_end = url_options+sizeof(url_options)/sizeof(KeyInfo); + + + static ConfigModule filter_modules[] = { + { + "url",0, + "filter to skip URL like constructs", + url_options_begin,url_options_end + } + }; + + const ConfigModule * filter_modules_begin = filter_modules; + + const ConfigModule * filter_modules_end = filter_modules+sizeof(filter_modules)/sizeof(ConfigModule); + + const size_t filter_modules_size = sizeof(filter_modules); + + diff --git a/development/Win32/aspell/win32-aspell.patch b/development/Win32/aspell/win32-aspell.patch new file mode 100644 index 0000000000..38893a2790 --- /dev/null +++ b/development/Win32/aspell/win32-aspell.patch @@ -0,0 +1,205 @@ +Index: common/config.cpp +=================================================================== +RCS file: /sources/aspell/aspell/common/config.cpp,v +retrieving revision 1.78 +diff -u -b -B -p -r1.78 config.cpp +--- common/config.cpp 21 Oct 2005 12:16:03 -0000 1.78 ++++ common/config.cpp 30 Aug 2006 22:05:30 -0000 +@@ -1581,3 +1581,61 @@ namespace aspell { + } + + } ++ ++ ++#ifdef WIN32PORT ++ ++#include "string.hpp" ++ ++using namespace aspell; ++namespace acommon { ++ ++ String ReadRegString(HKEY hive, String key, String name) ++ { ++ ++ // Reads a string from the Windows registry (used to get paths) ++ ++ HKEY hKey; ++ unsigned long lType; ++ DWORD dwSize; ++ unsigned char* szValue = NULL; ++ ++ if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS) ++ { ++ if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS) ++ { ++ szValue = new unsigned char[dwSize + 1]; ++ ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize); ++ String RegistryReturn((char*)szValue); ++ delete[] szValue; ++ return RegistryReturn; ++ } else { ++ return ""; ++ } ++ } else { ++ return ""; ++ } ++ ++ } ++ ++ HKEY GetRegHive() ++ { ++ ++ // Check whether Aspell is installed for the current user or for all users ++ ++ String value; ++ ++ if (ReadRegString(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Dictionary Path") == "") ++ { ++ return HKEY_CURRENT_USER; ++ } else { ++ return HKEY_LOCAL_MACHINE; ++ } ++ ++ } ++ ++} ++ ++#endif //WIN32PORT ++ ++ +Index: common/config.hpp +=================================================================== +RCS file: /sources/aspell/aspell/common/config.hpp,v +retrieving revision 1.27 +diff -u -b -B -p -r1.27 config.hpp +--- common/config.hpp 3 May 2005 05:08:19 -0000 1.27 ++++ common/config.hpp 30 Aug 2006 22:05:30 -0000 +@@ -277,5 +277,21 @@ namespace aspell { + + } + ++#ifdef WIN32PORT ++ ++#include "minwin.h" ++ ++namespace aspell { ++ class String; ++} ++ ++namespace acommon { ++ ++ extern HKEY GetRegHive(); ++ extern aspell::String ReadRegString(HKEY type, aspell::String key, aspell::String name); ++ ++} ++ ++#endif + #endif + +Index: common/gettext_init.cpp +=================================================================== +RCS file: /sources/aspell/aspell/common/gettext_init.cpp,v +retrieving revision 1.5 +diff -u -b -B -p -r1.5 gettext_init.cpp +--- common/gettext_init.cpp 3 May 2005 05:08:19 -0000 1.5 ++++ common/gettext_init.cpp 30 Aug 2006 22:05:30 -0000 +@@ -16,7 +15,21 @@ extern "C" void aspell_gettext_init() + if (did_init) return; + did_init = true; + } ++#ifdef WIN32PORT ++ // Registry key for Locale Path ++ ++ aspell::String value; ++ HKEY hive; ++ ++ hive = acommon::GetRegHive(); ++ value = acommon::ReadRegString(hive, "Software\\Aspell", "Locale Path"); ++ if (value == "") value = LOCALEDIR; ++ ++ bindtextdomain("aspell", value.c_str()); ++#else + bindtextdomain("aspell", LOCALEDIR); ++#endif ++ + } + + #else +Index: common/info.cpp +=================================================================== +RCS file: /sources/aspell/aspell/common/info.cpp,v +retrieving revision 1.39 +diff -u -b -B -p -r1.39 info.cpp +--- common/info.cpp 3 May 2005 05:08:19 -0000 1.39 ++++ common/info.cpp 30 Aug 2006 22:05:30 -0000 +@@ -17,9 +17,6 @@ + /* BSDi defines u_intXX_t types in machine/types.h */ + #include + #endif +-#if defined(WIN32) || defined(_WIN32) +-#include "minwin.h" //minimum windows declarations. +-#endif + + #include "iostream.hpp" + +@@ -574,7 +571,17 @@ namespace aspell { + StringList & lst) + { + lst.clear(); +- lst.add(config->retrieve("data-dir")); ++ String dictpath; ++ ++#ifdef WIN32PORT ++ HKEY hive = acommon::GetRegHive(); ++ // Registry key for dictionary path ++ dictpath =acommon::ReadRegString(hive, "Software\\Aspell", "Dictionary Path");; ++ if (dictpath == "") dictpath = config->retrieve("data-dir"); ++#else ++ dictpath = config->retrieve("data-dir"); ++#endif ++ lst.add(dictpath); + lst.add(config->retrieve("dict-dir")); + } + +Index: common/vector.hpp +=================================================================== +RCS file: /sources/aspell/aspell/common/vector.hpp,v +retrieving revision 1.15 +diff -u -b -B -p -r1.15 vector.hpp +--- common/vector.hpp 3 May 2005 05:08:19 -0000 1.15 ++++ common/vector.hpp 30 Aug 2006 22:05:30 -0000 +@@ -47,13 +47,13 @@ namespace aspell + } + T * data() {return &*this->begin();} + T * data(int pos) {return &*this->begin() + pos;} +- T * data_end() {return &*this->end();} ++ T * data_end() {return &this->back()+1;} + + T * pbegin() {return &*this->begin();} +- T * pend() {return &*this->end();} ++ T * pend() {return &this->back()+1;} + + const T * pbegin() const {return &*this->begin();} +- const T * pend() const {return &*this->end();} ++ const T * pend() const {return &this->back()+1;} + + template + U * datap() { +Index: win32/settings.h +=================================================================== +RCS file: /sources/aspell/aspell/win32/settings.h,v +retrieving revision 1.5 +diff -u -b -B -p -r1.5 settings.h +--- win32/settings.h 15 Feb 2005 08:52:58 -0000 1.5 ++++ win32/settings.h 30 Aug 2006 22:05:30 -0000 +@@ -106,7 +106,7 @@ + // declaring a template param. The other supporte compilers (Borlands + // BCB5.5 and GNU C++) require or allow it anywhere in the template + // decl. The macro TYPENAME is defines to whatever works. +-#ifdef _MSC_VER ++#if defined(_MSC_VER) && (_MSC_VER<1300) + #define TYPENAME + #else + #define TYPENAME typename + +