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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,330ec86e1824a689 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-28 13:55:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Robert C. Leif" Newsgroups: comp.lang.ada Subject: RE: Run-Time Type Assignment Date: Wed, 28 Aug 2002 13:54:00 -0700 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1030568103 46130 137.194.161.2 (28 Aug 2002 20:55:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 28 Aug 2002 20:55:03 +0000 (UTC) Return-Path: X-Envelope-From: rleif@rleif.com X-Envelope-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 Importance: Normal In-Reply-To: <3D6CB4F5.F4E05D76@myob.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.12 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:28526 Date: 2002-08-28T13:54:00-07:00 From: Bob Leif From: Bob Leif To: Fellow Readers of Comp.Lang.Ada Firstly, thanks to all who suggested implementations. I now have a solution based on the Example from Norman Cohen's Ada as a second language page 377. The two pages and main procedure below compile. Unfortunately, type Para_Rec_Psuedo_Tagged_Type is brute force approach. Does anyone have a simpler implementation? ------------------------------------------------------ package Parameter_Recs_Pkg is subtype Para_1_Type is Positive range 1..64_000; subtype Para_2_Type is Positive range 1..256; subtype Para_3_Type is Positive range 1..1024; subtype Para_4_Type is Positive range 1..2048; subtype Para_5_Type is Positive range 1..4096; subtype Num_Paras_Type is Positive range 1..5; Num_Paras : Num_Paras_Type := 1; type Para_Rec_Psuedo_Tagged_Type (Num_Paras :Num_Paras_Type) is record Para_1 : Para_1_Type; --Always has one parameter case Num_Paras is when 1 => null; when 2|3|4|5 => Para_2 : Para_2_Type; case Num_Paras is when 1|2 => null; when 3|4|5 => Para_3 : Para_3_Type; case Num_Paras is when 1|2|3 => null; when 4|5 => Para_4 : Para_4_Type; case Num_Paras is when 1|2|3|4 => null; when 5 => Para_5: Para_5_Type; end case; end case; end case; end case; end record; end Parameter_Recs_Pkg; ------------------------------------------------------------------------ ---- ------------------------------------------------------------------------ ---- generic Length : Positive; type Record_Type is private; package Array_Of_Records_G_Pkg is type Array_Of_Records_Type is array (1 .. Length) of Record_Type; ------------------------------------------------------------ --Sets the value of an individual record in the array procedure Set_Record ( Array_Of_Records : in out Array_Of_Records_Type; Index : in Positive; Record_Var : in Record_Type ); ------------------------------------------------------------ --Retrieves a record from the array. function Get_Record ( Array_Of_Records : in Array_Of_Records_Type; Index : in Positive ) return Record_Type; ------------------------------------------------------------ end Array_Of_Records_G_Pkg; ------------------------------------------------------------------------ ---- ------------------------------------------------------------------------ ---- with Parameter_Recs_Pkg; with Array_Of_Records_G_Pkg; procedure Test is ---------Table of Contents---------- subtype Num_Paras_Type is Parameter_Recs_Pkg.Num_Paras_Type; subtype Para_Rec_Psuedo_Tagged_Type is Parameter_Recs_Pkg.Para_Rec_Psuedo_Tagged_Type; --------End Table of Contents---------- Num_Of_Records : Positive := 5; Num_Paras : Num_Paras_Type := 2; type Array_Record_Type is new Para_Rec_Psuedo_Tagged_Type (Num_Paras); --------------------------------------------------- package Array_Of_Records_Pkg is new Array_Of_Records_G_Pkg( Length => Num_Of_Records, Record_Type => Array_Record_Type); --------------------------------------------------- begin --Test null; end Test;