comp.lang.ada
 help / color / mirror / Atom feed
From: smoneill <Steve O'Neill@mailgw.sanders.lockheed.com>
Subject: Re: Please help a beginner! (second try)
Date: 1996/02/17
Date: 1996-02-17T00:00:00+00:00	[thread overview]
Message-ID: <4g5fr3$74d@news.sanders.lockheed.com> (raw)
In-Reply-To: 4g517q$438@helios.herts.ac.uk

kst1ju@herts.ac.uk (Ryan) wrote:
>Could somebody please help me with what I am sure is a simple
>problem. I need to do some basic text and integer IO.

The problem is simple.  While you probably have all of the following
in a single file it is actually 3 compilation units (the instantiation
of Integer_IO, proc1 and main).  To gain visibility to the services
provided by Text_IO each of these units must import (with) the Text_IO
package.  IOW, proc1 and main must each 'with' Text_IO and Int_IO.

>with TEXT_IO;
>package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER);

--end of compilation unit INT_IO

with Text_IO;
>with INT_IO;
>procedure proc1 is
>begin
>  TEXT_IO.PUT("Hello");
>  INT_IO.PUT(2);         
>end proc1;

-- end of compilation unit proc1

with Text_IO;
with Int_IO;
>procedure main is
>begin
>  TEXT_IO.PUT("Hello");
>  INT_IO.PUT(2);         
>end main;


This will noew work fine.  BTW, DEC Ada supplies a version of Integer_IO
pre-instantiated for you.  It's called Integer_Text_IO.  Nothing special
about it, it just saves you from instantiating Integer_IO.  Just remove
the instantiation of INT_IO and change the references to Integer_Text_IO.

>	Thanks,

Glad to be of help.

-- 
Steve O'Neill                      | "No,no,no, don't tug on that!
Sanders, A Lockheed Martin Company |  You never know what it might
smoneill@sanders.lockheed.com      |  be attached to." 
(603) 885-8774  fax: (603) 885-4071|    Buckaroo Banzai






  reply	other threads:[~1996-02-17  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-17  0:00 Please help a beginner! (second try) Ryan
1996-02-17  0:00 ` smoneill [this message]
1996-02-17  0:00   ` Robert Dewar
1996-02-18  0:00 ` Steve Doiel
1996-02-18  0:00   ` Robert Dewar
1996-02-19  0:00 ` Arthur Evans Jr
replies disabled

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