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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ca20ac98709f9b4a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!8g2000hse.googlegroups.com!not-for-mail From: jedivaughn Newsgroups: comp.lang.ada Subject: Re: Array of Strings Date: Sun, 28 Sep 2008 05:24:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0faf40a8-aac2-42ed-a536-1cc5a9c5d819@8g2000hse.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: 69.89.188.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1222604652 1395 127.0.0.1 (28 Sep 2008 12:24:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 28 Sep 2008 12:24:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 8g2000hse.googlegroups.com; posting-host=69.89.188.29; posting-account=X-qixgoAAABoVi_eyPVjiIWnxAlQQdU1 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2116 Date: 2008-09-28T05:24:11-07:00 List-Id: This is going to be a long post but hopefully I'll make myself clearer this time. I finally got everything set up in my package and it works just fine. however one of the operations that I'm trying to do on the package is an append. after appending to the list I want to make sure the list is still in order. so I have to make comparisons with the < or > operators. however, ada give's me the error: "final.adb:22:34: there is no applicable operator ">" for private type "Element_Type" defined at final.ads:3." Here is my package's .ads file generic type Element_Type is private; -- everything in the list is of this type type range_array is (<>); -- the index of the array is of this type package final is type recd is tagged private; function construct return recd; procedure append (inthe : in out recd; char : in element_type); procedure insert (inthe : in out recd; char : in element_type); procedure remove (inthe : in out recd; char : in element_type); function get_next(lst: in recd) return element_type; where: integer := 0; private type listy is array(range_array) of element_type; type recd is tagged record str: listy; str_counter: range_array; order : boolean := true; end record; end final; my package's .adb file with ada.text_IO, ada.integer_text_IO; package body final is function construct return recd is inthe:recd; begin inthe.str_counter := range_array'first; where := 0; return inthe; end construct; procedure append (inthe : in out recd; char : in element_type) is i : integer := 1; begin inthe.str(inthe.str_counter) := char; inthe.str_counter := range_array'succ(inthe.str_counter); if inthe.str_counter = range_array'val(1) then null; else loopy: for i in range_array'val(1)..inthe.str_counter loop if (inthe.str(i)) > (inthe.str(i)) then inthe.order := false; exit loopy; end if; end loop loopy; end if; end append; procedure insert (inthe : in out recd; char : in element_type) is temp : element_type; where2 : range_array; begin where2 := range_array'first; if inthe.order = true then if inthe.str_counter <= where2 then null; else loopy : for i in range_array'val(1)..inthe.str_counter loop if (inthe.str(where2)) < (inthe.str(range_array'succ(where2))) then temp := inthe.str(where2); inthe.str(where2) := inthe.str(range_array'succ(where2)); inthe.str(range_array'succ(where2)) := temp; end if; where2 := range_array'succ(where2); end loop loopy; end if; end if; end insert; procedure remove (inthe : in out recd; char : in element_type) is begin null; end remove; function get_next(lst: in recd) return element_type is begin where := where + 1; return lst.str(range_array'val(where)); end get_next; end final; and my my_main program's .adb with ada.text_IO, ada.integer_text_IO, final; procedure List_package is subtype int_range is integer range 1..25; subtype str_range is integer range 1..5; subtype str25 is string (1..5); package list is new final (element_type=>str25, range_array => str_range); package list2 is new final (element_type => integer, range_array => int_range); the : list.recd; the2 : list2.recd; procedure iny is filbert : ada.text_IO.file_type; char : integer; begin the2 := list2.construct; ada.text_IO.open(filbert, ada.text_IO.in_file, "intdata.txt"); ada.integer_text_IO.get(file => filbert, item => char); list2.append(the2,char); ada.integer_text_IO.get(file => filbert, item => char); list2.append(the2,char); ada.integer_text_IO.put(list2.get_next(the2)); ada.integer_text_IO.put(list2.get_next(the2)); ada.text_IO.new_line; ada.text_IO.close(filbert); end iny; procedure sny is filbert : ada.text_IO.file_type; char : string (1..5); widy : integer := 5; begin the := list.construct; ada.text_IO.open(filbert, ada.text_IO.in_file, "strdata.txt"); ada.text_IO.get_line(file => filbert, item => char, last => widy); list.append(the,char); ada.text_IO.put(list.get_next(the)); ada.text_IO.close(filbert); end sny; begin iny; sny; end list_package; can anyone tell me why I don't have the basic operators for my generic list? and also how do I get them. this seems like a very important part of all data types. Thanks, John