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 X-Google-Thread: 103376,499373c5a06cccc1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-16 08:59:50 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: ganesh.ramasivan@gdcanada.com (Ganesh Ramasivan) Newsgroups: comp.lang.ada Subject: Re: Variant records.. Date: 16 Feb 2004 08:59:50 -0800 Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 209.47.1.92 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1076950790 1072 127.0.0.1 (16 Feb 2004 16:59:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 16 Feb 2004 16:59:50 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:5605 Date: 2004-02-16T08:59:50-08:00 List-Id: Preben Randhol wrote in message news:... > On 2004-02-15, Ganesh Ramasivan wrote: > > In the following example, how would i forbid the user of data type Foo > > from specifying the following: > > > > John : Foo(Vehicle => MAN, Power => AUTOMATIC); > > > > ie. is there a way to restrict the user from specifying certain types > > as variants? > > I guess this is homework? If it is why don't you simply try to do this > and see what happens? Okay.. I should probably have been a bit more realistic.. I am new to ada but this is no homework assignment. type RADAR_TYPE_CHOICE is (RADAR_A, RADAR_B, RADAR_C); type RADAR_A_COMMAND_CHOICE is (RADAR_A_STATE, RADAR_A_MODE, RADAR_A_DISPLAY_RANGE_SELECT); type RADAR_B_COMMAND_CHOICE is (RADAR_B_STATE, RADAR_B_MODE, RADAR_B_DISPLAY_RANGE_SELECT); type RADAR_C_COMMAND_CHOICE is (RADAR_C_STATE, RADAR_C_MODE, RADAR_C_DISPLAY_RANGE_SELECT); type RADAR_CHOICE(RADAR_TYPE : RADAR_TYPE_CHOICE := RADAR_TYPE_CHOICE'FIRST) is record case RADAR_TYPE is when RADAR_A => null; when RADAR_B => null; when RADAR_C => null; end case; end record; How would I specify a variant record which will only allow me to select RADAR_A for the RADAR_TYPE_CHOICE and RADAR_A_STATE for the command choice but not RADAR_C_STATE?