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-17 06:56: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: 17 Feb 2004 06:56: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 1077029810 24455 127.0.0.1 (17 Feb 2004 14:56:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 17 Feb 2004 14:56:50 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:5635 Date: 2004-02-17T06:56:50-08:00 List-Id: Simon Wright wrote in message news:... > ganesh.ramasivan@gdcanada.com (Ganesh Ramasivan) writes: > > > 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); > > I would say you seem to have a basic concept Radar with a set of > Commands that might apply to any Radar, and three instances of Radar. > > type Radar_Kind is (Radar_A, Radar_B, Radar_C); > type Radar_Command is (State, Mode, Display_Range_Select); > > I can see that you might have different sets of states for Radar_A > than those for Radar_B, but so far your code doesn't say that. > > > 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? > > I don't see any command choice here? > > I don't really grasp why you want this Radar_Choice thing, perhaps it > would help if you could say what you would like to appear in the > places you've marked 'null' ... is it > > type RADAR_CHOICE > (RADAR_TYPE : RADAR_TYPE_CHOICE := RADAR_TYPE_CHOICE'FIRST) is > record > case RADAR_TYPE is > when RADAR_A => > Radar_A_Command : Radar_A_Command_Choice; > when RADAR_B => > Radar_B_Command : Radar_B_Command_Choice; > when RADAR_C => > Radar_C_Command : Radar_C_Command_Choice; > end case; > end record; > > > > Sorry that I'm querying your design intent rather than your actual > question, I haven't understood the question properly! Sorry. I should not have put in null there. type RADAR_TYPE_CHOICE is (RADAR_A, RADAR_B); 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_A_COMMAND_TYPE (RADAR_COMMAND : RADAR_A_COMMAND_CHOICE := RADAR_A_COMMAND_CHOICE'FIRST) is record case RADAR_COMMAND is when RADAR_A_DISPLAY_RANGE_SELECT => < a whole bunch of operations...> when others => null; end case; end record; type RADAR_B_COMMAND_TYPE (RADAR_COMMAND : RADAR_B_COMMAND_CHOICE := RADAR_B_COMMAND_CHOICE'FIRST) is record case RADAR_COMMAND is when RADAR_B_DISPLAY_RANGE_SELECT => < a whole bunch of operations...> when others => null; end case; end record; type RADAR_CHOICE (RADAR_TYPE : RADAR_TYPE_CHOICE := RADAR_TYPE_CHOICE'FIRST) is record case RADAR_TYPE is when RADAR_A => RADAR_A_COMMAND : RADAR_A_COMMAND_CHOICE(????) when RADAR_B => RADAR_B_COMMAND : RADAR_B_COMMAND_CHOICE(????) end case; end record; Anyways, in the case above, how can I pass a second discriminant. This is because I need to be able to select a particular command for a particular radar. Sorry for not having said this in the first place. Ganesh