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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k36g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Array of Strings Date: Wed, 24 Sep 2008 07:36:43 -0700 (PDT) Organization: http://groups.google.com Message-ID: <42635e0c-4fb0-4076-bdc8-087b5c83cebf@k36g2000pri.googlegroups.com> References: <0e021c61-535a-4935-95ad-2a241fa7302f@e53g2000hsa.googlegroups.com> <2VaCk.356477$yE1.321489@attbi_s21> <5a8cb0df-b16a-45d0-a03e-146ebea83e4d@d77g2000hsb.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1222267003 11632 127.0.0.1 (24 Sep 2008 14:36:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 24 Sep 2008 14:36:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k36g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7809 Date: 2008-09-24T07:36:43-07:00 List-Id: On Sep 24, 5:00 am, jedivaughn wrote: > can anyone show me an example of using this to put string data into > the array and pulling it back out. > > generic > > type Element_Type is (<>); -- everything in the list is of this > type > type range_array is (<>); -- the index of the array if of this > type > > -- ads file of package > package final is > type recd is private; > > private > type listy is array(range_array) of element_type; > type recd is record > str: listy; > str_counter: integer; > where: integer; > end record; > > end final; > > -- adb file of main program > with ada.text_IO, ada.integer_text_IO, final; > > procedure List_package is > subtype int_range is integer range 1..25; > > package list is new final (element_type=> character, > range_array => int_range); > package list2 is new final (element_type => integer, > range_array => int_range); > the : list.recd; > the2 : list2.recd; > begin > > end list_package; > > every time I look for a place on how to do this they are using integer > data. so how do you do it with string data from a file? I don't think you're providing enough details. Presumably, when you're defining your generic package Final, you don't want to define *just* a private type, because you can't do anything with it. You also want your package to define some operations (procedures and functions) on that type. I.e. what is a "recd", from the point of view of some other Ada code outside of Final; and what would you want that code to do a recd if you had one? I'm guessing that if you answer those questions, you'll probably also have the answer to your first question. -- Adam