From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.174.228 with SMTP id bv4mr5491430pac.148.1475943678013; Sat, 08 Oct 2016 09:21:18 -0700 (PDT) X-Received: by 10.157.51.3 with SMTP id f3mr2558364otc.4.1475943677965; Sat, 08 Oct 2016 09:21:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!l13no1247385itl.0!news-out.google.com!203ni3761itk.0!nntp.google.com!o19no1254347ito.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 8 Oct 2016 09:21:17 -0700 (PDT) In-Reply-To: <9cbda86b-57e3-4f9c-81bb-03a9a28a4cb6@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.218.37.33; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.218.37.33 References: <9cbda86b-57e3-4f9c-81bb-03a9a28a4cb6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Using generic package to store and retrieve string data From: Stephen Leake Injection-Date: Sat, 08 Oct 2016 16:21:17 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:32054 Date: 2016-10-08T09:21:17-07:00 List-Id: 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;