aspell 0.60.6 on Windows and using libaspell with SciTE

View: New views
11 Messages — Rating Filter:   Alert me  

aspell 0.60.6 on Windows and using libaspell with SciTE

by Laura nmi Michaels :: Rate this Message:

| View Threaded | Show Only this Message

A lot of people on the SciTE mailing list (and probably other text editors
groups too) have been clamoring for a spell-checker to work with their
favorite editor.  I thought if I could find a decent C/C++ library that
handled spelling, I could write some code to output the results in a format
similar to the error messages from the gnu C/C++ and mingw C/C++ compilers.  
When I found out aspell had such a library, I decided to download a copy of
the latest version 0.60.6 and test out my idea.  As I was trying to compile
the library with mingw and msys, I kept asking myself how did anyone get
this working on Windows.  After searching the Internet for 4 fixes to
various issues I came across, I finally got the library and aspell program
to build.  I went back to the aspell web site to locate some documentation
on the C/C++ library API and I noticed the Win32 page doesn't have the
latest version of aspell.  So, I guess people aren't getting this to compile
on Windows.  

I have some diffs to get aspell 0.60.6 compiling properly with mingw and
msys.  I also have a request for an additional program that I would really
like to see added to the examples directory.  I cannibalized the example-c.c
code to come up with something that would spell check a file and output
results to stdout in the error format used by gnu gcc.  I think this or
something like it would be a really useful example to add for anyone who's
been wanting to run aspell with a decent programming editor.  Hopefully
others could help contribute and make it a better and more robust program,
since the changes I made were quick ones just to get proof of concept.

The diffs for aspell on mingw with msys are included below.  I also have
some Windows executables.  I have library files in .a format, but
the ./configure, make, make install process doesn't appear to have created
any dlls.  I don't remember having any problems installing the English
dictionary files using the ./configure, make, make install process under
msys.  If you need executable files and/or library (.a files) packaged a
certain way, let me know and I can send them to someone if they want to
distribute them further.  The source code I wrote for better integrating
aspell with a programming editor is at:  
http://www.distasis.com/cpp/aspellstdout.c
It can be compiled with mingw using the command:
g++ -o aspellstdout.exe aspellstdout.c -I\mingw\msys\local\include -L
\mingw\msys\lib -L \mingw\msys\local\lib -ldl -laspell -lintl -
lgettextlib.dll -ldl.dll
I also compiled it on DeLi Linux using the command:
g++ -o aspellstdout aspellstdout.c -I/usr/local/include -L /usr/lib -
L /usr/local/lib -ldl -laspell -lintl
On Windows, I'm using the basic libraries such as libiconv and libintl from
the GnuWin32 project, http://sourceforge.net/project/gnuwin32  I'm using the
libdl library from:
http://code.google.com/p/dlfcn-win32/downloads/list
Be sure to add the patch for extern C on the issues page.  That was one of
the fixes I needed to make to get things to compile.  I'm using the latest
copy of pdcurses from Sourceforge:  http://sourceforge.net/project/pdcurses 
Don't know if it's needed, but I have my .profile file (used by msys) set up
as mentioned here:  http://www.distasis.com/cpp/mingw.htm#whatismsys

The examples in the example directory didn't compile when I used the
makefile.  Was able to get example-c to compile from command line in a
standard command prompt with the following command:
g++ -o example-c.exe example-c.c  -I\mingw\msys\local\include -L
\mingw\msys\lib -L \mingw\msys\local\lib -ldl  -laspell -lintl -
lgettextlib.dll -ldl.dll
To run the example-c.exe afterwards, you need libdl.dll, libicon2.dll,
libintl3.dll in the same directory or in the path.

Here are the patches I needed for mingw and msys:

\mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\config.hpp
\mingw\msys\home\new\aspell-0.60.6\common\config.hpp
15a16,19
> #ifdef __MINGW32__
> #define libintl_printf printf
> #endif
>

\mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\file
_util.cpp \mingw\msys\home\new\aspell-0.60.6\common\file_util.cpp
15a16
> #include "asc_ctype.hpp"

\mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6
\modules\speller\default\language.cpp \mingw\msys\home\michaelsl\new\aspell-
0.60.6\modules\spell
er\default\language.cpp
23d22
< #ifndef __MINGW32__
26d24
< #endif


Best wishes.
Laura



_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by setterg :: Rate this Message:

| View Threaded | Show Only this Message

   
-------------- Original message ----------------------
From: "Laura nmi Michaels" <lauramic@...>
<snip>I finally got the library and aspell program
> to build.
<snip>

Hi Laura,

Did you see the thread on this mailing list with subject " [Aspell-user] Need Someone to Maintain Aspell Windows Port"?

 Elizabeth M Smith replied positively. You might want to join forces with her.

Gary


_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

I don't understand why our work on Aspell for Windows is still not yet
known but, FYI, the LyX project has long solved the Windows packaging
problem by forking Aspell. We use MSVC2008 in order to create the dlls
that can be found inside this archive:

ftp://ftp.lyx.org/pub/lyx/contrib/lyx-windows-deps-msvc2008.zip

You will find other goodies like latest gettext and iconv.

We also maintains all knowns dictionnary in the latest format here:

http://wiki.lyx.org/Windows/Aspell6
ftp://ftp.lyx.org/pub/lyx/contrib/aspell6-windows/
http://developer.berlios.de/project/showfiles.php?group_id=5117&release_id=12973

IMHO anyone willing to maintain the Aspell Windows port should talk to
us in order to avoid duplicated effort.

Abdel.


Laura nmi Michaels wrote:

