From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Using generic package to store and retrieve string data
Date: Sat, 8 Oct 2016 09:21:17 -0700 (PDT)
Date: 2016-10-08T09:21:17-07:00 [thread overview]
Message-ID: <f1024468-4ebe-4b71-a571-e7de24f3f6cc@googlegroups.com> (raw)
In-Reply-To: <9cbda86b-57e3-4f9c-81bb-03a9a28a4cb6@googlegroups.com>
On Friday, October 7, 2016 at 4:30:27 PM UTC-5, James Brewer wrote:
> Hey guys, I am trying to create a generic package that will take strings of a
> fixed length store them in an array one at a time and later remove them one
> at a time. I was using a generic stack example I found on the net to get
> started but I can't seem to get it to work for string data.
You did not show your instantiation of this, so I can't say what your problem might be.
Here is an instantiation that works:
with Ada.Text_Io; use Ada.Text_Io;
with Generic_Stack;
procedure Stack_Main
is
subtype String_10 is String (1 .. 10);
package Stack is new Generic_Stack
(Size => 10,
Item => String_10);
Popped : String_10;
begin
Put_Line ("Push '0123456789'");
Stack.Push ("0123456789");
Put_Line ("Push 'Hello.....'");
Stack.Push ("Hello.....");
Stack.Pop (Popped);
Put_Line ("Popped: '" & Popped & "'");
Stack.Pop (Popped);
Put_Line ("Popped: '" & Popped & "'");
end Stack_Main;
prev parent reply other threads:[~2016-10-08 16:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 21:30 Using generic package to store and retrieve string data James Brewer
2016-10-07 23:11 ` Jeffrey R. Carter
2016-10-08 7:42 ` Dmitry A. Kazakov
2016-10-08 9:01 ` Simon Wright
2016-10-08 10:17 ` Dmitry A. Kazakov
2016-10-08 16:07 ` Jeffrey R. Carter
2016-10-08 16:21 ` Stephen Leake [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox