comp.lang.ada
 help / color / mirror / Atom feed
From: beidler@guinness.cs.uofs.edu (Jack Beidler)
Subject: Generic Child Packages
Date: 25 Oct 1994 19:32:40 GMT
Date: 1994-10-25T19:32:40+00:00	[thread overview]
Message-ID: <38jmgo$3f5@gopher.cs.uofs.edu> (raw)

I have been working, with some success with gnat 1.83 on both
a UNIX and an MS-DOS environment.  I've encountered a little
problem with generic child packages.  I've tried the usual
solutions (a la Barnes p439) to no avail.  I'm wondering
if anyone has had success instantiating a generic child package
with gnat 1.83, or might have an idea that overcomes my current
block.

The example is as follows:  I decided to begin with an Ada83
package and break it up into a parent and two child units.
The parent is called stack_pt_lpt (stacks are instantiated with
a private type and stack_type is made visible as a limited
private type).  The Ada83 version of this package works perfectly
under gnat 1.83.  The new version is stack_pt_lpt (contains
only pure stack support), stack_pt_lpt.advanced (contains peek,
poke, and other "non pure" features, and stack_pt_lpt.iterators
(contains two iterators called bottom_up and top_down).  All
three have been successfully "compiled" in gnat (i.e. the ".o"
files were formed).

The question is: how does one instantiate the child units in 
gnat 1.83?  Such obvious replys, like separate instantiation
outside of a procedure, e.g. the old classical

      with text_io;
      package iio is new text_io.integer_io(integer);

(which by the way does not work with gnat 1.83) does not work
in gnat 1.83 for inclusion in the library, but will work in
a procedure (program).

with text_io, Stack_Pt_Lpt.Iterators;

procedure xcxrev is

package tio renames text_io;
-- if the following instantiates the "parent" stack package
-- which it does in gnat 1.83
package Stk is new Stack_Pt_Lpt (character);
-- fill in the blanks to instantiate the the iterators child unit

package ___________________ is new __________________________;

Buffer: string (1..255);
B_Size: natural;
          . . . --rest of procedure

end xcxrev;

Postscript: I just recieved the following from Brad Balfour about 
this problem.
>  Jack,
>  
>    I just look at my bug submissions for Gnat and found that I had reported a 
>  different error message bug for the same feature in v.1.80 in June. I just 
>  received a note last week that the bug (assigned to comar with tracking number 
>  [0614-001]) is fixed in 1.84. You might want to forward our last two notes to 
>  gnat-report@cs.nyu.edu and ask them to verify that this will now work under 
>  1.84. 
>  
>  Brad   
-- 
+----------------------------------------+------------------------+
|John (Jack) Beidler                    ++   beidler@cs.uofs.edu  |
|  Professor, Computing Sciences Dept. ++                         |
|  University of Scranton             ++  (717) 941-7446 (voice)  |
| Scranton, PA 18510                 ++     (717) 941-4250 (FAX)  |
+------------------------------------+----------------------------+



             reply	other threads:[~1994-10-25 19:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-25 19:32 Jack Beidler [this message]
1994-10-26  0:05 ` Generic Child Packages Robert Dewar
replies disabled

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