> A lot of people on the SciTE mailing list (and probably other text editors
> groups too) have been clamoring for a spell-checker to work with their
> favorite editor.  I thought if I could find a decent C/C++ library that
> handled spelling, I could write some code to output the results in a format
> similar to the error messages from the gnu C/C++ and mingw C/C++ compilers.  
> When I found out aspell had such a library, I decided to download a copy of
> the latest version 0.60.6 and test out my idea.  As I was trying to compile
> the library with mingw and msys, I kept asking myself how did anyone get
> this working on Windows.  After searching the Internet for 4 fixes to
> various issues I came across, I finally got the library and aspell program
> to build.  I went back to the aspell web site to locate some documentation
> on the C/C++ library API and I noticed the Win32 page doesn't have the
> latest version of aspell.  So, I guess people aren't getting this to compile
> on Windows.  
>
> I have some diffs to get aspell 0.60.6 compiling properly with mingw and
> msys.  I also have a request for an additional program that I would really
> like to see added to the examples directory.  I cannibalized the example-c.c
> code to come up with something that would spell check a file and output
> results to stdout in the error format used by gnu gcc.  I think this or
> something like it would be a really useful example to add for anyone who's
> been wanting to run aspell with a decent programming editor.  Hopefully
> others could help contribute and make it a better and more robust program,
> since the changes I made were quick ones just to get proof of concept.
>
> The diffs for aspell on mingw with msys are included below.  I also have
> some Windows executables.  I have library files in .a format, but
> the ./configure, make, make install process doesn't appear to have created
> any dlls.  I don't remember having any problems installing the English
> dictionary files using the ./configure, make, make install process under
> msys.  If you need executable files and/or library (.a files) packaged a
> certain way, let me know and I can send them to someone if they want to
> distribute them further.  The source code I wrote for better integrating
> aspell with a programming editor is at:  
> http://www.distasis.com/cpp/aspellstdout.c
> It can be compiled with mingw using the command:
> g++ -o aspellstdout.exe aspellstdout.c -I\mingw\msys\local\include -L
> \mingw\msys\lib -L \mingw\msys\local\lib -ldl -laspell -lintl -
> lgettextlib.dll -ldl.dll
> I also compiled it on DeLi Linux using the command:
> g++ -o aspellstdout aspellstdout.c -I/usr/local/include -L /usr/lib -
> L /usr/local/lib -ldl -laspell -lintl
> On Windows, I'm using the basic libraries such as libiconv and libintl from
> the GnuWin32 project, http://sourceforge.net/project/gnuwin32  I'm using the
> libdl library from:
> http://code.google.com/p/dlfcn-win32/downloads/list
> Be sure to add the patch for extern C on the issues page.  That was one of
> the fixes I needed to make to get things to compile.  I'm using the latest
> copy of pdcurses from Sourceforge:  http://sourceforge.net/project/pdcurses 
> Don't know if it's needed, but I have my .profile file (used by msys) set up
> as mentioned here:  http://www.distasis.com/cpp/mingw.htm#whatismsys
>
> The examples in the example directory didn't compile when I used the
> makefile.  Was able to get example-c to compile from command line in a
> standard command prompt with the following command:
> g++ -o example-c.exe example-c.c  -I\mingw\msys\local\include -L
> \mingw\msys\lib -L \mingw\msys\local\lib -ldl  -laspell -lintl -
> lgettextlib.dll -ldl.dll
> To run the example-c.exe afterwards, you need libdl.dll, libicon2.dll,
> libintl3.dll in the same directory or in the path.
>
> Here are the patches I needed for mingw and msys:
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\config.hpp
> \mingw\msys\home\new\aspell-0.60.6\common\config.hpp
> 15a16,19
>> #ifdef __MINGW32__
>> #define libintl_printf printf
>> #endif
>>
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\file
> _util.cpp \mingw\msys\home\new\aspell-0.60.6\common\file_util.cpp
> 15a16
>> #include "asc_ctype.hpp"
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6
> \modules\speller\default\language.cpp \mingw\msys\home\michaelsl\new\aspell-
> 0.60.6\modules\spell
> er\default\language.cpp
> 23d22
> < #ifndef __MINGW32__
> 26d24
> < #endif
>
>
> Best wishes.
> Laura




_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Parent Message unknown Re: Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

setterg@... wrote:
>
>  -------------- Original message ---------------------- <snip>
> > the LyX project has long solved the Windows packaging problem by
> > forking Aspell.
>  <snip>
>
>  -------------- Reply ---------------------------------- It may not be
>  my place to ask, but why didn't the LyX people submit patches so that
>  we could have one aspell that works for Unix and Windows? Gary Setter

We of course did that (More exactly Peter Kuemmel did), a long time ago:

http://sourceforge.net/tracker/index.php?func=detail&aid=1507425&group_id=245&atid=300245

Abdel.







_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

Abdelrazak Younes wrote:

> setterg@... wrote:
>>
>>  -------------- Original message ---------------------- <snip>
>> > the LyX project has long solved the Windows packaging problem by
>> > forking Aspell.
>>  <snip>
>>
>>  -------------- Reply ---------------------------------- It may not be
>>  my place to ask, but why didn't the LyX people submit patches so that
>>  we could have one aspell that works for Unix and Windows? Gary Setter
>
> We of course did that (More exactly Peter Kuemmel did), a long time ago:
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=1507425&group_id=245&atid=300245 
You can by the way find the patches for MSVC and Mingw in our svn repo:

svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/mingw/aspell-0.60.4.patch
svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/msvc/aspell-setter-sep06.patch

Joost, are they the latest ones? And by the way, do you still use the
original CMake files by Peter? Or something else?

I attach these two patches as they are not too big.

OK, I tried to trigger (again) a discussion about this issue in the hope
that the Aspell project would integrate our modification.

Abdel.


diff -riwbBuN -Xex aspell-0.60.4/Makefile.am aspell-0.60.4-modified/Makefile.am
--- aspell-0.60.4/Makefile.am Wed Oct 19 11:12:02 2005
+++ aspell-0.60.4-modified/Makefile.am Thu Jun 15 14:45:47 2006
@@ -32,6 +32,7 @@
 endif
 
 libaspell_la_SOURCES =\
+  common/aspell_win.cpp\
   common/cache.cpp\
   common/string.cpp\
   common/getdata.cpp\
diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.cpp aspell-0.60.4-modified/common/aspell_win.cpp
--- aspell-0.60.4/common/aspell_win.cpp Thu Jan  1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.cpp Fri Jun 16 01:19:04 2006
@@ -0,0 +1,54 @@
+#ifdef _WIN32
+
+#include <windows.h>
+#include "string.hpp"
+
+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
diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.hpp aspell-0.60.4-modified/common/aspell_win.hpp
--- aspell-0.60.4/common/aspell_win.hpp Thu Jan  1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.hpp Thu Jun 15 15:33:58 2006
@@ -0,0 +1,18 @@
+#ifdef _WIN32
+
+#ifndef ASPELL_WIN__HPP
+#define ASPELL_WIN__HPP
+
+#include "string.hpp"
+#include <windows.h>
+
+namespace acommon {
+
+  extern HKEY GetRegHive();
+  extern String ReadRegString(HKEY type, String key, String name);
+
+}
+
+#endif
+
+#endif
diff -riwbBuN -Xex aspell-0.60.4/common/config.cpp aspell-0.60.4-modified/common/config.cpp
--- aspell-0.60.4/common/config.cpp Wed Jun 22 07:32:30 2005
+++ aspell-0.60.4-modified/common/config.cpp Wed Jun 14 20:44:29 2006
@@ -39,6 +39,7 @@
 #include "string_list.hpp"
 
 #include "gettext.h"
+#undef printf
 
 #include "iostream.hpp"
 
diff -riwbBuN -Xex aspell-0.60.4/common/convert.cpp aspell-0.60.4-modified/common/convert.cpp
--- aspell-0.60.4/common/convert.cpp Thu Sep 29 05:20:04 2005
+++ aspell-0.60.4-modified/common/convert.cpp Sat May 27 12:08:02 2006
@@ -23,6 +23,7 @@
 #include "iostream.hpp"
 
 #include "gettext.h"
