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=2.9 required=5.0 tests=BAYES_50,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7bf4308ff88deca8,start X-Google-Attributes: gid103376,public From: Matthew Kennedy Subject: How I declare a 'mod' type within a record? Date: 1997/07/30 Message-ID: <33DF3FD2.20D2@mail.connect.usq.edu.au>#1/1 X-Deja-AN: 260555377 Organization: University of Southern Queensland Reply-To: q9522772@mail.connect.usq.edu.au Newsgroups: comp.lang.ada Date: 1997-07-30T00:00:00+00:00 List-Id: Hello all, I'm trying to implement a time-series type to aid in defference equation simulations. I would like to use a 'mod' type which would be an elegant way of cycling around the buffer (which is just an array). Here is my code example, if you could examine it, I would be very grateful :) The compiler (GNAT) has fits when it sees the anonymous mod type declared within the record making use of 'Size' - which is the record parameter. Note, I can't declare 'mod Size' as a sepereate type outside 'time_series' because 'Size' must be part of 'time_series'. Also, I can see how this could be made into a generic package but what I need is multiple time-series of different sizes. with Text_IO; use Text_IO; procedure Aging is type Number is new Float; type Buffer is array(Integer range <>) of Number; type Time_Series(Size : Integer) is record History : Buffer(0..Size-1); Head : mod Size; end record; X : Time_Series(3); begin ... end Aging; Thank you, Matthew -- Matthew Kennedy Student of Electronics Engineering University of Southern Queensland, Australia "When will you realise your already there?" - Marilyn Manson