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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: [ANN] List_Image v0.2.0 Date: Thu, 1 Feb 2018 17:56:52 -0600 Organization: JSA Research & Innovation Message-ID: References: <575826a1-c983-49aa-95e2-54048f6b7b5b@googlegroups.com> <1b89075d-c284-4358-93b9-704e4b079292@googlegroups.com> Injection-Date: Thu, 1 Feb 2018 23:56:52 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="24485"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50268 Date: 2018-02-01T17:56:52-06:00 List-Id: wrote in message news:1b89075d-c284-4358-93b9-704e4b079292@googlegroups.com... ... > Apparently, it has no publicly available entity that would provide that > information, > either, so a lot of projects simply do: > > Is_Windows : constant Boolean := > GNAT.OS_Lib.Directory_Separator := '\'; > > Does Janus/Ada have a similar directory_separator somewhere ? It's in the body of Ada.Directories -- not very useful. You could test the case of the file system (Ada.Directories.Name_Case_Equivalence), Unix/Linux is always Case_Insensitive. Windows is Case_Preserving unless you are running a POSIX file system -- but then you probably would want POSIX line terminators, too. >Seems like this kind of constant should be standard somewhere. Claiming Ada >code is portable is nice (and > mostly true), but I believe almost all multi-platform projects end up > with such a > requirement, in practice, if only to properly handle file names. > If thought Ada.Directories might help here, but apparently not. The idea of Ada.Directories is that you do all of the file handling through it, and you never need to worry about path separators. (Systems like VMS use more than a single character.) Similarly, if you do all of your text file writing with Text_IO, you use New_Line and it does the right thing. Assuming a single character or string is involved is limiting. If one has a string with multiple lines, it makes the most sense (for portable code) to use anything that makes sense, but then use multiple Put_Lines to write it (not just one) so that any sort of separator (including just a as on original Macs or some sort of record separator aas on some ancient mainframes) will work. If you just care about Linux and Windows and don't think anything else will ever be used (possible, I guess), then test Name_Case_Equivalence and be happy. :-) Randy.