comp.lang.ada
 help / color / mirror / Atom feed
* Generic Child Packages
@ 1994-10-25 19:32 Jack Beidler
  1994-10-26  0:05 ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: Jack Beidler @ 1994-10-25 19:32 UTC (permalink / 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)  |
+------------------------------------+----------------------------+



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

* Re: Generic Child Packages
  1994-10-25 19:32 Generic Child Packages Jack Beidler
@ 1994-10-26  0:05 ` Robert Dewar
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1994-10-26  0:05 UTC (permalink / raw)


instantiation of library units works fine in GNAT, so I don't quite 
know what that comment was about. they are of course separate
compilation units, and so must be submitted on their own in a file
if you are not using gnatchop.




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

end of thread, other threads:[~1994-10-26  0:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-10-25 19:32 Generic Child Packages Jack Beidler
1994-10-26  0:05 ` Robert Dewar

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