From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,347f7cbe27451012 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: [ranting] Take Command Plugin, Win32Ada and Ada.Directories Date: Tue, 13 Nov 2007 10:52:42 +0100 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <4739740e$1@news.post.ch> References: <3343563.psPA6e9Oqh@linux1.krischik.com> <1pkwbr5s12cf9$.9k2umlcxqzbr.dlg@40tude.net> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: atlas.ip-plus.net 1194947602 22949 194.41.146.1 (13 Nov 2007 09:53:22 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Tue, 13 Nov 2007 09:53:22 +0000 (UTC) User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <1pkwbr5s12cf9$.9k2umlcxqzbr.dlg@40tude.net> X-Original-NNTP-Posting-Host: w03duo.pnet.ch X-Original-Trace: 13 Nov 2007 10:53:18 +0200, w03duo.pnet.ch Xref: g2news1.google.com comp.lang.ada:18344 Date: 2007-11-13T10:52:42+01:00 List-Id: 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