!standard A.4.2 (63) 99-08-31 AI95-00151/03

!class binding interpretation 96-09-04

!status Corrigendum 2000 99-05-27

!status WG9 approved 98-06-12

!status ARG Approved 13-0-0 97-11-14

!status work item 96-09-08

!status received 96-09-04

!priority Low

!difficulty Easy

!qualifier Error

!subject Bounds of string returned by Ada.Strings.Maps.To_Range

!class binding interpretation 96-09-04

!status Corrigendum 2000 99-05-27

!status WG9 approved 98-06-12

!status ARG Approved 13-0-0 97-11-14

!status work item 96-09-08

!status received 96-09-04

!priority Low

!difficulty Easy

!qualifier Error

!subject Bounds of string returned by Ada.Strings.Maps.To_Range

!summary

To_Range returns the Character_Sequence value R, such that if D =
To_Domain (Map), then R has the same bounds as D, and D(I) maps to R(I)
for each I in D'Range.

!question

A.4.2(63) says:

To_Range returns the Character_Sequence value R, with lower
bound 1 and upper bound Map'Length, such that if D = To_Domain(Map)
then D(I) maps to R(I) for each I in D'Range.

However, Map is not an array, so Map'Length makes no sense.

!recommendation

!wording

Replace A.4.2(63) with the summary above.

!discussion

The simplest fix is to specify that the bounds are the same as those for
To_Domain.

!corrigendum A.04.02(63)

Replace the paragraph:

To_Range returns the Character_Sequence value R, with lower
bound 1 and upper bound Map'Length, such that if D = To_Domain(Map)
then D(I) maps to R(I) for each I in D'Range.

by:

To_Range returns the Character_Sequence value R, such that if D =
To_Domain (Map), then R has the same bounds as D, and D(I) maps to R(I)
for each I in D'Range.

!ACATS test

The AI corrects a definition. To_Range is adaquately tested by ACATS test
CXA4024.A.

!appendix

!section A.4.2(63) !subject Bounds of string returned by Ada.Strings.Maps.To_Range !reference RM95-A.4.2(63) !from Carol Charlson 96-06-19 !keywords to_range map !reference 96-5603.a Carol Charlson 96-6-19>> !discussion Several questions follow regarding the use of Map'Length in A.4.2(63) for the upper bound of the string returned by Ada.Strings.Maps.To_Range: RM95 A.4.2(16) subtype Character_Sequence is String; RM95 A.4.2(20) type Character_Mapping is private; RM95 A.4.2(24) function To_Range (Map : in Character_Mapping) return Character_Sequence; RM95 A.4.2(63) To_Range returns the Character_Sequence value R, with lower bound 1 and upper bound Map'Length, such that if D = To_Domain(Map) then D(I) maps to R(I) for each I in D'Range. Example: Map : Character_Mapping := to_mapping ("abc", "ABC"); D : constant Character_Sequence := To_Domain(Map); -- "abc" R : constant Character_Sequence := To_Range (Map); -- "ABC ... " In the above example, the domain is a 3 character string "abc". The range contains 3 characters "ABC" that are placed in a character_sequence string which is 1..Map'Length in size, according to A.4.2(63). 1) Map'Length implies an array implementation for the private type. Implementation details should be hidden. 2) If type Character_Mapping is array(Character) of Character as suggested by Rationale p. A-10, then Map'Length > 3. What is the purpose of returning 4..Map'Length unknown characters? 3) Suppose the full definition of Map is a non-array type. What is the upper bound of the string returned by To_Range? The bounds of the strings returned by To_Range and To_Domain should be identical, given the same Character_Mapping. Characteristics of the Implementation-Defined Character_Mapping should not be used to define the bounds of the string returned by To_Range. A suggested rewording of A.4.2(63) is: To_Range returns the Character_Sequence value R, with lower bound 1 and upper bound D'Length, where D = To_Domain (Map). The contents of R are ordered such that D(I) maps to R(I) for each I in D'Range. ========================================================================== Carol Charlson Harris Computer Systems Corporation Ft. Lauderdale, FL 33309-1892 Internet: Carol.Charlson@mail.hcsc.com ========================================================================== **************************************************************** !section A.4.2(63) !subject Bounds of string returned by Ada.Strings.Maps.To_Range !reference RM95-A.4.2(63) !keywords to_range map !reference 96-5603.a Carol Charlson 96-6-19 !from Bob Duff !reference 96-5610.a Robert A Duff 96-6-22>> !discussion > Several questions follow regarding the use of Map'Length in A.4.2(63) Right. Map is not an array type, so Map'Length makes no sense. The fact that the full view might be an array type is irrelevant. > A suggested rewording of A.4.2(63) is: > > To_Range returns the Character_Sequence value R, with lower bound 1 and > upper bound D'Length, where D = To_Domain (Map). The contents of R > are ordered such that D(I) maps to R(I) for each I in D'Range. Yes, I agree. Or, perhaps: To_Range returns the Character_Sequence value R, such that if D = To_Domain (Map), then R has the same bounds as D, and D(I) maps to R(I) for each I in D'Range. - Bob ****************************************************************

Questions? Ask the ACAA Technical Agent