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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,8077d2e20cde67b1 X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: Modular types inside records Date: 2000/10/21 Message-ID: <39F1C21D.4E0AF2DB@acm.org>#1/1 X-Deja-AN: 684177828 Content-Transfer-Encoding: 8bit References: <8FD47616EPablo@213.25.200.9> <8ss7fb$5c7$1@nnrp1.deja.com> <8FD4BD4F4Pablo@213.25.200.9> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 972145190 158.252.122.148 (Sat, 21 Oct 2000 09:19:50 PDT) Organization: EarthLink Inc. -- http://www.EarthLink.net MIME-Version: 1.0 NNTP-Posting-Date: Sat, 21 Oct 2000 09:19:50 PDT Newsgroups: comp.lang.ada Date: 2000-10-21T00:00:00+00:00 List-Id: "Pawe� Niewiadomski" wrote: > generic > type item_type is private; > type mod_n_max is mod <>; > package queues is > type queue is tagged private; > function empty (q: queue) return boolean; > function full (q: queue) return boolean; > procedure add (q: queue; item: in item_type); > procedure remove (q: queue; item: out item_type); > private > type arr is array (natural range <>) of item_type; > procedure move_to_0 (var: out natural); > procedure move_to_last (var: out natural; values: in arr); > > type queue is tagged record > values: arr (0..mod_n_max'modulus-1); > tail: mod_n_max:=0; > head: mod_n_max:=1; > end record; > end queues; As you have probably found out, this won't work very well, since your array is indexed by Natural and your index variables are Mod_N_Max. You can put a bunch of type conversions in your code to work around this, but it would be clearer to define type Arr is array (Mod_N_Max) of Item_Type; I have no idea why you have included the procedures Move_To_0 and Move_To_Last in the private part. -- Jeff Carter "I waggle my private parts at your aunties." Monty Python & the Holy Grail