[comp.lang.ada] IMAGE for non-graphic characters

John.Goodenough@SEI.CMU.EDU (03/14/88)

With respect to the recent question about the image of a nongraphic character,
AI-00239 addresses this issue.  This is a non-binding interpretation, meaning
it is recommended, but not enforced, and may be the required position in a
future version of the Standard.  I quote from the summary of this commentary:

   If ENUM_IO is an instantiation of ENUMERATION_IO for a  character  type  that
   contains a non-graphic character, e.g.,

           package ENUM_IO is new ENUMERATION_IO (CHARACTER);

   then for each non-graphic character (such as ASCII.NUL),  ENUM_IO.PUT  should
   output  the  corresponding sequence of characters used in the type definition
   (e.g., PUT(ASCII.NUL) should output the string "NUL" if  SET  has  the  value
   UPPER_CASE  and  WIDTH  is  less than 4).  Furthermore, ENUM_IO.GET should be
   able to  read  the  sequence  of  characters  output  by  ENUM_IO.PUT  for  a
   non-graphic  character,  returning  in  its  ITEM parameter the corresponding
   enumeration value.

   Similarly, the image of a non-graphic character (i.e.,  the  result  returned
   for the attribute designator IMAGE) should be the sequence of characters used
   in the type  definition  of  CHARACTER  (e.g.,  CHARACTER'IMAGE(ASCII.NUL)  =
   "NUL"),   and  'VALUE  should  accept  such  a  string  as  representing  the
   corresponding enumeration value.

   An implementation conforms to the Standard in  this  respect  if  the  result
   produced  by 'IMAGE for a non-graphic character is accepted by 'VALUE, and if
   the result (if any) produced by PUT can be read by GET; GET is  also  allowed
   to  raise DATA_ERROR when attempting to read any string produced by PUT for a
   non-graphic character.

   This interpretation is non-binding,  i.e.,  implementers  are  encouraged  to
   conform  to  it  but  are  not  required to do so by the validation tests.  A
   future version of the Standard may incorporate this interpretation.

John Goodenough
Software Engineering Institute
Goodenough@sei.cmu.edu