+#undef printf
 
 namespace acommon {
 
diff -riwbBuN -Xex aspell-0.60.4/common/file_util.cpp aspell-0.60.4-modified/common/file_util.cpp
--- aspell-0.60.4/common/file_util.cpp Mon Nov 15 13:29:54 2004
+++ aspell-0.60.4-modified/common/file_util.cpp Sat May 27 12:08:02 2006
@@ -26,6 +26,7 @@
 
 #ifdef WIN32
 
+#  include "asc_ctype.hpp"
 #  include <io.h>
 #  define ACCESS _access
 #  include <windows.h>
diff -riwbBuN -Xex aspell-0.60.4/common/gettext_init.cpp aspell-0.60.4-modified/common/gettext_init.cpp
--- aspell-0.60.4/common/gettext_init.cpp Tue Nov  9 09:20:24 2004
+++ aspell-0.60.4-modified/common/gettext_init.cpp Thu Jun 15 15:31:02 2006
@@ -1,5 +1,13 @@
+#include "settings.h"
+#include "string.hpp"
+
+#ifdef _WIN32
+  #include <windows.h>
+  #include "aspell_win.hpp"
+#endif
 
 #include "gettext.h"
+#undef printf
 
 #if ENABLE_NLS
 
@@ -11,12 +19,24 @@
 
 extern "C" void aspell_gettext_init()
 {
-  {
     acommon::Lock l(&lock);
     if (did_init) return;
     did_init = true;
-  }
+  
+#ifdef _WIN32
+  // Registry key for Locale Path
+  
+  acommon::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
diff -riwbBuN -Xex aspell-0.60.4/common/info.cpp aspell-0.60.4-modified/common/info.cpp
--- aspell-0.60.4/common/info.cpp Wed Nov 10 07:18:46 2004
+++ aspell-0.60.4-modified/common/info.cpp Fri Jun 16 01:20:52 2006
@@ -15,9 +15,11 @@
  /* BSDi defines u_intXX_t types in machine/types.h */
 #include <machine/types.h>
 #endif
+
 #ifdef WIN32
 #  include <windows.h>
 #  include <winbase.h>
+#include "aspell_win.hpp"
 #endif
 
 #include "iostream.hpp"
@@ -38,6 +40,7 @@
 #include "string_map.hpp"
 
 #include "gettext.h"
+#undef printf
 
 namespace acommon {
 
@@ -492,8 +495,22 @@
   void get_data_dirs (Config * config,
       StringList & lst)
   {
+    String dictpath;
+ HKEY hive;
+
     lst.clear();
-    lst.add(config->retrieve("data-dir"));
+
+    hive = GetRegHive();
+
+#ifdef _WIN32
+    // Registry key for dictionary path
+    dictpath = 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"));
   }
 
diff -riwbBuN -Xex aspell-0.60.4/common/posib_err.cpp aspell-0.60.4-modified/common/posib_err.cpp
--- aspell-0.60.4/common/posib_err.cpp Sun Nov 21 03:52:22 2004
+++ aspell-0.60.4-modified/common/posib_err.cpp Sat May 27 12:08:02 2006
@@ -13,6 +13,7 @@
 #include "posib_err.hpp"
 
 #include "gettext.h"
+#undef printf
 
 
 namespace acommon {
diff -riwbBuN -Xex aspell-0.60.4/modules/speller/default/language.cpp aspell-0.60.4-modified/modules/speller/default/language.cpp
--- aspell-0.60.4/modules/speller/default/language.cpp Sun Feb 20 22:47:08 2005
+++ aspell-0.60.4-modified/modules/speller/default/language.cpp Wed Jun 14 19:55:47 2006
@@ -21,10 +21,11 @@
 #include "file_util.hpp"
 
 #ifdef ENABLE_NLS
-#  include <langinfo.h>
+//#include <langinfo.h>
 #endif
 
 #include "gettext.h"
+#undef printf
 
 namespace aspeller {
 
diff -riwbBuN -Xex aspell-0.60.4/prog/aspell.cpp aspell-0.60.4-modified/prog/aspell.cpp
--- aspell-0.60.4/prog/aspell.cpp Sun Jun 19 14:00:46 2005
+++ aspell-0.60.4-modified/prog/aspell.cpp Wed Jun 14 20:46:09 2006
@@ -60,6 +60,7 @@
 #include "hash_fun.hpp"
 
 #include "gettext.h"
+#undef printf
 
 using namespace acommon;
 

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
 

_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

Abdelrazak Younes wrote:

> setterg@... wrote:
>>
>>  -------------- Original message ---------------------- <snip>
>> > the LyX project has long solved the Windows packaging problem by
>> > forking Aspell.
>>  <snip>
>>
>>  -------------- Reply ---------------------------------- It may not be
>>  my place to ask, but why didn't the LyX people submit patches so that
>>  we could have one aspell that works for Unix and Windows? Gary Setter
>
> We of course did that (More exactly Peter Kuemmel did), a long time ago:
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=1507425&group_id=245&atid=300245 
You can by the way find the patches for MSVC and Mingw in our svn repo:

svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/mingw/aspell-0.60.4.patch
svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/msvc/aspell-setter-sep06.patch

Joost, are they the latest ones? And by the way, do you still use the
original CMake files by Peter? Or something else?

I attach these two patches as they are not too big.

OK, I tried to trigger (again) a discussion about this issue in the hope
that the Aspell project would integrate our modification.

Abdel.


diff -riwbBuN -Xex aspell-0.60.4/Makefile.am aspell-0.60.4-modified/Makefile.am
--- aspell-0.60.4/Makefile.am Wed Oct 19 11:12:02 2005
+++ aspell-0.60.4-modified/Makefile.am Thu Jun 15 14:45:47 2006
@@ -32,6 +32,7 @@
 endif
 
 libaspell_la_SOURCES =\
+  common/aspell_win.cpp\
   common/cache.cpp\
   common/string.cpp\
   common/getdata.cpp\
diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.cpp aspell-0.60.4-modified/common/aspell_win.cpp
--- aspell-0.60.4/common/aspell_win.cpp Thu Jan  1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.cpp Fri Jun 16 01:19:04 2006
@@ -0,0 +1,54 @@
+#ifdef _WIN32
+
+#include <windows.h>
+#include "string.hpp"
+
+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
diff -riwbBuN -Xex aspell-0.60.4/common/aspell_win.hpp aspell-0.60.4-modified/common/aspell_win.hpp
--- aspell-0.60.4/common/aspell_win.hpp Thu Jan  1 01:00:00 1970
+++ aspell-0.60.4-modified/common/aspell_win.hpp Thu Jun 15 15:33:58 2006
@@ -0,0 +1,18 @@
+#ifdef _WIN32
+
+#ifndef ASPELL_WIN__HPP
+#define ASPELL_WIN__HPP
+
+#include "string.hpp"
+#include <windows.h>
+
+namespace acommon {
+
+  extern HKEY GetRegHive();
+  extern String ReadRegString(HKEY type, String key, String name);
+
+}
+
+#endif
+
+#endif
diff -riwbBuN -Xex aspell-0.60.4/common/config.cpp aspell-0.60.4-modified/common/config.cpp
--- aspell-0.60.4/common/config.cpp Wed Jun 22 07:32:30 2005
+++ aspell-0.60.4-modified/common/config.cpp Wed Jun 14 20:44:29 2006
@@ -39,6 +39,7 @@
 #include "string_list.hpp"
 
 #include "gettext.h"
+#undef printf
 
 #include "iostream.hpp"
 
diff -riwbBuN -Xex aspell-0.60.4/common/convert.cpp aspell-0.60.4-modified/common/convert.cpp
--- aspell-0.60.4/common/convert.cpp Thu Sep 29 05:20:04 2005
+++ aspell-0.60.4-modified/common/convert.cpp Sat May 27 12:08:02 2006
@@ -23,6 +23,7 @@
 #include "iostream.hpp"
 
 #include "gettext.h"
+#undef printf
 
 namespace acommon {
 
diff -riwbBuN -Xex aspell-0.60.4/common/file_util.cpp aspell-0.60.4-modified/common/file_util.cpp
--- aspell-0.60.4/common/file_util.cpp Mon Nov 15 13:29:54 2004
+++ aspell-0.60.4-modified/common/file_util.cpp Sat May 27 12:08:02 2006
@@ -26,6 +26,7 @@
 
 #ifdef WIN32
 
+#  include "asc_ctype.hpp"
 #  include <io.h>
 #  define ACCESS _access
 #  include <windows.h>
diff -riwbBuN -Xex aspell-0.60.4/common/gettext_init.cpp aspell-0.60.4-modified/common/gettext_init.cpp
--- aspell-0.60.4/common/gettext_init.cpp Tue Nov  9 09:20:24 2004
+++ aspell-0.60.4-modified/common/gettext_init.cpp Thu Jun 15 15:31:02 2006
@@ -1,5 +1,13 @@
+#include "settings.h"
+#include "string.hpp"
+
+#ifdef _WIN32
+  #include <windows.h>
+  #include "aspell_win.hpp"
+#endif
 
 #include "gettext.h"
+#undef printf
 
 #if ENABLE_NLS
 
@@ -11,12 +19,24 @@
 
 extern "C" void aspell_gettext_init()
 {
-  {
     acommon::Lock l(&lock);
     if (did_init) return;
     did_init = true;
-  }
+  
+#ifdef _WIN32
+  // Registry key for Locale Path
+  
+  acommon::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
diff -riwbBuN -Xex aspell-0.60.4/common/info.cpp aspell-0.60.4-modified/common/info.cpp
--- aspell-0.60.4/common/info.cpp Wed Nov 10 07:18:46 2004
+++ aspell-0.60.4-modified/common/info.cpp Fri Jun 16 01:20:52 2006
@@ -15,9 +15,11 @@
  /* BSDi defines u_intXX_t types in machine/types.h */
 #include <machine/types.h>
 #endif
+
 #ifdef WIN32
 #  include <windows.h>
 #  include <winbase.h>
+#include "aspell_win.hpp"
 #endif
 
 #include "iostream.hpp"
@@ -38,6 +40,7 @@
 #include "string_map.hpp"
 
 #include "gettext.h"
+#undef printf
 
 namespace acommon {
 
@@ -492,8 +495,22 @@
   void get_data_dirs (Config * config,
       StringList & lst)
   {
+    String dictpath;
+ HKEY hive;
+
     lst.clear();
-    lst.add(config->retrieve("data-dir"));
+
+    hive = GetRegHive();
+
+#ifdef _WIN32
+    // Registry key for dictionary path
+    dictpath = 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"));
   }
 
diff -riwbBuN -Xex aspell-0.60.4/common/posib_err.cpp aspell-0.60.4-modified/common/posib_err.cpp
--- aspell-0.60.4/common/posib_err.cpp Sun Nov 21 03:52:22 2004
+++ aspell-0.60.4-modified/common/posib_err.cpp Sat May 27 12:08:02 2006
@@ -13,6 +13,7 @@
 #include "posib_err.hpp"
 
 #include "gettext.h"
+#undef printf
 
 
 namespace acommon {
diff -riwbBuN -Xex aspell-0.60.4/modules/speller/default/language.cpp aspell-0.60.4-modified/modules/speller/default/language.cpp
--- aspell-0.60.4/modules/speller/default/language.cpp Sun Feb 20 22:47:08 2005
+++ aspell-0.60.4-modified/modules/speller/default/language.cpp Wed Jun 14 19:55:47 2006
@@ -21,10 +21,11 @@
 #include "file_util.hpp"
 
 #ifdef ENABLE_NLS
-#  include <langinfo.h>
+//#include <langinfo.h>
 #endif
 
 #include "gettext.h"
+#undef printf
 
 namespace aspeller {
 
diff -riwbBuN -Xex aspell-0.60.4/prog/aspell.cpp aspell-0.60.4-modified/prog/aspell.cpp
--- aspell-0.60.4/prog/aspell.cpp Sun Jun 19 14:00:46 2005
+++ aspell-0.60.4-modified/prog/aspell.cpp Wed Jun 14 20:46:09 2006
@@ -60,6 +60,7 @@
 #include "hash_fun.hpp"
 
 #include "gettext.h"
+#undef printf
 
 using namespace acommon;
 

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
 

_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Kevin Atkinson :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, 13 May 2008, Abdelrazak Younes wrote:

> Abdelrazak Younes wrote:
>> setterg@... wrote:
>>>
>>>  -------------- Original message ---------------------- <snip>
>>> > the LyX project has long solved the Windows packaging problem by
>>> > forking Aspell.
>>>  <snip>
>>>
>>>  -------------- Reply ---------------------------------- It may not be
>>>  my place to ask, but why didn't the LyX people submit patches so that
>>>  we could have one aspell that works for Unix and Windows? Gary Setter
>>
>> We of course did that (More exactly Peter Kuemmel did), a long time ago:
>>
>> http://sourceforge.net/tracker/index.php?func=detail&aid=1507425&group_id=245&atid=300245

Those where against CVS head and not Aspell 0.60.*.  Probably the main
reason I didn't take that much interest in them, also you didn't give me
a clear patch to apply rather a zip file and a bunch of steps to follow.

> You can by the way find the patches for MSVC and Mingw in our svn repo:
>
> svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/mingw/aspell-0.60.4.patch
> svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/msvc/aspell-setter-sep06.patch
>
> Joost, are they the latest ones? And by the way, do you still use the
> original CMake files by Peter? Or something else?
>
> I attach these two patches as they are not too big.

Ok now we are getting somewhere.  These look like there are more than
compile fixes.  What features are they adding.  I take they are both meant
to be applied.

> OK, I tried to trigger (again) a discussion about this issue in the hope that
> the Aspell project would integrate our modification.

I try to look over your patches in the next couple of days.  See above.



_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

Kevin Atkinson wrote:
>  On Tue, 13 May 2008, Abdelrazak Younes wrote:
> >> setterg@... wrote:
> >> We of course did that (More exactly Peter Kuemmel did), a long
> >> time ago:
> >>
> >>
http://sourceforge.net/tracker/index.php?func=detail&aid=1507425&group_id=245&atid=300245
> >>
>
>  Those where against CVS head and not Aspell 0.60.*.  Probably the
>  main reason I didn't take that much interest in them, also you didn't
>  give me a clear patch to apply rather a zip file and a bunch of steps
>  to follow.

Well Peter also said that he ported 0.60.4 too at the time but you
didn't reply at all IIRC.

> > You can by the way find the patches for MSVC and Mingw in our svn
> > repo:
> >
> >
svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/mingw/aspell-0.60.4.patch
> >
> >
svn://svn.lyx.org/lyx/lyx-devel/trunk/development/Win32/patches/msvc/aspell-setter-sep06.patch
> >
> >
> > Joost, are they the latest ones? And by the way, do you still use
> > the original CMake files by Peter? Or something else?
> >
> > I attach these two patches as they are not too big.
>
>  Ok now we are getting somewhere.  These look like there are more than
>  compile fixes.

Yes.

>  What features are they adding.

The Windows registery settings.

>  I take they are both
>  meant to be applied.

I guess too but I am not sure. There is a patch for dirent also IIUC,
but this one is only for MSVC support, see attached. Joost, Peter, could
you comment please?

Abdel.


/*
 * dirent.h - operating system independent dirent implementation
 *
 * Copyright (C) 1998-2002  Toni Ronkko
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * ``Software''), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 *
 * Aug 20, 2006, Toni Ronkko
 * Removed all remarks about MSVC 1.0, which is antiqued now.  Simplified
 * comments by removing SGML tags.
 *
 * May 14 2002, Toni Ronkko
 * Embedded the function definitions directly to the header so that no source
 * modules must be included in the MS Visual C project for using the
 * interface.  Removed all the dependencies to other projects so
 * that this very header can be used independently.
 *
 * May 28 1998, Toni Ronkko
 * First version.
 */
#ifndef DIRENT_H
#define DIRENT_H
#define DIRENT_H_INCLUDED

/* find out platform */
#if defined(MSDOS)                             /* MS-DOS */
#elif defined(__MSDOS__)                       /* Turbo C/Borland */
# define MSDOS
#elif defined(__DOS__)                         /* Watcom */
# define MSDOS
#endif

#if defined(WIN32)                             /* MS-Windows */
#elif defined(__NT__)                          /* Watcom */
# define WIN32
#elif defined(_WIN32)                          /* Microsoft */
# define WIN32
#elif defined(__WIN32__)                       /* Borland */
# define WIN32
#endif

/*
 * See what kind of dirent interface we have unless autoconf has already
 * determinated that.
 */
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
# if defined(_MSC_VER)                         /* Microsoft C/C++ */
    /* no dirent.h */
# elif defined(__BORLANDC__)                   /* Borland C/C++ */
#   define HAVE_DIRENT_H
#   define VOID_CLOSEDIR
# elif defined(__TURBOC__)                     /* Borland Turbo C */
    /* no dirent.h */
# elif defined(__WATCOMC__)                    /* Watcom C/C++ */
#   define HAVE_DIRECT_H
# elif defined(__apollo)                       /* Apollo */
#   define HAVE_SYS_DIR_H
# elif defined(__hpux)                         /* HP-UX */
#   define HAVE_DIRENT_H
# elif defined(__alpha) || defined(__alpha__)  /* Alpha OSF1 */
#   error "not implemented"
# elif defined(__sgi)                          /* Silicon Graphics */
#   define HAVE_DIRENT_H
# elif defined(sun) || defined(_sun)           /* Sun Solaris */
#   define HAVE_DIRENT_H
# elif defined(__FreeBSD__)                    /* FreeBSD */
#   define HAVE_DIRENT_H
# elif defined(__linux__)                      /* Linux */
#   define HAVE_DIRENT_H
# elif defined(__GNUC__)                       /* GNU C/C++ */
#   define HAVE_DIRENT_H
# else
#   error "not implemented"
# endif
#endif

/* include proper interface headers */
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
# ifdef FREEBSD
#   define NAMLEN(dp) ((int)((dp)->d_namlen))
# else
#   define NAMLEN(dp) ((int)(strlen((dp)->d_name)))
# endif

#elif defined(HAVE_NDIR_H)
# include <ndir.h>
# define NAMLEN(dp) ((int)((dp)->d_namlen))

#elif defined(HAVE_SYS_NDIR_H)
# include <sys/ndir.h>
# define NAMLEN(dp) ((int)((dp)->d_namlen))

#elif defined(HAVE_DIRECT_H)
# include <direct.h>
# define NAMLEN(dp) ((int)((dp)->d_namlen))

#elif defined(HAVE_DIR_H)
# include <dir.h>
# define NAMLEN(dp) ((int)((dp)->d_namlen))

#elif defined(HAVE_SYS_DIR_H)
# include <sys/types.h>
# include <sys/dir.h>
# ifndef dirent
#   define dirent direct
# endif
# define NAMLEN(dp) ((int)((dp)->d_namlen))

#elif defined(MSDOS) || defined(WIN32)

  /* figure out type of underlaying directory interface to be used */
# if defined(WIN32)
#   define DIRENT_WIN32_INTERFACE
# elif defined(MSDOS)
#   define DIRENT_MSDOS_INTERFACE
# else
#   error "missing native dirent interface"
# endif

  /*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
#   include <windows.h>
#   if !defined(DIRENT_MAXNAMLEN)
#     define DIRENT_MAXNAMLEN (MAX_PATH)
#   endif


  /*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
#   include <dos.h>

    /* Borland defines file length macros in dir.h */
#   if defined(__BORLANDC__)
#     include <dir.h>
#     if !defined(DIRENT_MAXNAMLEN)
#       define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
#     endif
#     if !defined(_find_t)
#       define _find_t find_t
#     endif

    /* Turbo C defines ffblk structure in dir.h */
#   elif defined(__TURBOC__)
#     include <dir.h>
#     if !defined(DIRENT_MAXNAMLEN)
#       define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
#     endif
#     define DIRENT_USE_FFBLK

    /* MSVC */
#   elif defined(_MSC_VER)
#     if !defined(DIRENT_MAXNAMLEN)
#       define DIRENT_MAXNAMLEN (12)
#     endif

    /* Watcom */
#   elif defined(__WATCOMC__)
#     if !defined(DIRENT_MAXNAMLEN)
#       if defined(__OS2__) || defined(__NT__)
#         define DIRENT_MAXNAMLEN (255)
#       else
#         define DIRENT_MAXNAMLEN (12)
#       endif
#     endif

#   endif
# endif

  /*** generic MS-DOS and MS-Windows stuff ***/
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
#   define NAME_MAX DIRENT_MAXNAMLEN
# endif
# if NAME_MAX < DIRENT_MAXNAMLEN
#   error "assertion failed: NAME_MAX >= DIRENT_MAXNAMLEN"
# endif


  /*
   * Substitute for real dirent structure.  Note that d_name field is a
   * true character array although we have it copied in the implementation
   * dependent data.  We could save some memory if we had declared d_name
   * as a pointer refering the name within implementation dependent data.
   * We have not done that since some code may rely on sizeof(d_name) to be
   * something other than four.  Besides, directory entries are typically so
   * small that it takes virtually no time to copy them from place to place.
   */
  typedef struct dirent {
    char d_name[NAME_MAX + 1];

    /*** Operating system specific part ***/
# if defined(DIRENT_WIN32_INTERFACE)       /*WIN32*/
    WIN32_FIND_DATA data;
# elif defined(DIRENT_MSDOS_INTERFACE)     /*MSDOS*/
#   if defined(DIRENT_USE_FFBLK)
    struct ffblk data;
#   else
    struct _find_t data;
#   endif
# endif
  } dirent;

  /*
   * DIR substitute structure containing directory name.  The name is
   * essential for the operation of rewinndir() function.
   */
  typedef struct DIR {
    char          *dirname;                    /* directory being scanned */
    dirent        current;                     /* current entry */
    int           dirent_filled;               /* is current un-processed? */

  /*** Operating system specific part ***/
#  if defined(DIRENT_WIN32_INTERFACE)
    HANDLE        search_handle;
#  elif defined(DIRENT_MSDOS_INTERFACE)
#  endif
  } DIR;

# ifdef __cplusplus
extern "C" {
# endif

/* prototypes of public dirent functions */
static DIR *opendir (const char *dirname);
static struct dirent *readdir (DIR *dirp);
static int closedir (DIR *dirp);
static void rewinddir (DIR *dirp);

/*
 * Implement dirent interface as static functions so that the user does not
 * need to change his project in any way to use dirent function.  With this
 * it is sufficient to include this very header from source modules using
 * dirent functions and the functions will be pulled in automatically.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>

/* use ffblk instead of _find_t if requested */
#if defined(DIRENT_USE_FFBLK)
# define _A_ARCH   (FA_ARCH)
# define _A_HIDDEN (FA_HIDDEN)
# define _A_NORMAL (0)
# define _A_RDONLY (FA_RDONLY)
# define _A_SUBDIR (FA_DIREC)
# define _A_SYSTEM (FA_SYSTEM)
# define _A_VOLID  (FA_LABEL)
# define _dos_findnext(dest) findnext(dest)
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif

/* internal prototypes */
static int _initdir (DIR *p);
static const char *_getdirname (const struct dirent *dp);
static void _setdirname (struct DIR *dirp);


/*
 * Open directory stream DIRNAME for read and return pointer to the
 * internal working area that is used for retrieving individual directory
 * entries.  The internal working area has no fields of your interest.
 */
static DIR *
opendir(
    const char *dirname)
{
  DIR *dirp;
  assert (dirname != NULL);
 
  dirp = (DIR*)malloc (sizeof (struct DIR));
  if (dirp != NULL) {
    char *p;
   
    /* allocate room for directory name */
    dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
    if (dirp->dirname == NULL) {
      /* failed to duplicate directory name.  errno set by malloc() */
      free (dirp);
      return NULL;
    }
   
    /*
     * Copy directory name while appending directory separator and "*.*".
     * Directory separator is not appended if the name already ends with
     * drive or directory separator.  Directory separator is assumed to be
     * '/' or '\' and drive separator is assumed to be ':'.
     */
    strcpy (dirp->dirname, dirname);
    p = strchr (dirp->dirname, '\0');
    if (dirp->dirname < p  &&
        *(p - 1) != '\\'  &&  *(p - 1) != '/'  &&  *(p - 1) != ':')
    {
      strcpy (p++, "\\");
    }
# ifdef DIRENT_WIN32_INTERFACE
    strcpy (p, "*"); /*scan files with and without extension in win32*/
# else
    strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
# endif

    /* open stream */
    if (_initdir (dirp) == 0) {
      /* initialization failed */
      free (dirp->dirname);
      free (dirp);
      return NULL;
    }
  }
  return dirp;
}

 

/*
 * Read a directory entry and return pointer to a structure containing the
 * name of the entry.  Individual directory entries returned by this very
 * function include normal files, sub-directories, pseudo-directories "."
 * and ".." and also volume labels, hidden files and system files in MS-DOS
 * and MS-Windows.   You might want to use stat(2) function to determinate
 * which one you are dealing with.
 *
 * The dirent structure contains several system dependent fields that
 * generally have no interest to you.  The only interesting one is char
 * d_name[] that is also portable across different systems.  The d_name
 * field contains the name of the directory entry without leading path.
 * While d_name is portable across different systems, the actual storage
 * capacity of d_name varies from system to system and there is no portable
 * way to find out it at compile time.  Different systems define the
 * capacity of d_name with different macros and some systems do not define
 * capacity at all (besides actual declaration of the field).  If you really
 * need to find out storage capacity of d_name then you might want to try
 * NAME_MAX macro.  The NAME_MAX is defined in POSIX standard althought
 * there are many MS-DOS and MS-Windows implementations those do not define
 * it.  There are also systems that declare d_name as "char d_name[1]" and
 * then allocate suitable amount of memory at run-time.  Thanks to Alain
 * Decamps (Alain dot Decamps atsign advalvas dot be) for pointing it out to
 * me.
 *
 * This all leads to the fact that it is difficult to allocate space
 * for the directory names when the very same program is being compiled on
 * number of operating systems.  Therefore I suggest that you always
 * allocate space for directory names dynamically.
 */
static struct dirent *
readdir (DIR *dirp)
{
  assert (dirp != NULL);
  if (dirp == NULL) {
    errno = EBADF;
    return NULL;
  }

#if defined(DIRENT_WIN32_INTERFACE)
  if (dirp->search_handle == INVALID_HANDLE_VALUE) {
    /* directory stream was opened/rewound incorrectly or it ended normally */
    errno = EBADF;
    return NULL;
  }
#endif

  if (dirp->dirent_filled != 0) {
    /*
     * Directory entry has already been retrieved and there is no need to
     * retrieve a new one.  Directory entry will be retrieved in advance
     * when the user calls readdir function for the first time.  This is so
     * because real dirent has separate functions for opening and reading
     * the stream whereas Win32 and DOS dirents open the stream
     * automatically when we retrieve the first file.  Therefore, we have to
     * save the first file when opening the stream and later we have to
     * return the saved entry when the user tries to read the first entry.
     */
    dirp->dirent_filled = 0;
  } else {
    /* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
    if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
      /* Last file has been processed or an error occured */
      FindClose (dirp->search_handle);
      dirp->search_handle = INVALID_HANDLE_VALUE;
      errno = ENOENT;
      return NULL;
    }

# elif defined(DIRENT_MSDOS_INTERFACE)
    if (_dos_findnext (&dirp->current.data) != 0) {
      /* _dos_findnext and findnext will set errno to ENOENT when no
       * more entries could be retrieved. */
      return NULL;
    }
# endif

    _setdirname (dirp);
    assert (dirp->dirent_filled == 0);
  }
  return &dirp->current;
}



/*
 * Close directory stream opened by opendir() function.  Close of the
 * directory stream invalidates the DIR structure as well as any previously
 * read directory entry.
 *
 * Usually, the function returns 0 on success and -1 on failure.  However,
 * on some systems, the function has been declared to return void.  If you
 * want to keep your code portable, it may be better to ignore the return
 * value altogether.
 */
static int
closedir (DIR *dirp)
{  
  int retcode = 0;

  /* make sure that dirp points to legal structure */
  assert (dirp != NULL);
  if (dirp == NULL) {
    errno = EBADF;
    return -1;
  }
 
  /* free directory name */
  if (dirp->dirname != NULL) {
    free (dirp->dirname);
  }

  /* release search handle */
#if defined(DIRENT_WIN32_INTERFACE)
  if (dirp->search_handle != INVALID_HANDLE_VALUE) {
    if (FindClose (dirp->search_handle) == FALSE) {
      /* Unknown error */
      retcode = -1;
      errno = EBADF;
    }
  }
#endif                    

  /* clear dirp structure to make sure that it cannot be used anymore*/
  memset (dirp, 0, sizeof (*dirp));
# if defined(DIRENT_WIN32_INTERFACE)
  dirp->search_handle = INVALID_HANDLE_VALUE;
# endif

  free (dirp);
  return retcode;
}



/*
 * Rewind the directory stream to re-read the directory entries.  If new
 * files or directories have been created since opendir(), then also these
 * new files will be available with readdir().
 *
 * Almost every dirent implementation ensures that rewinddir() updates its
 * internal caches to reflect the current directory structure on disk.
 * However, if you really depend on this feature, it may be better to close
 * and re-open the directory stream.  I recall one particual dirent
 * interface, where rewinddir() did not update its internal cache.
 *
 * BUGS: If the current working directory is changed between opendir() and
 * rewinddir(), then the rewound directory stream may refer a non-existent
 * directory, or at worst case, to another directory.
 */
static void
rewinddir (DIR *dirp)
{  
  /* make sure that dirp is legal */
  assert (dirp != NULL);
  if (dirp == NULL) {
    errno = EBADF;
    return;
  }
  assert (dirp->dirname != NULL);
 
  /* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
  if (dirp->search_handle != INVALID_HANDLE_VALUE) {
    if (FindClose (dirp->search_handle) == FALSE) {
      /* Unknown error */
      errno = EBADF;
    }
  }
#endif

  /* re-open previous stream */
  if (_initdir (dirp) == 0) {
    /* initialization failed but we cannot deal with error.  User will notice
     * error later when she tries to retrieve first directory enty. */
    /*EMPTY*/;
  }
}



/*
 * Open native directory stream object and retrieve first file.
 * Be sure to close previous stream before opening new one.
 */
static int
_initdir (DIR *dirp)
{
  assert (dirp != NULL);
  assert (dirp->dirname != NULL);
  dirp->dirent_filled = 0;

# if defined(DIRENT_WIN32_INTERFACE)
  /* Open stream and retrieve first file */
  dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
  if (dirp->search_handle == INVALID_HANDLE_VALUE) {
    /* something went wrong but we don't know what.  GetLastError() could
     * give us more information about the error, but then we should map
     * the error code into errno. */
    errno = ENOENT;
    return 0;
  }

# elif defined(DIRENT_MSDOS_INTERFACE)
  if (_dos_findfirst (dirp->dirname,
          _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
          &dirp->current.data) != 0)
  {
    /* _dos_findfirst and findfirst will set errno to ENOENT when no
     * more entries could be retrieved. */
    return 0;
  }
# endif

  /* initialize DIR and it's first entry */
  _setdirname (dirp);
  dirp->dirent_filled = 1;
  return 1;
}



/*
 * Return implementation dependent name of the current directory entry.
 */
static const char *
_getdirname (const struct dirent *dp)
{
#if defined(DIRENT_WIN32_INTERFACE)
  return dp->data.cFileName;
 
#elif defined(DIRENT_USE_FFBLK)
  return dp->data.ff_name;
 
#else
  return dp->data.name;
#endif  
}



/*
 * Copy name of implementation dependent directory entry to the d_name field.
 */
static void
_setdirname (struct DIR *dirp) {
  /* make sure that d_name is long enough */
  assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
 
  strncpy (dirp->current.d_name,
      _getdirname (&dirp->current),
      NAME_MAX);
  dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
}
 
# ifdef __cplusplus
}
# endif
# define NAMLEN(dp) ((int)(strlen((dp)->d_name)))

#else
# error "missing dirent interface"
#endif


#endif /*DIRENT_H*/

_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Abdelrazak Younes-2 :: Rate this Message:

| View Threaded | Show Only this Message

Abdelrazak Younes wrote:
> I guess too but I am not sure. There is a patch for dirent also IIUC,
> but this one is only for MSVC support, see attached. Joost, Peter,
> could you comment please?

Hello again,

Kevin, I am sorry but it seems that the patches I sent are not up to
date. Here is a message from Joost who maintains the Windows port for LyX:

----

The patches in LyX SVN are no longer in use. Previously, I've use
aspell-setter-sep06.patch in combination with the unofficial version by
Gary Setter.

I'm currently using the version provided by Nicolas Hatier (posted to
aspell-devel in July 2007), which adds MSVC support to Aspell. In
addition, I've fixed a few Windows bugs and made Aspell check for a
registry key that contains the dictionary and data file location, so the
dictionaries can be shared by all applications.

We have also created an installer for the Aspell data files and
installers for all dictionaries. The dictionary installers are generated
automatically using a shell script.

Source code is available at
http://wiki.lyx.org/uploads/Windows/aspell-source/

Best Regards,

Joost Verburg





_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by Kevin Atkinson :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, 13 May 2008, Abdelrazak Younes wrote:

Hi, Joist please reply directly to me and the list, don't worry about
subscribing I will let your post go through.

> The patches in LyX SVN are no longer in use. Previously, I've use
> aspell-setter-sep06.patch in combination with the unofficial version by Gary
> Setter.
>
> I'm currently using the version provided by Nicolas Hatier (posted to
> aspell-devel in July 2007), which adds MSVC support to Aspell. In addition,
> I've fixed a few Windows bugs and made Aspell check for a registry key that
> contains the dictionary and data file location, so the dictionaries can be
> shared by all applications.
>
> We have also created an installer for the Aspell data files and installers
> for all dictionaries. The dictionary installers are generated automatically
> using a shell script.
>
> Source code is available at
> http://wiki.lyx.org/uploads/Windows/aspell-source/

Thanks

Do me a favor, put together a quick web page saying what you just did
above and also pointing to http://wiki.lyx.org/Windows/Aspell6 for the
dictionaries and I will add a link to it at the Aspell homepage, thanks.

If you have the time please update:
   http://sourceforge.net/tracker/index.php?func=detail&aid=1751606&group_id=245&atid=300245

With your additional modifications, thanks.

Also, what do you know about [ 1123402 ] MSYS build patch
   http://sourceforge.net/tracker/index.php?func=detail&aid=1123402&group_id=245&atid=300245



_______________________________________________
Aspell-devel mailing list
Aspell-devel@...
http://lists.gnu.org/mailman/listinfo/aspell-devel

Re: aspell 0.60.6 on Windows and using libaspell with SciTE

by lee365 :: Rate this Message:

| View Threaded | Show Only this Message

Hi Abdelrazak,

Two things:
1. I would be interested in potentially maintaining Aspell for Windows packaging
2. The ftp link is no longer valid: ftp://ftp.lyx.org/pub/lyx/contrib/lyx-windows-deps-msvc2008.zip
can you please provide an updated link as I've searched the directories.

Lee


Abdelrazak Younes-2 wrote:
Hello,

I don't understand why our work on Aspell for Windows is still not yet
known but, FYI, the LyX project has long solved the Windows packaging
problem by forking Aspell. We use MSVC2008 in order to create the dlls
that can be found inside this archive:

ftp://ftp.lyx.org/pub/lyx/contrib/lyx-windows-deps-msvc2008.zip

You will find other goodies like latest gettext and iconv.

We also maintains all knowns dictionnary in the latest format here:

http://wiki.lyx.org/Windows/Aspell6
ftp://ftp.lyx.org/pub/lyx/contrib/aspell6-windows/
http://developer.berlios.de/project/showfiles.php?group_id=5117&release_id=12973

IMHO anyone willing to maintain the Aspell Windows port should talk to
us in order to avoid duplicated effort.

Abdel.


Laura nmi Michaels wrote:
> A lot of people on the SciTE mailing list (and probably other text editors
> groups too) have been clamoring for a spell-checker to work with their
> favorite editor.  I thought if I could find a decent C/C++ library that
> handled spelling, I could write some code to output the results in a format
> similar to the error messages from the gnu C/C++ and mingw C/C++ compilers.  
> When I found out aspell had such a library, I decided to download a copy of
> the latest version 0.60.6 and test out my idea.  As I was trying to compile
> the library with mingw and msys, I kept asking myself how did anyone get
> this working on Windows.  After searching the Internet for 4 fixes to
> various issues I came across, I finally got the library and aspell program
> to build.  I went back to the aspell web site to locate some documentation
> on the C/C++ library API and I noticed the Win32 page doesn't have the
> latest version of aspell.  So, I guess people aren't getting this to compile
> on Windows.  
>
> I have some diffs to get aspell 0.60.6 compiling properly with mingw and
> msys.  I also have a request for an additional program that I would really
> like to see added to the examples directory.  I cannibalized the example-c.c
> code to come up with something that would spell check a file and output
> results to stdout in the error format used by gnu gcc.  I think this or
> something like it would be a really useful example to add for anyone who's
> been wanting to run aspell with a decent programming editor.  Hopefully
> others could help contribute and make it a better and more robust program,
> since the changes I made were quick ones just to get proof of concept.
>
> The diffs for aspell on mingw with msys are included below.  I also have
> some Windows executables.  I have library files in .a format, but
> the ./configure, make, make install process doesn't appear to have created
> any dlls.  I don't remember having any problems installing the English
> dictionary files using the ./configure, make, make install process under
> msys.  If you need executable files and/or library (.a files) packaged a
> certain way, let me know and I can send them to someone if they want to
> distribute them further.  The source code I wrote for better integrating
> aspell with a programming editor is at:  
> http://www.distasis.com/cpp/aspellstdout.c
> It can be compiled with mingw using the command:
> g++ -o aspellstdout.exe aspellstdout.c -I\mingw\msys\local\include -L
> \mingw\msys\lib -L \mingw\msys\local\lib -ldl -laspell -lintl -
> lgettextlib.dll -ldl.dll
> I also compiled it on DeLi Linux using the command:
> g++ -o aspellstdout aspellstdout.c -I/usr/local/include -L /usr/lib -
> L /usr/local/lib -ldl -laspell -lintl
> On Windows, I'm using the basic libraries such as libiconv and libintl from
> the GnuWin32 project, http://sourceforge.net/project/gnuwin32  I'm using the
> libdl library from:
> http://code.google.com/p/dlfcn-win32/downloads/list
> Be sure to add the patch for extern C on the issues page.  That was one of
> the fixes I needed to make to get things to compile.  I'm using the latest
> copy of pdcurses from Sourceforge:  http://sourceforge.net/project/pdcurses 
> Don't know if it's needed, but I have my .profile file (used by msys) set up
> as mentioned here:  http://www.distasis.com/cpp/mingw.htm#whatismsys
>
> The examples in the example directory didn't compile when I used the
> makefile.  Was able to get example-c to compile from command line in a
> standard command prompt with the following command:
> g++ -o example-c.exe example-c.c  -I\mingw\msys\local\include -L
> \mingw\msys\lib -L \mingw\msys\local\lib -ldl  -laspell -lintl -
> lgettextlib.dll -ldl.dll
> To run the example-c.exe afterwards, you need libdl.dll, libicon2.dll,
> libintl3.dll in the same directory or in the path.
>
> Here are the patches I needed for mingw and msys:
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\config.hpp
> \mingw\msys\home\new\aspell-0.60.6\common\config.hpp
> 15a16,19
>> #ifdef __MINGW32__
>> #define libintl_printf printf
>> #endif
>>
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6\common\file
> _util.cpp \mingw\msys\home\new\aspell-0.60.6\common\file_util.cpp
> 15a16
>> #include "asc_ctype.hpp"
>
> \mingw\msys\bin\diff \mingw\msys\home\old\aspell-0.60.6
> \modules\speller\default\language.cpp \mingw\msys\home\michaelsl\new\aspell-
> 0.60.6\modules\spell
> er\default\language.cpp
> 23d22
> < #ifndef __MINGW32__
> 26d24
> < #endif
>
>
> Best wishes.
> Laura




_______________________________________________
Aspell-devel mailing list
Aspell-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/aspell-devel