From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: [ranting] Take Command Plugin, Win32Ada and Ada.Directories
Date: Tue, 13 Nov 2007 10:52:42 +0100
Date: 2007-11-13T10:52:42+01:00 [thread overview]
Message-ID: <4739740e$1@news.post.ch> (raw)
In-Reply-To: <1pkwbr5s12cf9$.9k2umlcxqzbr.dlg@40tude.net>
Dmitry A. Kazakov schrieb:
> On Mon, 12 Nov 2007 20:53:10 +0100, Martin Krischik wrote:
>
>> But what really saddens me is the fact that Ada 2005 still uses String for
>> filenames. I just found out that Ada.Directories.Search chokes on filenames
>> with wide characters. Since Windows uses UTF-16 for filenames even a simple
>> Latin-1 "Ä" is in that group.
>
> Actually Windows has xxxA and xxxW versions of the API calls. Does Win32Ada
> reflect that? The bindings to the xxxW subprograms should use Wide_String.
Yes, Win32Ada reflect this. The types used are:
----------------------------------------------------------------------
type wchar_t is new Wide_Character;
----------------------------------------------------------------------
----------------------------------------------------------------------
subtype Wchar_T is Interfaces.C.wchar_t; -- ctype.h
subtype WCHAR is Wchar_T; -- winnt.h
type PWCH is access all WCHAR; -- winnt.h
subtype LPWCH is PWCH; -- winnt.h
subtype PWCHAR is PWCH; -- winnt.h
subtype NWPSTR is PWCH; -- winnt.h
subtype LPWSTR is PWCH; -- winnt.h
subtype PWSTR is PWCH; -- winnt.h
type PCWCH is access constant WCHAR; -- winnt.h
subtype LPCWCH is PCWCH; -- winnt.h
subtype PCWSTR is PCWCH; -- winnt.h
subtype LPCWSTR is PCWCH; -- winnt.h
type WCHAR_Array is array (Natural range <>) of aliased WCHAR;
Wide_Nul : constant WCHAR := WCHAR'First;
----------------------------------------------------------------------
So I use Win32.Winbase.FindFirstFileW and Win32.Winbase.FindNextFileW
instead of Ada.Directories. For the plug-in that is OK since Take
Command is only available on Windows anyway.
The problematic part is that "Win32.LPCWSTR" is used where "in
WCHAR_Array" would be more appropriate.
> (I guess that Windows is UCS-2, not UTF-16)
I don't know, the MS documentation speaks of unicode leaving the rest
uncertain.
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
next prev parent reply other threads:[~2007-11-13 9:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 19:53 [ranting] Take Command Plugin, Win32Ada and Ada.Directories Martin Krischik
2007-11-13 8:57 ` Dmitry A. Kazakov
2007-11-13 9:52 ` Martin Krischik [this message]
2007-11-13 21:08 ` Pascal Obry
2007-11-14 8:33 ` Dmitry A. Kazakov
2007-11-14 8:56 ` Martin Krischik
2007-11-14 9:31 ` Georg Bauhaus
2007-11-14 11:19 ` Vadim Godunko
2007-11-14 14:22 ` Dmitry A. Kazakov
2007-11-14 20:15 ` Martin Krischik
2007-11-15 8:37 ` Dmitry A. Kazakov
2007-11-14 13:15 ` [ranting] " Martin Krischik
2007-11-14 13:31 ` Georg Bauhaus
2007-11-14 14:36 ` Dmitry A. Kazakov
2007-11-14 15:13 ` Georg Bauhaus
2007-11-14 15:35 ` Dmitry A. Kazakov
2007-11-14 16:22 ` Georg Bauhaus
2007-11-14 19:32 ` Martin Krischik
2007-11-15 8:54 ` Dmitry A. Kazakov
2007-11-16 6:54 ` Randy Brukardt
2007-11-14 19:23 ` Martin Krischik
2007-11-14 20:05 ` Georg Bauhaus
2007-11-14 19:21 ` Martin Krischik
2007-11-14 9:36 ` Dmitry A. Kazakov
2007-11-14 18:38 ` Martin Krischik
2007-11-15 1:51 ` John W. Kennedy
2007-11-15 9:08 ` Dmitry A. Kazakov
2007-11-14 8:49 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox