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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f5c6fba20eff3d07,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!q5g2000prf.googlegroups.com!not-for-mail From: shaunpatterson@gmail.com Newsgroups: comp.lang.ada Subject: Pointer to Array Date: Tue, 16 Oct 2007 06:40:30 -0700 Organization: http://groups.google.com Message-ID: <1192542030.745091.64900@q5g2000prf.googlegroups.com> NNTP-Posting-Host: 155.219.241.10 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1192542031 1319 127.0.0.1 (16 Oct 2007 13:40:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 16 Oct 2007 13:40:31 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q5g2000prf.googlegroups.com; posting-host=155.219.241.10; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2463 Date: 2007-10-16T06:40:30-07:00 List-Id: I'm attempting to make a pointer to an array... or in a sense "rename" an array. I'm combining code from two very similar systems. Lots of code. I have thousands of lines of code that's exactly the same, using (for just an example) an array of Integers. There is a store file in each system that declares: -- system 1 type INT_ARRAY is new Integer (1..SYSTEM_1_SIZE); Int_Array_Var : INT_ARRAY; -- system 2 type INT_ARRAY is new Integer (1..SYSTEM_2_SIZE); Int_Array_Var : INT_ARRAY; --------- so in other words, the variable names are the same, types are the same only the size of the array is different.. then I have code in both systems that use that array like: For I in Int_Array_Var'Range loop -- Do lots of stuff with Int_Array_Var end loop ------ I want to keep that code untouched if possible. I'm hoping there is a way in Ada to do something like type INT_ARRAY is array (Positive range <>) of Integer; Int_Array_Var_System1 : INT_ARRAY (1..System_1_Size); Int_Array_Var_System2 : INT_ARRAY (1..System_2_Size); And I'd like to so something at run time that is like: if usingSystem1 then Int_array_Var = "pointer to Int_Array_Var_System1" elsif usingSystem2 then Int_array_Var = "pointer to Int_Array_Var_System2" by changing the pointer I'm hoping to keep most of existing code the same. Is there any method in ada to do this? - Shaun