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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1a17bf1815b2a692 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Ada-trivial ! Date: 1999/08/14 Message-ID: <37b5a083@news1.us.ibm.net>#1/1 X-Deja-AN: 512773303 Content-transfer-encoding: 7bit References: <934306032.27513.0.nnrp-10.c2de38ef@news.demon.co.uk> X-Trace: 14 Aug 1999 16:59:47 GMT, 129.37.62.181 Organization: Global Network Services - Remote Access Mail & News Services X-Notice: should be reported to postmaster@ibm.net Content-Type: text/plain; charset="US-ASCII" Mime-version: 1.0 Newsgroups: comp.lang.ada X-Complaints-To: postmaster@ibm.net Date: 1999-08-14T00:00:00+00:00 List-Id: In article <934306032.27513.0.nnrp-10.c2de38ef@news.demon.co.uk> , "Duncan Woodward" wrote: > I want to create a package that handles actions upon > a multi dimensional unconstrained array. > > It is likely that I've approached this problem from the > wrong direction, but this is where I'm at.. > > package array_Handler is > > type Container_Matrix is array(POSITIVE range <>, > POSITIVE range <>, > POSITIVE range <>) of Boolean; > > procedure1 Set_Container_Size(x,y,z:Integer); > > -- this procedure takes in the three axis values for > -- the array index ranges. > -- Creates instance of Container_Matrix using parameters > -- x,y,z. > > procedure2 ...etc > procedure3 ...etc > > end array_Handler; > > PROBLEM: How do I create an instance of type Container_Matrix > that is visible to all procedures in the package. > > A single global declaration would be fine if the array sizes were know > in advance! You could pass in the array bounds as generic formal constants: generic X, Y, Z : in Positive; package Array_Handler_G is subtype X_Range is Positive range 1 .. X; subtype Y_Range is Positive range 1 .. Y; subtype Z_Range is Positive range 1 .. Z; type Container_Matrix (X_Range, Y_Range, Z_Range) of Boolean; --(I haven't compiled this) ... end Array_Handler_G; Do you want to create only one instance of the matrix in the package body? Or many, all of the same dimensions? Or many, with different dimensions. Your problem statement wasn't clear to me about that.