To: J3 J3/23-151r1 From: Steve Lionel & Van Snyder Subject: F202Y Allow I/O of enumeration type names Date: 2023-June-13 In paper 23-151, Van Snyder notes that I/O of enumeration types (introduced in F2023 and distinct from interoperable enum types) are usable in I/O operations only for their ordinal values. Van properly notes that it is desirable to offer a means of reading and writing enumeration values by name, and suggests extending character output, for example A and AT formats, to support enumeration types. JOR prefers a different option. Proposal -------- Extend the G format edit descriptor to support enumeration types. For output, the field is that of the enumerator name(*) in upper case, padded with blanks to the right if necessary to satisfy a nonzero w field. If w is nonzero but is shorter than the width of the enumerator name, the field is filled with asterisks. For G0 or G0.d, the output field is the exact length of the enumeration name. For input with a G edit descriptor, the character string consists of a valid enumerator name for the type of the input list item; irrespective of case, with trailing blanks ignored. If the input field does not contain such a name, an error condition occurs. (*) An enumerator name consists of the characters in the name in the Fortran character set; the default character set is required to include those characters. This is an issue which applies to other I/O; for example, Japanese character sets contain full-width and half-width versions of digits, letters, special characters, etc. It would be unfortunate if someone thought that full-width characters should be used for any formatted non-character I/O. (The half-width ones are the ones that correspond to ASCII digits etc.) For list-directed output, enumeration type values are produced with the effect of a G0 descriptor, preceded and/or followed by a value separator, the same as for other non-character data. For list-directed input, when the next effective item is of an enumeration type, the input form consists of characters containing a valid enumerator name in the item's enumeration type, insensitive to case. For namelist formatting, the appropriate list-directed rules apply.