project(aspell)
+# default: build rel_0_60-branch
+# -DCVS_HEAD=1: build cvs HEAD version
+
+
+set(ASPELL_LIB_NAME libaspell)
+set(ASPELL_EXE_NAME aspell)
if(${LINK} MATCHES "shared" OR ASPELL_LINK)
set(ASPELL_SHARED_LIB 1)
endif(${LINK} MATCHES "shared" OR ASPELL_LINK)
+
+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+
########################################################################
#
# Aspell Library
#
+
set(libaspell_sources
../common/cache.cpp
../common/string.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
../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/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.
# is just a small wrapper.
../modules/filter/url.cpp
- ../modules/filter/genconv.cpp
-
)
-file(GLOB commons_headers ../common/*.hpp)
+if(NOT CVS_HEAD)
+ set(libaspell_sources ${libaspell_sources}
+ ../common/tokenizer.cpp
+ ../common/document_checker.cpp
+ ../modules/speller/default/language.cpp
+ ../modules/tokenizer/basic.cpp
+ ../lib/filter-c.cpp
+ ../lib/document_checker-c.cpp
+ # msvc win32 support
+ ../win32/dirent.c
+ )
+else(NOT CVS_HEAD)
+ set(libaspell_sources ${libaspell_sources}
+ ../common/convert_filter.cpp
+ ../common/checker.cpp
+ ../modules/speller/default/checker_impl.cpp
+ ../modules/speller/default/lang_impl.cpp
+ ../lib/speller-cm.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
+ ../modules/filter/genconv.cpp
+ # msvc win32 support
+ ../win32/libstub.cpp
+ )
+ set(CVS_HEAD 1 CACHE TYPE STRING)
+endif(NOT CVS_HEAD)
+
+
+file(GLOB commons_headers ../common/*.hpp )
+
+set(commons_headers ${commons_headers} ../interfaces/cc/aspell.h)
if(COMPILE_IN_FILTERS)
endif(MSVC)
if(WIN32)
- ### msvc win32 support
- set(libaspell_sources ${libaspell_sources} ../win32/libstub.cpp)
add_definitions(-DWIN32PORT)
endif(WIN32)
-add_library(aspell ${ASPELL_LINK} ${libaspell_sources} ${commons_headers})
+if(ASPELL_SHARED_LIB)
+ add_definitions(-DASPELL_MAKE_LIB -DASPELL_USE_SHARED)
+endif(ASPELL_SHARED_LIB)
+
+add_library(${ASPELL_LIB_NAME} ${ASPELL_LINK} ${libaspell_sources} ${commons_headers})
if(WIN32)
- target_link_libraries(aspell ole32)
+ target_link_libraries(${ASPELL_LIB_NAME} ole32)
endif(WIN32)
# Aspell Program
#
-set(aspell_SOURCES
- ../prog/aspell.cpp
- ../prog/check_funs.cpp
- ../prog/checker_string.cpp
- )
-
-add_executable(aspellexe ${aspell_SOURCES})
-
-if(WIN32)
- target_link_libraries(aspellexe aspell ole32)
-endif(WIN32)
+add_subdirectory(prog)
########################################################################
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../gnuwin32)
-install(TARGETS aspellexe aspell
+install(TARGETS ${ASPELL_LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES ../interfaces/cc/aspell.h
DESTINATION include)
-
-
+if(ASPELL_SHARED_LIB)
+ install(FILES ../win32/aspellexport.h
+ DESTINATION include)
+endif(ASPELL_SHARED_LIB)
Aspell on Windows
-You need cmake and cygwin (with Unix line endings!!).
+You need cmake and cygwin (cvs-HEAD:with Unix line endings!!).
-- check out the latest CVS version:
+- check out the rel_0_60-branch version of Aspell
http://savannah.gnu.org/cvs/?group=aspell
+ cvs -z9 -d:pserver:anonymous@cvs.savannah.gnu.org:\
+ /sources/aspell co -r rel_0_60-branch aspell
- first build with cygwin to autogenerate
all required files:
--- /dev/null
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * Portions of this software are based upon public domain software
+ * originally written at the National Center for Supercomputing Applications,
+ * University of Illinois, Urbana-Champaign.
+ */
+
+//#include <winposix_export.h>
+#include <windows.h>
+
+#include <malloc.h>
+#include <string.h>
+#include <errno.h>
+
+#include "dirent.h"
+
+/**********************************************************************
+ * Implement dirent-style opendir/readdir/closedir on Window 95/NT
+ *
+ * Functions defined are opendir(), readdir() and closedir() with the
+ * same prototypes as the normal dirent.h implementation.
+ *
+ * Does not implement telldir(), seekdir(), rewinddir() or scandir().
+ * The dirent struct is compatible with Unix, except that d_ino is
+ * always 1 and d_off is made up as we go along.
+ *
+ * The DIR typedef is not compatible with Unix.
+ **********************************************************************/
+
+
+KDEWIN32_EXPORT DIR * opendir(const char *dir)
+{
+ DIR *dp;
+ char *filespec;
+ long handle;
+ int index;
+
+ filespec = malloc(strlen(dir) + 2 + 1);
+ strcpy(filespec, dir);
+ index = strlen(filespec) - 1;
+ if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
+ filespec[index] = '\0';
+ strcat(filespec, "\\*");
+
+ dp = (DIR *)malloc(sizeof(DIR));
+ dp->offset = 0;
+ dp->finished = 0;
+ dp->dir = strdup(dir);
+
+ if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
+ if (errno == ENOENT)
+ dp->finished = 1;
+ else
+ return NULL;
+ }
+
+ dp->handle = handle;
+ free(filespec);
+
+ return dp;
+}
+
+KDEWIN32_EXPORT struct dirent * readdir(DIR *dp)
+{
+ if (!dp || dp->finished) return NULL;
+
+ if (dp->offset != 0) {
+ if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
+ dp->finished = 1;
+ return NULL;
+ }
+ }
+ dp->offset++;
+
+ strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME);
+ dp->dent.d_ino = 1;
+ dp->dent.d_reclen = strlen(dp->dent.d_name);
+ dp->dent.d_off = dp->offset;
+
+ return &(dp->dent);
+}
+
+KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ //todo: remove this when readdir_r.c will be ported
+ result = 0;
+ return 0;
+}
+
+KDEWIN32_EXPORT int closedir(DIR *dp)
+{
+ if (!dp) return 0;
+ _findclose(dp->handle);
+ if (dp->dir) free(dp->dir);
+ if (dp) free(dp);
+
+ return 0;
+}
+
--- /dev/null
+/* This file is part of the KDE project
+ Copyright (C) 2000 Werner Almesberger
+
+ libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KDEWIN_SYS_DIRENT_H
+#define KDEWIN_SYS_DIRENT_H
+
+// include everywhere
+#include <sys/types.h>
+
+#include <io.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+//#include <sys/lock.h>
+
+# define F_OK 0 //does the file exist?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */
+#define HAVE_DD_LOCK /* have locking mechanism */
+
+#define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */
+
+#define __dirfd(dir) (dir)->dd_fd
+
+/* struct dirent - same as Unix */
+struct dirent {
+ long d_ino; /* inode (always 1 in WIN32) */
+ off_t d_off; /* offset to this dirent */
+ unsigned short d_reclen; /* length of d_name */
+ char d_name[_MAX_FNAME+1]; /* filename (null terminated) */
+};
+
+/* typedef DIR - not the same as Unix */
+typedef struct {
+ long handle; /* _findfirst/_findnext handle */
+ short offset; /* offset into directory */
+ short finished; /* 1 if there are not more files */
+ struct _finddata_t fileinfo; /* from _findfirst/_findnext */
+ char *dir; /* the dir we are reading */
+ struct dirent dent; /* the dirent to return */
+} DIR;
+
+/* --- redundant --- */
+
+//DIR *opendir(const char *);
+//struct dirent *readdir(DIR *);
+//void rewinddir(DIR *);
+//int closedir(DIR *);
+
+/* internal prototype */
+void _seekdir(DIR *dir,off_t offset);
+
+//#ifndef _POSIX_SOURCE
+//long telldir (DIR *);
+//void seekdir (DIR *, off_t loc);
+
+#define KDEWIN32_EXPORT
+
+KDEWIN32_EXPORT int scandir (const char *__dir,
+ struct dirent ***__namelist,
+ int (*select) (const struct dirent *),
+ int (*compar) (const struct dirent **, const struct dirent **));
+
+KDEWIN32_EXPORT DIR * opendir(const char *);
+KDEWIN32_EXPORT int closedir(DIR *);
+KDEWIN32_EXPORT struct dirent* readdir(DIR *);
+KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
+
+int alphasort (const struct dirent **__a, const struct dirent **__b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // KDEWIN_SYS_DIRENT_H
--- /dev/null
+#ifndef minimum_windows_declarations_h
+#define minimum_windows_declarations_h
+
+//Tell windows.h not to make declarations that we do not use
+//See windows.h for descriptions of what is turned off by what.
+
+#define NOGDICAPMASKS
+#define NOVIRTUALKEYCODES
+#define NOWINMESSAGES
+#define NOWINSTYLES
+#define NOSYSMETRICS
+#define NOMENUS
+#define NOICONS
+#define NOKEYSTATES
+#define NOSYSCOMMANDS
+#define NORASTEROPS
+#define NOSHOWWINDOW
+#define OEMRESOURCE
+#define NOATOM
+#define NOCLIPBOARD
+#define NOCOLOR
+#define NOCTLMGR
+#define NODRAWTEXT
+#define NOGDI
+#define NOKERNEL
+#define NOUSER
+#define NONLS
+#define NOMB
+#define NOMEMMGR
+#define NOMETAFILE
+#define NOMINMAX
+#define NOMSG
+#define NOOPENFILE
+#define NOSCROLL
+#define NOSERVICE
+#define NOSOUND
+#define NOTEXTMETRIC
+#define NOWH
+#define NOWINOFFSETS
+#define NOCOMM
+#define NOKANJI
+#define NOHELP
+#define NOPROFILER
+#define NODEFERWINDOWPOS
+#define NOCRYPT
+#define NOMCX
+
+# include <windows.h>
+#endif
--- /dev/null
+project(aspell)
+
+
+########################################################################
+#
+# Aspell Program
+#
+
+set(aspell_SOURCES
+ ../../prog/aspell.cpp
+ ../../prog/check_funs.cpp
+ ../../prog/checker_string.cpp
+ )
+
+add_executable(${ASPELL_EXE_NAME} ${aspell_SOURCES})
+
+if(WIN32)
+ target_link_libraries(${ASPELL_EXE_NAME} ${ASPELL_LIB_NAME} ole32)
+endif(WIN32)
+
+########################################################################
+#
+# Install
+#
+
+set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../gnuwin32)
+
+install(TARGETS ${ASPELL_EXE_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+install(FILES ../interfaces/cc/aspell.h
+ DESTINATION include)
+
+
--- /dev/null
+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 <machine/types.h>
+ #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 <typename U>
+ 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
+
+
+++ /dev/null
-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 <machine/types.h>
- #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 <typename U>
- 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
-
-