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,e7e108bbafde0f02 X-Google-Attributes: gid103376,public From: "Ian Ward" Subject: Re: Constraint or what? Date: 2000/02/16 Message-ID: <950722970.15331.0.nnrp-08.d4f0c606@news.demon.co.uk>#1/1 X-Deja-AN: 586597158 X-NNTP-Posting-Host: [212.240.198.6]:212.240.198.6 References: <38A2A395.FD028B73@alcatel.be> X-Trace: news.demon.co.uk 950722970 nnrp-08:15331 NO-IDENT [212.240.198.6]:212.240.198.6 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-02-16T00:00:00+00:00 List-Id: Dat denk je maar, nieuw Ariel Gaat diep in de vezels... I have seen this before, I seem to recall that the compiler thought that, as it was only a subtype of POSITIVE, it did not think that it was constrained. I demonstrated this on the compiler in question, by creating a huge range, within a Type eg. Type x is range 0 .. 2**30-1, or whatever Then derived the subtype constraint fron the new type, instead of positive. subtype arrayrng is x range 0..30; It then worked. I did not investigate this any further, once I'd got it to work. Groetjes, Ian. Jan Wuyts wrote in message <38A2A395.FD028B73@alcatel.be>... >Hi guys, > >We're doing a port Alsys -> VADS or whatever they are called these >days. This maybe a stupid question but I'll take the risk. > >The Alsys didn't complain on the construct below but the VADS one does. >I know about the restrictions on UNCHECKED_CONVERSION and the VADS >documentation says the target type cannot be an unconstraint array but I >assumed it was constraint. So, why does the VADS compiler issue an >error... > >Can anyone help me? > >Here is what I do: > >-------------------- >...in ADT_ADU... > MAX_BINARY_BUFFER_SIZE : constant integer > := ADT_ADU_DESCRIPTION.MAX_BINARY_BUFFER_SIZE; > subtype T_BINARY_BUFFER_SIZE is > INTEGER range 0..MAX_BINARY_BUFFER_SIZE; > type T_BINARY_BUFFER is array (T_BINARY_BUFFER_SIZE range <>) of > NUMERIC_TYPES.UNSIGNED_INTEGER8; > >... in NUMERIC_TYPES ... > type UNSIGNED_INTEGER8 is range 0 .. 255; > for UNSIGNED_INTEGER8'size use 8; > > type UNSIGNED_INTEGER8_ARRAY is > array (POSITIVE range <>) of UNSIGNED_INTEGER8; > pragma PACK (UNSIGNED_INTEGER8_ARRAY); > > subtype BYTE_ARRAY is UNSIGNED_INTEGER8_ARRAY; > >... in the failing procedure... >DUMP_BIN_BUF: >declare > BUFSIZ : constant ADT_ADU.T_BINARY_BUFFER_SIZE > := ADT_ADU.BINARY_BUFFER_SIZE(ADU); > BUF : ADT_ADU.T_BINARY_BUFFER(1..BUFSIZ); > subtype LIMITED_BYTE_ARRAY_RANGE is > POSITIVE range 1..BUFSIZ +1; > > subtype LIMITED_BYTE_ARRAY is NUMERIC_TYPES.BYTE_ARRAY > (LIMITED_BYTE_ARRAY_RANGE); > function TO_BYTE_ARRAY is new > UNCHECKED_CONVERSION (TARGET=> LIMITED_BYTE_ARRAY, > SOURCE=> ADT_ADU.T_BINARY_BUFFER); > ---- This is where the VADS compiler says... > ---- error: RM Appendix F: target type must not be > ---- unconstrained array or record type > >begin > ADT_ADU.GET_BINARY_BUFFER(ADU, BUF); > return "BUFFER_SIZE=>"& INTEGER'IMAGE(BUFSIZ) & "," > & ASCII.LF & "BUFFER=>(" > & ASCII.LF & .DUMP_BYTE_ARRAY( > TO_BYTE_ARRAY( BUF ) > ) > & ASCII.LF & ASCII.HT & ")"; >exception >-------------------- > >In my opinion LIMITED_BYTE_ARRAY is constraint so... > >Thanks for the help >-- > _____________ > Jan Wuyts (RX) \ ^ / > \ALC/_\TEL/ >------------------------------------------\ /---- > Internet: wuytsj@rsd.bel.alcatel.be \ ,,, / > jan.wuyts@alcatel.be (. .) >-----------------------------------------o00-(_)-00o--- >Alcatel Bell Space V > Berkenrodelei 33 Phone: (+32) 3/829.5479 > B-2660 Hoboken Fax: (+32) 3/829.5763 > Belgium.