!standard 3.9(7) 05-06-01 AI95-00400/04 !standard 3.9(10) !standard 11.4.1(2) !standard 11.4.1(5) !standard 11.4.1(12) !standard C.5(7) !class amendment 05-01-25 !status Amendment 200Y 05-03-03 !status ARG Approved 10-0-0 05-02-13 !status work item 05-01-25 !status received 05-01-25 !priority High !difficulty Easy !subject Wide_ and Wide_Wide_ images of identifiers !summary (See proposal.) !problem Now that identifiers can use 16- and 32-bit characters, the operations that construct the image of identifiers may end up having to create Wide_ or Wide_Wide_Strings. This was acknowledged by the introduction of attributes Wide_Wide_Image, Wide_Wide_Value, etc. However, there are functions in packages Ada.Tags and Ada.Exceptions which return the image of the (full) name of a tag or an exception. At a minimum, we must specify what these functions do when they encounter an identifier with a character which is not in subtype Character. Note that this AI is *not* proposing to introduce Wide_ or Wide_Wide_String variants of the numerous functions that operate on String in the predefined units (e.g., Ada.Text_IO.Open). This would be a much bigger change, and we haven't seen demand for this. What this AI is doing is fixing an inconsistency that was missed when 16- and 32-bit characters were introduced. !proposal (See wording.) !wording Change 3.9(7) to include the following declarations function Expanded_Name(T : Tag) return String; function Wide_Expanded_Name(T : Tag) return Wide_String; function Wide_Wide_Expanded_Name(T : Tag) return Wide_Wide_String; Change 3.9(10) to read: The function Wide_Wide_Expanded_Name returns the full expanded name of the first subtype of the specific type identified by the tag, in upper case, starting with a root library unit. The result is implementation defined if the type is declared within an unnamed block_statement. The function Expanded_Name (respectively, Wide_Expanded_Name) returns the same sequence of graphic characters as that defined for Wide_Wide_Expanded_Name, if all the graphic characters are defined in Character (respectively, Wide_Character); otherwise, the sequence of characters is implementation defined, but no shorter than that returned by Wide_Wide_Expanded_Name for the same value of the argument. Change 11.4.1(2) to include the following declarations: function Exception_Name(Id : Exception_Id) return String; function Wide_Exception_Name(Id : Exception_Id) return Wide_String; function Wide_Wide_Exception_Name(Id : Exception_Id) return Wide_Wide_String; Change 11.4.1(5) to include the following declarations: function Exception_Name(X : Exception_Occurrence) return String; function Wide_Exception_Name(X : Exception_Occurrence) return Wide_String; function Wide_Wide_Exception_Name(X : Exception_Occurrence) return Wide_Wide_String; Change 11.4.1(12) to read: The Wide_Wide_Exception_Name functions return the full expanded name of the exception, in upper case, starting with a root library unit. For an exception declared immediately within package Standard, the defining_identifier is returned. The result is implementation defined if the exception is declared within an unnamed block_statement. The Exception_Name functions (respectively, Wide_Exception_Name) return the same sequence of graphic characters as that defined for Wide_Wide_Exception_Name, if all the graphic characters are defined in Character (respectively, Wide_Character); otherwise, the sequence of characters is implementation defined, but no shorter than that returned by Wide_Wide_Exception_Name for the same value of the argument. Change C.5(7) to read: If the pragma applies to an enumeration type, then the semantics of the Wide_Image and Wide_Value attributes are implementation defined for that type; the semantics of Image and Value are still defined in terms of Wide_Image and Wide_Value. In addition, the semantics of Text_IO.Enumeration_IO are implementation defined. If the pragma applies to a tagged type, then the semantics of the Tags.Wide_Wide_Expanded_Name function are implementation defined for that type; the semantics of Tags.Expanded_Name and Tags.Wide_Expanded_Name are still defined in terms of Tags.Wide_Wide_Expanded_Name. If the pragma applies to an exception, then the semantics of the Exceptions.Wide_Wide_Exception_Name function are implementation defined for that exception; the semantics of Exceptions.Exception_Name and Exceptions.Wide_Exception_Name are still defined in terms of Tags.Wide_Wide_Expanded_Name. !discussion The following approaches were considered: 1 - Don't change the specification of Ada.Tags and Ada.Exceptions, the functions return an implementation-defined string when the full name contains a wide or wide-wide character. Users who take advantage of the extended character set cannot count on any portability in this area. 2 - Change the existing functions to return Wide_Wide_String instead of String. Presumably this is the worst incompatibility, as many existing usages would have to be changed, including code that prints or stores these strings for logging purposes. 3 - Add extra overloads returning Wide_String and Wide_Wide_String. This introduces some incompatibilities, mostly in code that uses these functions in conjunction with string literals. 4 - Add new functions with distinct names. This still introduces incompatibilities, but only in code that has use clauses and declares identifiers that clash, and this is extremely unlikely. This AI was written for option 4. The wording is then similar to that for the Wide_Wide_ attributes: the semantics is well defined for the function returning Wide_Wide_String, and for the others as long as the full name is only made up of Characters (resp. Wide_Characters). Otherwise, the semantics is implementation defined. !example !corrigendum 3.9(7) @drepl @xcode< @b Expanded_Name(T : Tag) @b String; @b External_Tag(T : Tag) @b String; @b Internal_Tag(External : String) @b Tag;> @dby @xcode< @b Expanded_Name(T : Tag) @b String; @b Wide_Expanded_Name(T : Tag) @b Wide_String; @b Wide_Wide_Expanded_Name(T : Tag) @b Wide_Wide_String; @b External_Tag(T : Tag) @b String; @b Internal_Tag(External : String) @b Tag;> !corrigendum 3.9(10) @drepl The function Expanded_Name returns the full expanded name of the first subtype of the specific type identified by the tag, in upper case, starting with a root library unit. The result is implementation defined if the type is declared within an unnamed @fa. @dby The function Wide_Wide_Expanded_Name returns the full expanded name of the first subtype of the specific type identified by the tag, in upper case, starting with a root library unit. The result is implementation defined if the type is declared within an unnamed @fa. The function Expanded_Name (respectively, Wide_Expanded_Name) returns the same sequence of graphic characters as that defined for Wide_Wide_Expanded_Name, if all the graphic characters are defined in Character (respectively, Wide_Character); otherwise, the sequence of characters is implementation defined, but no shorter than that returned by Wide_Wide_Expanded_Name for the same value of the argument. !corrigendum 11.4.1(2) @drepl @xcode<@b Ada.Exceptions @b @b Exception_Id @b; Null_Id : @b Exception_Id; @b Exception_Name(Id : Exception_Id) @b String;> @dby @xcode<@b Ada.Exceptions @b @b Exception_Id @b; Null_Id : @b Exception_Id; @b Exception_Name(Id : Exception_Id) @b String; @b Wide_Exception_Name(Id : Exception_Id) @b Wide_String; @b Wide_Wide_Exception_Name(Id : Exception_Id) @b Wide_Wide_String;> !corrigendum 11.4.1(5) @drepl @xcode< @b Exception_Identity(X : Exception_Occurrence) @b Exception_Id; @b Exception_Name(X : Exception_Occurrence) @b String; -- @ft<@i> @b Exception_Information(X : Exception_Occurrence) @b String;> @dby @xcode< @b Exception_Identity(X : Exception_Occurrence) @b Exception_Id; @b Exception_Name(X : Exception_Occurrence) @b String; -- @ft<@i> @b Wide_Exception_Name(X : Exception_Occurrence) @b Wide_String; -- @ft<@i> @b Wide_Wide_Exception_Name(X : Exception_Occurrence) @b Wide_Wide_String; -- @ft<@i> @b Exception_Information(X : Exception_Occurrence) @b String;> !corrigendum 11.4.1(12) @drepl The Exception_Name functions return the full expanded name of the exception, in upper case, starting with a root library unit. For an exception declared immediately within package Standard, the @fa is returned. The result is implementation defined if the exception is declared within an unnamed @fa. @dby The Wide_Wide_Exception_Name functions return the full expanded name of the exception, in upper case, starting with a root library unit. For an exception declared immediately within package Standard, the @fa is returned. The result is implementation defined if the exception is declared within an unnamed @fa. The Exception_Name functions (respectively, Wide_Exception_Name) return the same sequence of graphic characters as that defined for Wide_Wide_Exception_Name, if all the graphic characters are defined in Character (respectively, Wide_Character); otherwise, the sequence of characters is implementation defined, but no shorter than that returned by Wide_Wide_Exception_Name for the same value of the argument. !corrigendum C.5(7) @drepl If the pragma applies to an enumeration type, then the semantics of the Wide_Image and Wide_Value attributes are implementation defined for that type; the semantics of Image and Value are still defined in terms of Wide_Image and Wide_Value. In addition, the semantics of Text_IO.Enumeration_IO are implementation defined. If the pragma applies to a tagged type, then the semantics of the Tags.Expanded_Name function are implementation defined for that type. If the pragma applies to an exception, then the semantics of the Exceptions.Exception_Name function are implementation defined for that exception. @dby If the pragma applies to an enumeration type, then the semantics of the Wide_Image and Wide_Value attributes are implementation defined for that type; the semantics of Image and Value are still defined in terms of Wide_Image and Wide_Value. In addition, the semantics of Text_IO.Enumeration_IO are implementation defined. If the pragma applies to a tagged type, then the semantics of the Tags.Wide_Wide_Expanded_Name function are implementation defined for that type; the semantics of Tags.Expanded_Name and Tags.Wide_Expanded_Name are still defined in terms of Tags.Wide_Wide_Expanded_Name. If the pragma applies to an exception, then the semantics of the Exceptions.Wide_Wide_Exception_Name function are implementation defined for that exception; the semantics of Exceptions.Exception_Name and Exceptions.Wide_Exception_Name are still defined in terms of Tags.Wide_Wide_Expanded_Name. !ACATS test ACATS C-Test(s) should be created to check that these functions exist and work as specified. (This will require Unicode source code for these tests.) !appendix ****************************************************************