comp.lang.ada
 help / color / mirror / Atom feed
* Re: Newbe compile problems
  1996-12-15  0:00 James Amendolagine
  1996-12-15  0:00 ` Robert Dewar
@ 1996-12-15  0:00 ` Tom Moran
  1996-12-16  0:00 ` Richard Curnow
  1996-12-17  0:00 ` David Wheeler
  3 siblings, 0 replies; 14+ messages in thread
From: Tom Moran @ 1996-12-15  0:00 UTC (permalink / raw)



Like it says, a real literal cannot end with a period.
Instead of "7.;", try "7.0;"




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-15  0:00 James Amendolagine
@ 1996-12-15  0:00 ` Robert Dewar
  1996-12-15  0:00 ` Tom Moran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1996-12-15  0:00 UTC (permalink / raw)



iJamie asks about the error message

"think.adb:7:14: real literal cannot end with point"

and what this means is that real literals cannot end with a point (i.e
the string 3. is not a legal real literal). I don't see how much clearer
the error message could be!





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Newbe compile problems
@ 1996-12-15  0:00 James Amendolagine
  1996-12-15  0:00 ` Robert Dewar
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: James Amendolagine @ 1996-12-15  0:00 UTC (permalink / raw)



Hello,

   I am just starting with ADA. I am going through the ADA turorial, and
can't get some source code to compile. Here's the source:

 with Float_Text_IO;
 use Float_Text_IO;
 procedure Think is
   A, B : Float := 0.0; -- A and B initially zero; note the period.
   I, J : Integer := 1;
 begin
   A := B + 7.;
   I := J * 3;
   B := Float(I) + A;
   Put(B);
 end Think;

And the error message:

cd /home/jamie/learnAda/think/
gnatmake think.adb 
gcc -c think.adb
think.adb:7:14: real literal cannot end with point
gnatmake: "think.adb" compilation error
Compilation exited abnormally with code 2 at Sun Dec 15 09:34:00

I am using Redhat Linux. With gnat-3.07. --Other examples like "hello
world" compiled OK. Solutions?
Thanks in advance.

    Jamie




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
@ 1996-12-16  0:00 Jamie Amendolagine
  1996-12-17  0:00 ` Robert Dewar
  1996-12-19  0:00 ` David Wheeler
  0 siblings, 2 replies; 14+ messages in thread
From: Jamie Amendolagine @ 1996-12-16  0:00 UTC (permalink / raw)



Sorry, I sent the wrong error. Here's the real source and error:

 with Float_Text_IO;
 use Float_Text_IO;
 procedure Think is
   A, B : Float := 0.0; -- A and B initially zero; note the period.
   I, J : Integer := 1;
 begin
   A := B + 7.0;
   I := J * 3;
   B := Float(I) + A;
   Put(B);
 end Think;

cd /home/jamie/learnAda/think/
gnatmake think.adb 
gcc -c think.adb
think.adb:1:07: file "float_text_io.ads" not found
compilation abandoned
gnatmake: "think.adb" compilation error
Compilation exited abnormally with code 2 at Sun Dec 15 09:44:55

Actualy I ended up fixing this myself. I've switched to a more recient
turorial with examples which are compiling--so far.  In any event I'll
keep my newbe questions to myself. 


Jamie




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-15  0:00 James Amendolagine
  1996-12-15  0:00 ` Robert Dewar
  1996-12-15  0:00 ` Tom Moran
@ 1996-12-16  0:00 ` Richard Curnow
  1996-12-17  0:00 ` David Wheeler
  3 siblings, 0 replies; 14+ messages in thread
From: Richard Curnow @ 1996-12-16  0:00 UTC (permalink / raw)



James Amendolagine <uq274@freenet.victoria.bc.ca> writes:

> 
>  with Float_Text_IO;
>  use Float_Text_IO;
>  procedure Think is
>    A, B : Float := 0.0; -- A and B initially zero; note the period.
>    I, J : Integer := 1;
>  begin
>    A := B + 7.;       <<<<<<<<<<<< NEEDS TO BE 7.0 not 7.
>    I := J * 3;
>    B := Float(I) + A;
>    Put(B);
>  end Think;
> 
> And the error message:
> 
> cd /home/jamie/learnAda/think/
> gnatmake think.adb 
> gcc -c think.adb
> think.adb:7:14: real literal cannot end with point

When I made the change to the line after 'begin', it worked fine (except
I had to comment out the with, use and Put lines because I didn't have
that package visible).  This was with gnat 3.04 on Linux.

-- 
Richard P. Curnow
Stevenage, England




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-16  0:00 Newbe compile problems Jamie Amendolagine
@ 1996-12-17  0:00 ` Robert Dewar
  1996-12-19  0:00 ` David Wheeler
  1 sibling, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1996-12-17  0:00 UTC (permalink / raw)



Jamie asks about another plainly illegal program

 with Float_Text_IO;
 use Float_Text_IO;
 procedure Think is
   A, B : Float := 0.0; -- A and B initially zero; note the period.
   I, J : Integer := 1;
 begin
   A := B + 7.0;
   I := J * 3;
   B := Float(I) + A;
   Put(B);
 end Think;

Certainly you cannot expect GNAT or any other compiler to compile this
if you do not supply the package Float_Text_IO (there is no standard
package of this name).

You need to get a text book that clearly decsribes Ada 95, and thus
corresponds with the compiler you are using (which is GNAT in this case).

In general people seem to make a lot of trouble for themselves by not
having a coherent and relevant text and documentation. In the case of GNAT,
you need an Ada 95 text book and gnatinfo.txt (or with GNAT v3.07, the
GNAT manuals).





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-15  0:00 James Amendolagine
                   ` (2 preceding siblings ...)
  1996-12-16  0:00 ` Richard Curnow
@ 1996-12-17  0:00 ` David Wheeler
  1996-12-19  0:00   ` Jesse E. Smith
  3 siblings, 1 reply; 14+ messages in thread
From: David Wheeler @ 1996-12-17  0:00 UTC (permalink / raw)



James Amendolagine (uq274@freenet.victoria.bc.ca) wrote:
: Hello,

:    I am just starting with ADA. I am going through the ADA turorial, and
: can't get some source code to compile.

You should note which tutorial you mean, Lovelace in this case, and the
section (6.1 in this case).  As the author of Lovelace I happen to like
the ring of "THE Ada tutorial", but that will simply confuse most people.

The basic problem is that you are using a VERY old version of Lovelace.
As Robert Dewar has pointed out, the line:
:    A := B + 7.;
should say:
:    A := B + 7.0;

This was fixed a long time ago.  The simple solution is to use the
most recent version of Lovelace, which is at:
  http://www.adahome.com/Tutorials/lovelace/lovelace.htm

There's another error in the sample code you posted -
"Float_Text_IO" should say "Ada.Float_Text_IO".  That may be a
scribing error, I don't remember that ever being an error in Lovelace.

Robert Dewar said:
>You need to get a text book that clearly decsribes Ada 95, and thus
>corresponds with the compiler you are using (which is GNAT in this case).

I agree, and I hasten to add that you need the CURRENT version
of the work.  GNAT 2.07 has many bugs compared to GNAT 3.07,
and Lovelace has improved over time as well.

Lovelace is being converted into a book, and when it becomes available
you probably ought to buy a copy. The book has been professionally edited and
will let you flip right to the pages you're interested in.


--- David A. Wheeler
    dwheeler@ida.org





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
@ 1996-12-18  0:00 Sazonov Cyril
  1996-12-19  0:00 ` Robert Dewar
  1996-12-19  0:00 ` Keith Thompson
  0 siblings, 2 replies; 14+ messages in thread
From: Sazonov Cyril @ 1996-12-18  0:00 UTC (permalink / raw)



>From cyril Wed Dec 18 10:15:50 WET 1996
>> Sorry, I sent the wrong error. Here's the real source and error:
>>
>> with Float_Text_IO;
>>  use Float_Text_IO;
>> procedure Think is
>>   A, B : Float := 0.0; -- A and B initially zero; note the period.
>>   I, J : Integer := 1;
>> begin
>>   A := B + 7.0;
>>   I := J * 3;
>>   B := Float(I) + A;
>>   Put(B);
>> end Think;
>>
>> cd /home/jamie/learnAda/think/
>> gnatmake think.adb
>> gcc -c think.adb
>> think.adb:1:07: file "float_text_io.ads" not found
>> compilation abandoned
>> gnatmake: "think.adb" compilation error
>> Compilation exited abnormally with code 2 at Sun Dec 15 09:44:55
>>
>> Actualy I ended up fixing this myself. I've switched to a more recient
>> turorial with examples which are compiling--so far.  In any event I'll
>> keep my newbe questions to myself.
>>
>>Jamie

As for me I've found two places where may be errors:

#1 >> with Float_Text_IO;

Are you sure that this package exists? The standard package is called
TEXT_IO.FLOAT_IO.

Or if the IO package is of your own, then check whether its has been compiled
_before_ you're trying to compile your sample.

#2 >>  A, B : FLOAT := 0.0;

This may an error too, the thing is that decimal IS NOT a sign of a FLOAT-type
constant, it is a sign of a FIXED-type constant. The FLOAT-type constant
should be written so 12.34E56, it IS to have a power_of_ten postfix. This
detail is mentioned in the LRM ( I've got the Ada83 one only ).

Best wishes from Russia!                                      Cyril Sazonov





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-16  0:00 Newbe compile problems Jamie Amendolagine
  1996-12-17  0:00 ` Robert Dewar
@ 1996-12-19  0:00 ` David Wheeler
  1996-12-19  0:00   ` Larry Kilgallen
  1 sibling, 1 reply; 14+ messages in thread
From: David Wheeler @ 1996-12-19  0:00 UTC (permalink / raw)



Jamie Amendolagine (uq274@freenet.victoria.bc.ca) wrote:
: Sorry, I sent the wrong error. Here's the real source and error:

: Actualy I ended up fixing this myself. I've switched to a more recient
: turorial with examples which are compiling--so far.  In any event I'll
: keep my newbe questions to myself. 

No need for THAT!  Answering questions from new users is one of the reasons for
this newsgroup.

Hopefully you ended up with the information you needed:
1. Why your code wasn't working (a package name error and missing "0");
2. How to keep it from happening again (use the latest tutorial).


--- David A. Wheeler
    dwheeler@ida.org





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-19  0:00 ` David Wheeler
@ 1996-12-19  0:00   ` Larry Kilgallen
  0 siblings, 0 replies; 14+ messages in thread
From: Larry Kilgallen @ 1996-12-19  0:00 UTC (permalink / raw)



In article <59c3p7$svn@news.ida.org>, wheeler@aphrodite (David Wheeler) writes:
> Jamie Amendolagine (uq274@freenet.victoria.bc.ca) wrote:
> : Sorry, I sent the wrong error. Here's the real source and error:
> 
> : Actualy I ended up fixing this myself. I've switched to a more recient
> : turorial with examples which are compiling--so far.  In any event I'll
> : keep my newbe questions to myself. 
> 
> No need for THAT!  Answering questions from new users is one of the reasons for
> this newsgroup.
> 
> Hopefully you ended up with the information you needed:
> 1. Why your code wasn't working (a package name error and missing "0");
> 2. How to keep it from happening again (use the latest tutorial).

And the authors of some of the fine tools which are available learned
that some of the communications mechanisms regarding new versions do
not always work.  Twenty years ago these people would have gotten very
little feedback regarding their printed books !

Larry Kilgallen




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-18  0:00 Sazonov Cyril
@ 1996-12-19  0:00 ` Robert Dewar
  1996-12-19  0:00 ` Keith Thompson
  1 sibling, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1996-12-19  0:00 UTC (permalink / raw)



Cyril said

"#1 >> with Float_Text_IO;

Are you sure that this package exists? The standard package is called
TEXT_IO.FLOAT_IO.

Or if the IO package is of your own, then check whether its has been compiled
_before_ you're trying to compile your sample.

#2 >>  A, B : FLOAT := 0.0;

This may an error too, the thing is that decimal IS NOT a sign of a FLOAT-type
constant, it is a sign of a FIXED-type constant. The FLOAT-type constant
should be written so 12.34E56, it IS to have a power_of_ten postfix. This
detail is mentioned in the LRM ( I've got the Ada83 one only )."



Both points are quite wrong, even for Ada 83. There is no package
Text_IO.Float_IO in either Ada 83 or Ada 95 (this is a generic package,
not a package), and in any case, surely since the questioner is using
Ada 95, we should suggest the proper package name Ada.Float_Text_IO.

For the second point, 0.0 is of course a legal float literal, I am not
quite sure what leads to this misconception.

Finally Cyril, why not get hold of GNAT so that you have access to Ada 95.
You might want to contact Sergey Rybin at Moscow State University for
information on how to obtain GNAT (he certainly has appropriate internet
connections available there, and could perhaps supply a copy to you).





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-18  0:00 Sazonov Cyril
  1996-12-19  0:00 ` Robert Dewar
@ 1996-12-19  0:00 ` Keith Thompson
  1 sibling, 0 replies; 14+ messages in thread
From: Keith Thompson @ 1996-12-19  0:00 UTC (permalink / raw)



In <AAlsyjoyZ4@geol.spb.su> Sazonov Cyril <cyril@geol.spb.su> writes:
[...]
> As for me I've found two places where may be errors:
> 
> #1 >> with Float_Text_IO;
> 
> Are you sure that this package exists? The standard package is called
> TEXT_IO.FLOAT_IO.

Text_IO.Float_IO is a generic package, not a package.  Float_Text_IO
should be Ada.Float_Text_IO, a predefined instantiation of
Ada.Text_IO.Float_IO for type Float (this is new to Ada 95).

(Incidentally, at least one Ada 83 compiler, RISCAda, provides a similar
implementation-defined pre-instantiation called Float_Text_IO.)

> Or if the IO package is of your own, then check whether its has been compiled
> _before_ you're trying to compile your sample.
> 
> #2 >>  A, B : FLOAT := 0.0;
> 
> This may an error too, the thing is that decimal IS NOT a sign of a FLOAT-type
> constant, it is a sign of a FIXED-type constant. The FLOAT-type constant
> should be written so 12.34E56, it IS to have a power_of_ten postfix. This
> detail is mentioned in the LRM ( I've got the Ada83 one only ).

No, that's incorrect.  Ada doesn't have floating-point or fixed-point
literals; it has real literals, which are of type universal_real.
The decimal point is mandatory; the exponent part is optional.  A real
literal like 0.0 or 12.34E56 can be implicitly converted to any real
(floating-point or fixed-point) type.  Less precisely, floating-point
and fixed-point literals have identical syntax.

One possible source of confusion here is that Ada 95 allows a relaxed
syntax (relative to Ada 83) for real literals on input.  For example,
Float_Text_IO.Get or Float'Value will accept any of "0.0", "0.", ".0", or
"0".  This relaxed syntax applies only to input, not to literals in Ada
source programs.

-- 
Keith Thompson (The_Other_Keith) kst@aonix.com <http://www.aonix.com> <*>
TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706
"SPOON!" -- The Tick




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
  1996-12-17  0:00 ` David Wheeler
@ 1996-12-19  0:00   ` Jesse E. Smith
  0 siblings, 0 replies; 14+ messages in thread
From: Jesse E. Smith @ 1996-12-19  0:00 UTC (permalink / raw)



David Wheeler wrote:
... 
> This was fixed a long time ago.  The simple solution is to use the
> most recent version of Lovelace, which is at:
>   http://www.adahome.com/Tutorials/lovelace/lovelace.htm
...

I think you mean http://www.adahome.com/Tutorials/Lovelace/lovelace.htm
(with a capital L in directory "Lovelace".

Jesse




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Newbe compile problems
@ 1996-12-24  0:00 Sazonov Cyril
  0 siblings, 0 replies; 14+ messages in thread
From: Sazonov Cyril @ 1996-12-24  0:00 UTC (permalink / raw)



Robert wrote me:

> Both points are quite wrong, even for Ada 83. There is no package
> Text_IO.Float_IO in either Ada 83 or Ada 95 (this is a generic package,
> not a package), and in any case, surely since the questioner is using
> Ada 95, we should suggest the proper package name Ada.Float_Text_IO.

I see. But I meant that one should use the generic package to create his own
example for the data type he is using. The thing is that all the Ada compilers
I've got were, not to say a bad words, a little bit strange... There were no
such usefull extensions based on the standard packages. At any rate the
package you mean, as I understood you, should be referenced with prefix "Ada."

> For the second point, 0.0 is of course a legal float literal, I am not
> quite sure what leads to this misconception.

Yes, it was my mistake, there's no nessesety to use exponential notation. But
somewhere ( at Wegner's  description of the preliminary version of the language
may be ? ) I've seen stressed difference betwean the notation of the FLOAT and
FIXED literals. At any rate I suppose the use of the exponetial part for the
FLOAT literals is a good style.

> Finally Cyril, why not get hold of GNAT so that you have access to Ada 95.
> you might want to contact Sergey Rybin at Moscow State University for
> information on how to obtain GNAT (he certainly has appropriate internet
> connections available there, and could perhaps supply a copy to you).

It is a very good idea. I hoped to find some Ada users in Russia, but just 2
months ago I had no access to the Internet mail ( mind that Russia is a very
peculiar country, where ones who work have nothing, just no instruments ) and
so had no means to look for them -- FIDOnet doesn't help in it, and my old
cheif supposed that The Way is C & DOS & Windows ;(

Robert, wouldn't you be so kind to tell me the E-mail of Sergey Rybin?

Merry X-mas !

Best wishes from Russia !                                      Cyril ( CS )




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1996-12-24  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-16  0:00 Newbe compile problems Jamie Amendolagine
1996-12-17  0:00 ` Robert Dewar
1996-12-19  0:00 ` David Wheeler
1996-12-19  0:00   ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1996-12-24  0:00 Sazonov Cyril
1996-12-18  0:00 Sazonov Cyril
1996-12-19  0:00 ` Robert Dewar
1996-12-19  0:00 ` Keith Thompson
1996-12-15  0:00 James Amendolagine
1996-12-15  0:00 ` Robert Dewar
1996-12-15  0:00 ` Tom Moran
1996-12-16  0:00 ` Richard Curnow
1996-12-17  0:00 ` David Wheeler
1996-12-19  0:00   ` Jesse E. Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox