]> git.lyx.org Git - lyx.git/blob - development/Win32/aspell/win32-aspell-HEAD.patch
Scons: libintl also needs /MD option
[lyx.git] / development / Win32 / aspell / win32-aspell-HEAD.patch
1 Index: common/config.cpp
2 ===================================================================
3 RCS file: /sources/aspell/aspell/common/config.cpp,v
4 retrieving revision 1.78
5 diff -u -b -B -p -r1.78 config.cpp
6 --- common/config.cpp   21 Oct 2005 12:16:03 -0000      1.78
7 +++ common/config.cpp   30 Aug 2006 22:05:30 -0000
8 @@ -1581,3 +1581,61 @@ namespace aspell {
9    }
10    
11  }
12 +
13 +
14 +#ifdef WIN32PORT
15 +
16 +#include "string.hpp"
17 +
18 +using namespace aspell;
19 +namespace acommon {
20 +
21 +  String ReadRegString(HKEY hive, String key, String name)
22 +  {
23 +  
24 +    // Reads a string from the Windows registry (used to get paths)  
25 +       
26 +    HKEY hKey;
27 +    unsigned long lType;
28 +    DWORD dwSize;
29 +    unsigned char* szValue = NULL;
30 +       
31 +    if (::RegOpenKeyEx(hive, key.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
32 +    {
33 +      if(::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
34 +      {
35 +        szValue = new unsigned char[dwSize + 1];
36 +        ::RegQueryValueEx(hKey, name.c_str(), NULL, &lType, szValue, &dwSize);
37 +        String RegistryReturn((char*)szValue);
38 +        delete[] szValue;
39 +        return RegistryReturn;
40 +         } else {
41 +           return "";
42 +      }
43 +    } else {
44 +         return "";
45 +       }
46 +  
47 +  }
48 +  
49 +  HKEY GetRegHive()
50 +  {
51 +    
52 +    // Check whether Aspell is installed for the current user or for all users
53 +       
54 +    String value;
55 +       
56 +    if (ReadRegString(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Dictionary Path") == "")
57 +    {
58 +      return HKEY_CURRENT_USER;
59 +    } else {
60 +      return HKEY_LOCAL_MACHINE;
61 +    }
62 +       
63 +  }
64 +
65 +}  
66 +
67 +#endif //WIN32PORT
68 +
69 +
70 Index: common/config.hpp
71 ===================================================================
72 RCS file: /sources/aspell/aspell/common/config.hpp,v
73 retrieving revision 1.27
74 diff -u -b -B -p -r1.27 config.hpp
75 --- common/config.hpp   3 May 2005 05:08:19 -0000       1.27
76 +++ common/config.hpp   30 Aug 2006 22:05:30 -0000
77 @@ -277,5 +277,21 @@ namespace aspell {
78  
79  }
80  
81 +#ifdef WIN32PORT
82 +
83 +#include "minwin.h"
84 +
85 +namespace aspell {
86 +       class String;
87 +}
88 +
89 +namespace acommon {
90 +
91 +  extern HKEY GetRegHive();
92 +  extern aspell::String ReadRegString(HKEY type, aspell::String key, aspell::String name);
93 +
94 +}
95 +
96 +#endif
97  #endif
98  
99 Index: common/gettext_init.cpp
100 ===================================================================
101 RCS file: /sources/aspell/aspell/common/gettext_init.cpp,v
102 retrieving revision 1.5
103 diff -u -b -B -p -r1.5 gettext_init.cpp
104 --- common/gettext_init.cpp     3 May 2005 05:08:19 -0000       1.5
105 +++ common/gettext_init.cpp     30 Aug 2006 22:05:30 -0000
106 @@ -16,7 +15,21 @@ extern "C" void aspell_gettext_init()
107      if (did_init) return;
108      did_init = true;
109    }
110 +#ifdef WIN32PORT
111 +  // Registry key for Locale Path
112 +  
113 +  aspell::String value;
114 +  HKEY hive;
115 +  
116 +  hive = acommon::GetRegHive();
117 +  value = acommon::ReadRegString(hive, "Software\\Aspell", "Locale Path");
118 +  if (value == "") value = LOCALEDIR;
119
120 +  bindtextdomain("aspell", value.c_str());
121 +#else
122    bindtextdomain("aspell", LOCALEDIR);
123 +#endif
124 +
125  }
126  
127  #else
128 Index: common/info.cpp
129 ===================================================================
130 RCS file: /sources/aspell/aspell/common/info.cpp,v
131 retrieving revision 1.39
132 diff -u -b -B -p -r1.39 info.cpp
133 --- common/info.cpp     3 May 2005 05:08:19 -0000       1.39
134 +++ common/info.cpp     30 Aug 2006 22:05:30 -0000
135 @@ -17,9 +17,6 @@
136   /* BSDi defines u_intXX_t types in machine/types.h */
137  #include <machine/types.h>
138  #endif
139 -#if defined(WIN32) || defined(_WIN32)
140 -#include "minwin.h" //minimum windows declarations.
141 -#endif
142  
143  #include "iostream.hpp"
144  
145 @@ -574,7 +571,17 @@ namespace aspell {
146                       StringList & lst)
147    {
148      lst.clear();
149 -    lst.add(config->retrieve("data-dir"));
150 +       String dictpath;
151 +
152 +#ifdef WIN32PORT
153 +       HKEY hive = acommon::GetRegHive();
154 +    // Registry key for dictionary path
155 +       dictpath =acommon::ReadRegString(hive, "Software\\Aspell", "Dictionary Path");;
156 +    if (dictpath == "") dictpath = config->retrieve("data-dir");
157 +#else
158 +    dictpath = config->retrieve("data-dir");
159 +#endif
160 +       lst.add(dictpath);
161      lst.add(config->retrieve("dict-dir"));
162    }
163  
164 Index: common/vector.hpp
165 ===================================================================
166 RCS file: /sources/aspell/aspell/common/vector.hpp,v
167 retrieving revision 1.15
168 diff -u -b -B -p -r1.15 vector.hpp
169 --- common/vector.hpp   3 May 2005 05:08:19 -0000       1.15
170 +++ common/vector.hpp   30 Aug 2006 22:05:30 -0000
171 @@ -47,13 +47,13 @@ namespace aspell
172      }
173      T * data() {return &*this->begin();}
174      T * data(int pos) {return &*this->begin() + pos;}
175 -    T * data_end() {return &*this->end();}
176 +    T * data_end() {return &this->back()+1;}
177  
178      T * pbegin() {return &*this->begin();}
179 -    T * pend()   {return &*this->end();}
180 +    T * pend()   {return &this->back()+1;}
181  
182      const T * pbegin() const {return &*this->begin();}
183 -    const T * pend()   const {return &*this->end();}
184 +    const T * pend()   const {return &this->back()+1;}
185  
186      template <typename U>
187      U * datap() { 
188 Index: win32/settings.h
189 ===================================================================
190 RCS file: /sources/aspell/aspell/win32/settings.h,v
191 retrieving revision 1.5
192 diff -u -b -B -p -r1.5 settings.h
193 --- win32/settings.h    15 Feb 2005 08:52:58 -0000      1.5
194 +++ win32/settings.h    30 Aug 2006 22:05:30 -0000
195 @@ -106,7 +106,7 @@
196  // declaring a template param.  The other supporte compilers (Borlands
197  // BCB5.5 and GNU C++) require or allow it anywhere in the template
198  // decl. The macro TYPENAME is defines to whatever works.
199 -#ifdef _MSC_VER
200 +#if defined(_MSC_VER) && (_MSC_VER<1300)
201  #define TYPENAME
202  #else
203  #define TYPENAME typename
204
205