* Missing CR/LF in Gnat files?
@ 2007-09-15 22:19 Phaedrus
2007-09-15 23:05 ` Sloan.Kohler
2007-09-16 23:00 ` anon
0 siblings, 2 replies; 7+ messages in thread
From: Phaedrus @ 2007-09-15 22:19 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
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 23:00 ` anon
1 sibling, 1 reply; 7+ messages in thread
From: Sloan.Kohler @ 2007-09-15 23:05 UTC (permalink / raw)
On Sep 15, 5:19 pm, "Phaedrus" <phaedrus...@hotmail.com> wrote:
> 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
What editor are you using to look at the files? The GNAT source files
may have UNIX line terminations (LF only, not CR/LF) and simple
editors like Notepad won't display them correctly.
-- Sloan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
2007-09-15 23:05 ` Sloan.Kohler
@ 2007-09-15 23:25 ` Phaedrus
2007-09-16 5:16 ` Gautier
0 siblings, 1 reply; 7+ messages in thread
From: Phaedrus @ 2007-09-15 23:25 UTC (permalink / raw)
I have to assume (Yeah, I know what they say about "assume"!) that it's not
a question of the editor. I'm using Adagide, and most of the files in
Gnat\bindings\Win32Ada are just fine. But a few have this problem, and it's
getting to be a pain... I've tried using unix2dos to see if it's a CR/LF
problem, but no dice. I've had this problem before with Gnat, and currently
I've got the same problem on two machines. That leads me to the conclusion
that it's a problem with the Win32 distribution. Anyway, I seem to remember
a fix for this, possibly an obscure flag with gnatchop or something.
Anybody remember anything like that?
Brian
<Sloan.Kohler@gmail.com> wrote in message
news:1189897537.544300.214650@g4g2000hsf.googlegroups.com...
> On Sep 15, 5:19 pm, "Phaedrus" <phaedrus...@hotmail.com> wrote:
>> 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
>
> What editor are you using to look at the files? The GNAT source files
> may have UNIX line terminations (LF only, not CR/LF) and simple
> editors like Notepad won't display them correctly.
>
> -- Sloan
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
2007-09-15 23:25 ` Phaedrus
@ 2007-09-16 5:16 ` Gautier
2007-09-16 18:38 ` Jeffrey R. Carter
0 siblings, 1 reply; 7+ messages in thread
From: Gautier @ 2007-09-16 5:16 UTC (permalink / raw)
Phaedrus wrote:
> Anybody remember anything like that?
This is definitely a UNIX end-of-line problem.
Try harder with your unix2dos (if it works, e.g. with LF & CR/LF mixtures!)...
Indeed, this "Any_filesystem_2_My_filesystem" works pretty well:
-- Transforms line ends from input to output with host convention
-- Stands for Unix2DOS and the like.
--
-- LF: Unix and Unix-like systems, Linux, AIX, Xenix, Mac OS X,...
-- CR+LF: CP/M, MP/M, DOS, OS/2, Microsoft Windows
-- CR: Commodore machines, Apple II family and Mac OS through version 9
with Ada.Text_IO; use Ada.Text_IO;
procedure Redo_EOLs is
s: String(1..32_768);
l: Natural;
begin
while not End_of_File(Standard_input) loop
Get_Line(s,l);
Put_Line(s(1..l));
end loop;
end Redo_EOLs;
redo_eols <source.txt >dest.txt
and that's it!
HTH
______________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
2007-09-16 5:16 ` Gautier
@ 2007-09-16 18:38 ` Jeffrey R. Carter
2007-09-16 22:15 ` Phaedrus
0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey R. Carter @ 2007-09-16 18:38 UTC (permalink / raw)
Gautier wrote:
> while not End_of_File(Standard_input) loop
> Get_Line(s,l);
> Put_Line(s(1..l));
> end loop;
Even better is
Ada.Text_IO.Put_Line (Item => Ada.Text_IO.Get_Line);
This is Ada 07; Ada-95 users can use PragmARC.Get_Line instead of
Ada.Text_IO.Get_Line; and Ada-83 users can modify PragmARC.Get_Line to
get rid of the hierarchical name.
http://pragmada.home.mchsi.com/
--
Jeff Carter
"Perfidious English mouse-dropping hoarders."
Monty Python & the Holy Grail
10
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
2007-09-16 18:38 ` Jeffrey R. Carter
@ 2007-09-16 22:15 ` Phaedrus
0 siblings, 0 replies; 7+ messages in thread
From: Phaedrus @ 2007-09-16 22:15 UTC (permalink / raw)
Thanks for the ideas, I put together an admittedly-less-elegant solution,
and now those files are back to readable. Kinda makes me wonder how the
distribution could have included the unix version of the files, especially
since they were win32-specific stuff...
I'm not sure I wanna know.
Cheers!
Brian
"Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org> wrote in message
news:vKeHi.105741$Fc.31464@attbi_s21...
> Gautier wrote:
>> while not End_of_File(Standard_input) loop
>> Get_Line(s,l);
>> Put_Line(s(1..l));
>> end loop;
>
> Even better is
>
> Ada.Text_IO.Put_Line (Item => Ada.Text_IO.Get_Line);
>
> This is Ada 07; Ada-95 users can use PragmARC.Get_Line instead of
> Ada.Text_IO.Get_Line; and Ada-83 users can modify PragmARC.Get_Line to get
> rid of the hierarchical name.
>
> http://pragmada.home.mchsi.com/
>
> --
> Jeff Carter
> "Perfidious English mouse-dropping hoarders."
> Monty Python & the Holy Grail
> 10
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Missing CR/LF in Gnat files?
2007-09-15 22:19 Missing CR/LF in Gnat files? Phaedrus
2007-09-15 23:05 ` Sloan.Kohler
@ 2007-09-16 23:00 ` anon
1 sibling, 0 replies; 7+ messages in thread
From: anon @ 2007-09-16 23:00 UTC (permalink / raw)
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
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-09-16 23:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox