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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,334ea3c211604808 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!q40g2000cwq.googlegroups.com!not-for-mail From: "Ant" Newsgroups: comp.lang.ada Subject: Re: Rename Problem Date: 6 Mar 2007 13:50:13 -0800 Organization: http://groups.google.com Message-ID: <1173217813.885292.192700@q40g2000cwq.googlegroups.com> References: <1173197839.773371.261080@q40g2000cwq.googlegroups.com> <1173200030.11841.82.camel@localhost> NNTP-Posting-Host: 130.76.64.15 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1173217820 9240 127.0.0.1 (6 Mar 2007 21:50:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Mar 2007 21:50:20 +0000 (UTC) In-Reply-To: <1173200030.11841.82.camel@localhost> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Boeing Kit; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q40g2000cwq.googlegroups.com; posting-host=130.76.64.15; posting-account=B4zGkw0AAAAIi-J8D2N3xLlLmCL1a4Ce Xref: g2news2.google.com comp.lang.ada:9732 Date: 2007-03-06T13:50:13-08:00 List-Id: On Mar 6, 9:53 am, Georg Bauhaus wrote: > On Tue, 2007-03-06 at 08:17 -0800, Ant wrote: > > I am trying to rename an array component, but no luck. Is this > > possible or am I just doing something wrong? > > > TYPE message_array IS ARRAY (index) OF signals_record; > > msg : message_array; > > > PACKAGE m1 IS NEW transmit_message (id, type); > > ^^^^ > "type" is an Ada keyword. What is transmit_message? > > > msg (1) : signals RENAMES m1.signals_record; > > ^^^^^^^^^^^^^^^^^ > This is probably a type, if signals_record from above is a type. > > If you want to rename a component of msg, msg (1) say, > then the renamed thing is an object. In this case it is > of type signals_record. Not easy to tell without seeing > some more source, preferably compilable. > > ... : signals_record RENAMES msg (1); This test procedure should compile. Sorry for the laziness. PROCEDURE test IS ------------------------------------------- GENERIC -- receive message -- id : integer; TYPE message_type IS PRIVATE; PACKAGE transmit_message IS PROCEDURE write; END transmit_message; ------------------------------------------- ----------------------------------------------------------------------------- PACKAGE BODY transmit_message IS PROCEDURE write IS BEGIN null; END write; END transmit_message; ----------------------------------------------------------------------------- ------------------------------------------- TYPE signals_record IS RECORD data1 : boolean; data2 : boolean; END RECORD; FOR signals_record USE RECORD data1 AT 0 RANGE 0 .. 15; data2 AT 0 RANGE 16 .. 31; END RECORD; ------------------------------------------- SUBTYPE msg_count IS integer RANGE 1 .. 4; TYPE message_array IS ARRAY (msg_count) OF signals_record; msg : message_array; id : integer := 1; PACKAGE m1 IS NEW transmit_message (id, signals_record); msg (1) : signals RENAMES m1.signals_record; END test;