From: anon@anon.org (anon)
Subject: Re: Missing CR/LF in Gnat files?
Date: Sun, 16 Sep 2007 23:00:18 GMT
Date: 2007-09-16T23:00:18+00:00 [thread overview]
Message-ID: <6AiHi.102035$ax1.44338@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: 13eomjrhjs3al0a@corp.supernews.com
The other who suggest "unix2dos", well it does not fully
handle Windows version of Latin-1, since DOS is no longer
supported.
An Ada program using "put_line" or "new_line" only inserts
a "ASCII.LF" character and not the "LF/CR" pair of characters.
Below is a program that correct this.
But the best solution is to get a Unicode Editor! Instead of
editing the files!
--
--
-- Fix_Files <input.txt >output.txt
--
--
with Ada.Text_IO ;
use Ada.Text_IO ;
procedure Fix_Files is
char : Character ;
begin -- Fix_Files
while not End_of_File ( Standard_input ) loop
--
-- Transfer line and stop of end_of_line.
--
while not End_of_Line ( Standard_input ) loop
get ( item => char ) ;
put ( item => char ) ;
end loop ;
--
-- process end_of_line
--
skip_line ;
-- These two "put' statements insert the correct
-- Control characters in the correct order.
put ( item => ASCII.CR ) ;
put ( item => ASCII.LF ) ;
end loop ;
--
-- Catch any file allocations or end_errors
--
exception
when End_Error =>
put ( item => ASCII.CR ) ;
put ( item => ASCII.LF ) ;
end Fix_Files ;
Reasons:
The Ada RM 2.2 (2) states
"The text of a compilation is divided into lines. In general, the
representation for an end of line is implementation defined. However,
a sequence of one or more format_effectors other than character
tabulation (HT) signifies at least one end of line."
Which means that any Ada compiler or Ada IDE editor should be able
to handle many different text forms of compilation units, but that
does not mean that Microsoft OS can, especially the newly released
Vista. Microsoft, uses many difference versions of Latin-1 and Ada
uses ISO 10646 BMP [ RM 2.1 (4) ] for its character set.
So you should not need to alter the Win32Ada files to compile. And if
you want to use them to print out or as a reference from an editor it
is better to download a editor for your OS that can handle ISO 10646
BMP aka a Unicode editor. Plus, this new editor should be able to
handle in additional or updated Ada compilers or subsystems.
A true Unicode or ISO 10464 editor can handle a character set up to
16 to 32 bits for multi-languages. And should be able to convert to
many character sub-set such as Windows version of Latin-1.
In <13eomjrhjs3al0a@corp.supernews.com>, "Phaedrus" <phaedrusalt@hotmail.com> writes:
>Sorry to eat bandwidth with a silly question, but has anyone else had a
>problem with the Gnat install where files in Gnat\bindings\Win32Ada are
>missing carriage returns and/or linefeeds? Seems like I've run into this
>problem before, but I can't seem to remember how to fix the files... It
>sure is a pain to try to find anything in win32-winbase.ads when the file is
>one looooooong line!!!
>
>Thanks in advance!
>Brian
>
>
prev parent reply other threads:[~2007-09-16 23:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-15 22:19 Missing CR/LF in Gnat files? Phaedrus
2007-09-15 23:05 ` Sloan.Kohler
2007-09-15 23:25 ` Phaedrus
2007-09-16 5:16 ` Gautier
2007-09-16 18:38 ` Jeffrey R. Carter
2007-09-16 22:15 ` Phaedrus
2007-09-16 23:00 ` anon [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox