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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ccd337934e964b6a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.135.231 with SMTP id pv7mr13116164pbb.8.1328597271619; Mon, 06 Feb 2012 22:47:51 -0800 (PST) Path: lh20ni269556pbb.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: GNAT: no more exception raised on illformed text file? Date: Tue, 07 Feb 2012 07:47:50 +0100 Organization: A noiseless patient Spider Message-ID: References: <8801c492-52d4-47be-a976-06f10de5c1df@18g2000yqe.googlegroups.com> Mime-Version: 1.0 Injection-Date: Tue, 7 Feb 2012 06:47:51 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="cJo7kSTQUrCFv2/D8KKtqw"; logging-data="4521"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sAbFeHVeqBId4nGNUHAvv" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 In-Reply-To: <8801c492-52d4-47be-a976-06f10de5c1df@18g2000yqe.googlegroups.com> Cancel-Lock: sha1:7V2J14SsMhSxAUSb1Wjjkaj8wqg= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2012-02-07T07:47:50+01:00 List-Id: Le 06/02/2012 20:04, Shark8 a �crit : >> Seems my FSF GNAT (*) does not raise an exception anymore when >> encountering the last line of a malformed text file; that is, a text file >> whose last line is not terminated with an end-of-line. > > Such a file is NOT a malformed text-file; that definition is a UNIX- > ism and therefore applicable ONLY to the UNIX/LINUX world. In Windows, > for example, a user in Notepad (or wordpad, or any other editor) can > save a text-file without such a termination (as Adam points out) and > it IS a valid text-file precisely because Windows does not define a > text-file in that manner. (IIRC all that Windows needs is the ASCII > EOF character.) You miss the point here. We are talking about a malformed file from the Ada POV. In Ada, a text is terminated by an End_Of_Line_Mark, followed by an End_Of_Page_Mark, followed by an End_Of_File_Mark, but the standard does not say how these marks are represented in the file. IF an implementation chooses to represent EOL as LF, EOP as FF, and EOF as ^Z, then any file that does not end with LF+FF+^Z is malformed. Such an implementation is legal, but user hostile. Better implementations are more flexible: Gnat f.e. accepts CR, LF, CR+LF and LF+CR as EOL. Most implementations accept the physical end of file as EOF, and generally as EOP+EOF if there is no explicit EOP. The only thing required by the standard is that a file written by an Ada program can be read by an Ada program (using the same compiler of course). It is not specified that an Ada program can read a file produced by a text editor. However, if you are a compiler vendor, you'd better choose an implementation that accepts it, or you won't sell many compilers! -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr