-diff -riwBu -Xex aspell-setter-sep06/common/config.cpp aspell-setter-sep06-modified/common/config.cpp\r
---- aspell-setter-sep06/common/config.cpp 2005-12-12 17:41:06.000000000 +0100\r
-+++ aspell-setter-sep06-modified/common/config.cpp 2007-02-16 22:40:26.947401600 +0100\r
-@@ -78,6 +78,10 @@\r
- \r
- namespace aspell {\r
- \r
-+#ifdef WIN32PORT\r
-+ String GetWindowsDir(String registry_name, String default_directory);\r
-+#endif\r
-+\r
- const char * const keyinfo_type_name[4] = {\r
- N_("string"), N_("integer"), N_("boolean"), N_("list")\r
- };\r
-@@ -642,20 +646,19 @@\r
- \r
- } else if (strcmp(i, "home-dir") == 0) { \r
- \r
-- //get the personal folder (e.g. "c:\My Documents")\r
-- char * dir = new char[MAX_PATH];\r
-- LPITEMIDLIST items = 0;\r
-- HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, &items);\r
-- if ((NOERROR == hand) && items) {\r
-- if (SHGetPathFromIDList(items, dir)) {\r
-- for (char *ptr = dir; *ptr; ++ptr)\r
-- if ('\\' == *ptr)\r
-- *ptr = '/';\r
-- final_str = dir;\r
-- }\r
-- CoTaskMemFree(items);\r
-- }\r
-- delete [] dir;\r
-+ final_str = GetWindowsDir("Base Path", "");\r
-+\r
-+ } else if (strcmp(i, "dict-dir") == 0) { \r
-+\r
-+ final_str = GetWindowsDir("Dictionary Path", "Dictionaries");\r
-+\r
-+ } else if (strcmp(i, "data-dir") == 0) { \r
-+\r
-+ final_str = GetWindowsDir("Data Path", "Data");\r
-+\r
-+ } else if (strcmp(i, "personal-dir") == 0) { \r
-+\r
-+ final_str = GetWindowsDir("Personal Path", "Personal");\r
- \r
- }\r
- #endif\r
-@@ -1394,20 +1397,6 @@\r
- return no_err;\r
- }\r
- \r
--#if defined(WIN32_USE_PERSONAL_DIR)\r
--# define HOME_DIR "!home-dir"\r
--# define PERSONAL "<lang>.pws"\r
--# define REPL "<lang>.prepl"\r
--#elif defined(ENABLE_WIN32_RELOCATABLE)\r
--# define HOME_DIR "<prefix>"\r
--# define PERSONAL "<lang>.pws"\r
--# define REPL "<lang>.prepl"\r
--#else\r
--# define HOME_DIR "<$HOME|./>"\r
--# define PERSONAL ".aspell.<lang>.pws"\r
--# define REPL ".aspell.<lang>.prepl"\r
--#endif\r
--\r
- static const KeyInfo config_keys[] = {\r
- // the description should be under 50 chars\r
- {"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0}\r
-@@ -1484,12 +1473,12 @@\r
- , {"per-conf-path", KeyInfoString, "<home-dir/per-conf>", 0}\r
- , {"personal", KeyInfoString, PERSONAL,\r
- N_("personal dictionary file name")}\r
-- , {"personal-path", KeyInfoString, "<home-dir/personal>", 0}\r
-+ , {"personal-path", KeyInfoString, "<personal-dir/personal>", 0}\r
- , {"prefix", KeyInfoString, PREFIX,\r
- N_("prefix directory")}\r
- , {"repl", KeyInfoString, REPL,\r
- N_("replacements list file name") }\r
-- , {"repl-path", KeyInfoString, "<home-dir/repl>", 0}\r
-+ , {"repl-path", KeyInfoString, "<personal-dir/repl>", 0}\r
- , {"run-together", KeyInfoBool, "false",\r
- N_("consider run-together words legal"), KEYINFO_MAY_CHANGE}\r
- , {"run-together-limit", KeyInfoInt, "2",\r
-@@ -1524,12 +1513,6 @@\r
- N_("search path for word list information files"), KEYINFO_HIDDEN}\r
- , {"warn", KeyInfoBool, "true",\r
- N_("enable warnings")}\r
--#ifdef WIN32PORT\r
-- , {"dict-subdir", KeyInfoString, "dicts",\r
-- N_("sub directory for dictionaries")}\r
-- , {"data-subdir", KeyInfoString, "data",\r
-- N_("sub directory for other data")}\r
--#endif\r
- \r
- //\r
- // These options are generally used when creating dictionaries\r
-@@ -1574,7 +1557,10 @@\r
- N_("suggest possible replacements"), KEYINFO_MAY_CHANGE}\r
- , {"time" , KeyInfoBool, "false",\r
- N_("time load time and suggest time in pipe mode"), KEYINFO_MAY_CHANGE}\r
--\r
-+ #ifdef WIN32PORT\r
-+ , {"personal-dir", KeyInfoString, PERSONAL_DIR,\r
-+ N_("directory for personal dictionaries")}\r
-+ #endif\r
- };\r
- \r
- const KeyInfo * config_impl_keys_begin = config_keys;\r
-@@ -1588,4 +1574,87 @@\r
- config_impl_keys_end);\r
- }\r
- \r
-+#ifdef WIN32PORT\r
-+\r
-+ String ReadRegString(HKEY hive, String key, String name)\r
-+ {\r
-+ \r
-+ // Reads a string from the Windows registry (used to get paths) \r
-+ \r
-+ HKEY hKey;\r
-+ unsigned long lType;\r
-+ DWORD dwSize;\r
-+ unsigned char* szValue = NULL;\r
-+ \r
-+ if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)\r
-+ {\r
-+ if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)\r
-+ {\r
-+ szValue = new unsigned char[dwSize + 1];\r
-+ ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize);\r
-+ String RegistryReturn((char*)szValue);\r
-+ delete[] szValue;\r
-+ return RegistryReturn;\r
-+ } else {\r
-+ return "";\r
-+ }\r
-+ } else {\r
-+ return "";\r
-+ }\r
-+ \r
-+ }\r
-+ \r
-+ HKEY GetRegHive()\r
-+ {\r
-+ \r
-+ // Check whether Aspell is installed for the current user or for all users\r
-+ \r
-+ String value;\r
-+ \r
-+ if (ReadRegString(HKEY_CURRENT_USER, "Software\\Aspell", "Base Path").empty())\r
-+ {\r
-+ return HKEY_LOCAL_MACHINE;\r
-+ } else {\r
-+ return HKEY_CURRENT_USER;\r
-+ }\r
-+ \r
-+ }\r
-+\r
-+ String GetWindowsDir(String registry_name, String default_dir)\r
-+ {\r
-+\r
-+ String final_dir;\r
-+\r
-+ // Get directory from registry\r
-+ HKEY hive;\r
-+ hive = GetRegHive();\r
-+ final_dir = ReadRegString(hive, "Software\\Aspell", registry_name);\r
-+\r
-+ // Default location in "Documents and Settings"\r
-+ if (final_dir.empty()) {\r
-+\r
-+ char * dir = new char[MAX_PATH];\r
-+ LPITEMIDLIST items = 0;\r
-+ HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_APPDATA, &items);\r
-+\r
-+ if ((NOERROR == hand) && items) {\r
-+ if (SHGetPathFromIDList(items, dir)) {\r
-+ for (char *ptr = dir; *ptr; ++ptr)\r
-+ if ('\\' == *ptr)\r
-+ *ptr = '/';\r
-+ final_dir = dir;\r
-+ final_dir.append("/Aspell/");\r
-+ final_dir.append(default_dir.c_str());\r
-+ }\r
-+ CoTaskMemFree(items);\r
-+ }\r
-+\r
-+ }\r
-+\r
-+ return final_dir;\r
-+\r
-+ }\r
-+\r
-+#endif\r
-+ \r
- }\r
-diff -riwBu -Xex aspell-setter-sep06/common/vector.hpp aspell-setter-sep06-modified/common/vector.hpp\r
---- aspell-setter-sep06/common/vector.hpp 2005-10-13 09:42:54.000000000 +0200\r
-+++ aspell-setter-sep06-modified/common/vector.hpp 2006-09-17 19:50:45.730606400 +0200\r
-@@ -50,10 +50,10 @@\r
- T * data_end() {return &*this->end();}\r
- \r
- T * pbegin() {return &*this->begin();}\r
-- T * pend() {return &*this->end();}\r
-+ T * pend() {return &this->back()+1;}\r
- \r
- const T * pbegin() const {return &*this->begin();}\r
-- const T * pend() const {return &*this->end();}\r
-+ const T * pend() const {return &this->back()+1;}\r
- \r
- template <typename U>\r
- U * datap() { \r
-diff -riwBu -Xex aspell-setter-sep06/win32/dirs.h aspell-setter-sep06-modified/win32/dirs.h\r
---- aspell-setter-sep06/win32/dirs.h 2005-10-13 13:29:34.000000000 +0200\r
-+++ aspell-setter-sep06-modified/win32/dirs.h 2007-02-16 22:52:43.486492800 +0100\r
-@@ -1,16 +1,26 @@\r
- #ifndef dirs_h\r
- #define dirs_h\r
- \r
--#ifdef WIN32_USE_EXECUTABLE_DIR\r
--# define DATA_DIR "<prefix/data-subdir>"\r
--# define CONF_DIR "<prefix>"\r
--# define DICT_DIR "<prefix/dict-subdir>"\r
-+# define DATA_DIR "!data-dir"\r
-+# define DICT_DIR "!dict-dir"\r
-+# define PERSONAL_DIR "!personal-dir"\r
-+# define CONF_DIR "<home-dir>"\r
-+\r
-+#if defined(WIN32_USE_EXECUTABLE_DIR)\r
-+# define HOME_DIR "<prefix>"\r
-+# define PERSONAL "<lang>.pws"\r
-+# define REPL "<lang>.prepl"\r
- # define PREFIX "!prefix"\r
-+#elif defined(WIN32_USE_PERSONAL_DIR)\r
-+# define HOME_DIR "!home-dir"\r
-+# define PERSONAL "<lang>.pws"\r
-+# define REPL "<lang>.prepl"\r
-+# define PREFIX "<home-dir>"\r
- #else\r
--# define DATA_DIR "aspell-win32/data"\r
--# define CONF_DIR "aspell-win32"\r
--# define DICT_DIR "dicts"\r
--# define PREFIX "aspell-win32"\r
-+# define HOME_DIR "<$HOME|./>"\r
-+# define PERSONAL ".aspell.<lang>.pws"\r
-+# define REPL ".aspell.<lang>.prepl"\r
-+# define PREFIX "<home-dir>"\r
- #endif\r
- \r
- #endif\r
-diff -riwBu -Xex aspell-setter-sep06/win32/settings.h aspell-setter-sep06-modified/win32/settings.h\r
---- aspell-setter-sep06/win32/settings.h 2006-09-06 10:51:16.000000000 +0200\r
-+++ aspell-setter-sep06-modified/win32/settings.h 2006-09-17 18:55:23.112916800 +0200\r
-@@ -9,9 +9,6 @@\r
- /* Defined if curses like POSIX Functions should be used */\r
- #undef CURSES_ONLY\r
- \r
--/* Defined if win32 relocation should be used */\r
--#define ENABLE_WIN32_RELOCATABLE 1\r
--\r
- /* Define to 1 if you have the <dlfcn.h> header file. */\r
- #undef HAVE_DLFCN_H\r
- \r
+diff -riwBu -Xex aspell-setter-sep06/common/config.cpp aspell-setter-sep06-modified/common/config.cpp
+--- aspell-setter-sep06/common/config.cpp 2005-12-12 17:41:06.000000000 +0100
++++ aspell-setter-sep06-modified/common/config.cpp 2007-02-16 22:40:26.947401600 +0100
+@@ -78,6 +78,10 @@
+
+ namespace aspell {
+
++#ifdef WIN32PORT
++ String GetWindowsDir(String registry_name, String default_directory);
++#endif
++
+ const char * const keyinfo_type_name[4] = {
+ N_("string"), N_("integer"), N_("boolean"), N_("list")
+ };
+@@ -642,20 +646,19 @@
+
+ } else if (strcmp(i, "home-dir") == 0) {
+
+- //get the personal folder (e.g. "c:\My Documents")
+- char * dir = new char[MAX_PATH];
+- LPITEMIDLIST items = 0;
+- HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, &items);
+- if ((NOERROR == hand) && items) {
+- if (SHGetPathFromIDList(items, dir)) {
+- for (char *ptr = dir; *ptr; ++ptr)
+- if ('\\' == *ptr)
+- *ptr = '/';
+- final_str = dir;
+- }
+- CoTaskMemFree(items);
+- }
+- delete [] dir;
++ final_str = GetWindowsDir("Base Path", "");
++
++ } else if (strcmp(i, "dict-dir") == 0) {
++
++ final_str = GetWindowsDir("Dictionary Path", "Dictionaries");
++
++ } else if (strcmp(i, "data-dir") == 0) {
++
++ final_str = GetWindowsDir("Data Path", "Data");
++
++ } else if (strcmp(i, "personal-dir") == 0) {
++
++ final_str = GetWindowsDir("Personal Path", "Personal");
+
+ }
+ #endif
+@@ -1394,20 +1397,6 @@
+ return no_err;
+ }
+
+-#if defined(WIN32_USE_PERSONAL_DIR)
+-# define HOME_DIR "!home-dir"
+-# define PERSONAL "<lang>.pws"
+-# define REPL "<lang>.prepl"
+-#elif defined(ENABLE_WIN32_RELOCATABLE)
+-# define HOME_DIR "<prefix>"
+-# define PERSONAL "<lang>.pws"
+-# define REPL "<lang>.prepl"
+-#else
+-# define HOME_DIR "<$HOME|./>"
+-# define PERSONAL ".aspell.<lang>.pws"
+-# define REPL ".aspell.<lang>.prepl"
+-#endif
+-
+ static const KeyInfo config_keys[] = {
+ // the description should be under 50 chars
+ {"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0}
+@@ -1484,12 +1473,12 @@
+ , {"per-conf-path", KeyInfoString, "<home-dir/per-conf>", 0}
+ , {"personal", KeyInfoString, PERSONAL,
+ N_("personal dictionary file name")}
+- , {"personal-path", KeyInfoString, "<home-dir/personal>", 0}
++ , {"personal-path", KeyInfoString, "<personal-dir/personal>", 0}
+ , {"prefix", KeyInfoString, PREFIX,
+ N_("prefix directory")}
+ , {"repl", KeyInfoString, REPL,
+ N_("replacements list file name") }
+- , {"repl-path", KeyInfoString, "<home-dir/repl>", 0}
++ , {"repl-path", KeyInfoString, "<personal-dir/repl>", 0}
+ , {"run-together", KeyInfoBool, "false",
+ N_("consider run-together words legal"), KEYINFO_MAY_CHANGE}
+ , {"run-together-limit", KeyInfoInt, "2",
+@@ -1524,12 +1513,6 @@
+ N_("search path for word list information files"), KEYINFO_HIDDEN}
+ , {"warn", KeyInfoBool, "true",
+ N_("enable warnings")}
+-#ifdef WIN32PORT
+- , {"dict-subdir", KeyInfoString, "dicts",
+- N_("sub directory for dictionaries")}
+- , {"data-subdir", KeyInfoString, "data",
+- N_("sub directory for other data")}
+-#endif
+
+ //
+ // These options are generally used when creating dictionaries
+@@ -1574,7 +1557,10 @@
+ N_("suggest possible replacements"), KEYINFO_MAY_CHANGE}
+ , {"time" , KeyInfoBool, "false",
+ N_("time load time and suggest time in pipe mode"), KEYINFO_MAY_CHANGE}
+-
++ #ifdef WIN32PORT
++ , {"personal-dir", KeyInfoString, PERSONAL_DIR,
++ N_("directory for personal dictionaries")}
++ #endif
+ };
+
+ const KeyInfo * config_impl_keys_begin = config_keys;
+@@ -1588,4 +1574,87 @@
+ config_impl_keys_end);
+ }
+
++#ifdef WIN32PORT
++
++ 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_CURRENT_USER, "Software\\Aspell", "Base Path").empty())
++ {
++ return HKEY_LOCAL_MACHINE;
++ } else {
++ return HKEY_CURRENT_USER;
++ }
++
++ }
++
++ String GetWindowsDir(String registry_name, String default_dir)
++ {
++
++ String final_dir;
++
++ // Get directory from registry
++ HKEY hive;
++ hive = GetRegHive();
++ final_dir = ReadRegString(hive, "Software\\Aspell", registry_name);
++
++ // Default location in "Documents and Settings"
++ if (final_dir.empty()) {
++
++ char * dir = new char[MAX_PATH];
++ LPITEMIDLIST items = 0;
++ HRESULT hand = SHGetSpecialFolderLocation(0, CSIDL_APPDATA, &items);
++
++ if ((NOERROR == hand) && items) {
++ if (SHGetPathFromIDList(items, dir)) {
++ for (char *ptr = dir; *ptr; ++ptr)
++ if ('\\' == *ptr)
++ *ptr = '/';
++ final_dir = dir;
++ final_dir.append("/Aspell/");
++ final_dir.append(default_dir.c_str());
++ }
++ CoTaskMemFree(items);
++ }
++
++ }
++
++ return final_dir;
++
++ }
++
++#endif
++
+ }
+diff -riwBu -Xex aspell-setter-sep06/common/vector.hpp aspell-setter-sep06-modified/common/vector.hpp
+--- aspell-setter-sep06/common/vector.hpp 2005-10-13 09:42:54.000000000 +0200
++++ aspell-setter-sep06-modified/common/vector.hpp 2006-09-17 19:50:45.730606400 +0200
+@@ -50,10 +50,10 @@
+ T * data_end() {return &*this->end();}
+
+ 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() {
+diff -riwBu -Xex aspell-setter-sep06/win32/dirs.h aspell-setter-sep06-modified/win32/dirs.h
+--- aspell-setter-sep06/win32/dirs.h 2005-10-13 13:29:34.000000000 +0200
++++ aspell-setter-sep06-modified/win32/dirs.h 2007-02-16 22:52:43.486492800 +0100
+@@ -1,16 +1,26 @@
+ #ifndef dirs_h
+ #define dirs_h
+
+-#ifdef WIN32_USE_EXECUTABLE_DIR
+-# define DATA_DIR "<prefix/data-subdir>"
+-# define CONF_DIR "<prefix>"
+-# define DICT_DIR "<prefix/dict-subdir>"
++# define DATA_DIR "!data-dir"
++# define DICT_DIR "!dict-dir"
++# define PERSONAL_DIR "!personal-dir"
++# define CONF_DIR "<home-dir>"
++
++#if defined(WIN32_USE_EXECUTABLE_DIR)
++# define HOME_DIR "<prefix>"
++# define PERSONAL "<lang>.pws"
++# define REPL "<lang>.prepl"
+ # define PREFIX "!prefix"
++#elif defined(WIN32_USE_PERSONAL_DIR)
++# define HOME_DIR "!home-dir"
++# define PERSONAL "<lang>.pws"
++# define REPL "<lang>.prepl"
++# define PREFIX "<home-dir>"
+ #else
+-# define DATA_DIR "aspell-win32/data"
+-# define CONF_DIR "aspell-win32"
+-# define DICT_DIR "dicts"
+-# define PREFIX "aspell-win32"
++# define HOME_DIR "<$HOME|./>"
++# define PERSONAL ".aspell.<lang>.pws"
++# define REPL ".aspell.<lang>.prepl"
++# define PREFIX "<home-dir>"
+ #endif
+
+ #endif
+diff -riwBu -Xex aspell-setter-sep06/win32/settings.h aspell-setter-sep06-modified/win32/settings.h
+--- aspell-setter-sep06/win32/settings.h 2006-09-06 10:51:16.000000000 +0200
++++ aspell-setter-sep06-modified/win32/settings.h 2006-09-17 18:55:23.112916800 +0200
+@@ -9,9 +9,6 @@
+ /* Defined if curses like POSIX Functions should be used */
+ #undef CURSES_ONLY
+
+-/* Defined if win32 relocation should be used */
+-#define ENABLE_WIN32_RELOCATABLE 1
+-
+ /* Define to 1 if you have the <dlfcn.h> header file. */
+ #undef HAVE_DLFCN_H
+