J3/98-199r1 Date: 14 August 1998 To: J3 From: Dick Hendrickson/JOR Subject: Internationalization: Spec, Syntax, and Edits Reference: J3/98-169(T6), WG5/N1320 Rationale: Paper N1320 requests two items to support Internationalization in Fortran 2000: a way to portably specify ISO 10646 characters as a KIND parameter, and a way to alter formatted I/O to use a "," in place of the "." in numeric constants. Trollhattan resolution T6 states that these two features will fulfill the requirements for internationalization. The first requirement will be met with an intrinsic function, modeled after selected-int-kind, that returns the kind number for ISO 10646 if the processor supports it. The second will be met by adding a "DECIMAL=" field to the control list in OPEN, INQUIRE and READ/WRITE statements, and a DC field to format statements modeled after the highly successful IEEE I/O rounding mode control. Specification and Syntax for ISO 10646 The function SELECTED_CHAR_KIND(X) will return the kind number for the character kind indicated by X and will return -1 if the processor does not support that kind. The argument X is a character string. The allowed values for X, independent of case, are DEFAULT, ASCII, ISO10646. A processor is free to extend this list if it supports other kinds. Specification for Decimal Point Control. Add DECIMAL= to the OPEN, INQUIRE and READ/WRITE statements to allow setting the default decimal point edit mode for a formatted file connection. This default will control the form of all floating point constants for formatted, namelist, and list directed I/O. If set to POINT the constants will be as currently described. If set to COMMA, a comma will be used for the decimal point and all commas in lists and complex numbers will be semicolons. Add a DC and DP control edit descriptor to formats to allow control on an item by item basis during format processing. Edits for Decimal Point Control. ------------------------------------------------- Page 149:43+, Add a J3 note, "Should we specify the DECIMAL= and ROUND= default modes here for internal files? ------------------------------------------------- Add DECIMAL= to the list of things that can change on reOPEN Page 151, line 41 after "PAD=," add " DECIMAL=," ------------------------------------------------- Add a new connect-spec for OPEN to R905 P152:30+ " DECIMAL = scalar-default-char-expr" ------------------------------------------------- Add description, Page 155:4+ 9.3.4.x DECIMAL= specifier in the OPEN statement The scalar-default-char-expr shall evaluate to COMMA or POINT. The DECIMAL= specifier is permitted only for a file being connected for formatted input/output. This specifies the initial form of the decimal edit mode (10.6.x) for all formatted input/output for this connection. If this specifier is omitted, the initial form of the decimal edit mode is POINT. ------------------------------------------------- Add DECIMAL= to the io-control-spec list P156:37+, add or DECIMAL= scalar-default-char-expr p157:38 change "ADVANCE= and ASYNCHRONOUS=" to "ADVANCE=, ASYNCHRONOUS=, and DECIMAL=" p161:7+ Add new section: 9.4.1.x Decimal specifier The scalar-default-char-expr shall evaluate to COMMA or POINT. The DECIMAL= specifier is permitted only for formatted input/output. This specifies the initial form of the decimal edit mode (10.6.x) in this input/output statement. If no DECIMAL= specifier appears in the io- control-spec list, at the beginning of execution of each formatted input/output statement for a file connected by an OPEN statement, the decimal edit mode is that established by the OPEN statement; an internal file or a preconnected file that has not been opened is treated as if the file had been opened with DECIMAL = 'POINT'. ------------------------------------------------- Make DC, etc. stack up like BN for DT I/O Page 171, line 33, after "SS," add " DC, DP," ------------------------------------------------- Add a new inquire-spec to INQUIRE R926 Page 176, line 31+ " DECIMAL = scalar-default-char-variable" ------------------------------------------------ Add description page 180:25+ 9.7.1.x DECIMAL= specifier in the INQUIRE statement The scalar-default-char-variable in the DECIMAL= specifier is assigned one of the values COMMA or POINT corresponding to the decimal edit mode in effect for the file connected for formatted input/output. If there is no connection, or if the connection is not for formatted input/output, the scalar-default-char-variable is assigned the value UNDEFINED. ------------------------------------------------- Add decimal edit descriptor to control edit descriptors in R1010 185:19+ " or decimal-edit-desc" page 185:33+ add "R101x decimal-edit-desc is DC or DP -------------------------------------------------- Describe how format revision works add P187, line 3 after "(10.6.4)," " the decimal edit mode descriptor (10.6.x)," ------------------------------------------------ Add new section, P196:40+ 10.6.x DC and DP editing The decimal edit descriptors may be used to change the decimal edit mode that controls the appearance of the decimal point during conversion of real and complex values in formatted input/output (9.3.4.x). If a DECIMAL= specifier appears in the io-control-spec list for a formatted READ or WRITE statement, it specifies the initial decimal edit mode. If no DECIMAL= specifier appears in the io-control-spec list, at the beginning of execution of each formatted input/output statement for a file connected by an OPEN statement, the decimal edit mode is that established by the OPEN statement. DC sets the decimal edit mode to COMMA; DP sets the decimal edit mode to POINT. The decimal edit descriptors affect only D, E, EN, ES, F, and G editing. If the decimal edit mode is POINT, then the use of decimal points and commas in formatted output is as described in this standard. If the decimal edit mode is COMMA, then any decimal point in a number shall be a comma and any comma separator in a list or a complex constant shall be a semicolon. ---------------------------------------------- Use ";" as a separator for list directed. Page 197, line 23. Add at the end of the sentence ", unless the decimal edit mode is COMMA in which case a semicolon is used in place of the comma as a value separator" Page 197, line35, after "commas" add " (or semicolons) " Allow "," in input page 198, line 10 after "decimal point" add ", or a semicolon if the decimal edit mode is COMMA," Page 198, line 12 after "comma," add ", or a semicolon if the decimal edit mode is COMMA," Page 198, line 15 and 16. After each "comma" add (2 places) ", or the semicolon if the decimal edit mode is COMMA," ------------------------------------------ Allow ; in list directed output page 199, line 46 after "comma" add ", or a semicolon if the decimal edit mode is COMMA," page 200, lines 12, after "comma" add ", or a semicolon if the decimal edit mode is COMMA," page 200, line 14 and 15, after each "comma" add ", or the semicolon if the decimal edit mode is COMMA," --------------------------------------------- Note. We do not need to say anything about the comma/point in real output since page 199:44 says output is the same form as input. We could add a line there saying "remember the DECIMAL=" ---------------------------------------------- Namelist input Note: we do not need to say anything about ";" in lists since page 201, line 21 uses the "value separators" from list directed. Emphasize that decimal mode applies to namelist (line 4 says it obliquely) Page 202, line 6. add after "10.9.1.3." " The form of real and complex values is controlled by the decimal edit mode in effect (10.6.x)." ----------------------------------------------- allow ; as null separator page 203, line 43, after "comma," add " or a semicolon if the decimal edit mode is COMMA," ----------------------------------------------- Namelist output We do not need to say anything about the form of output, since 204, line 28, says it's the same as for input and we've already covered that. We could add a reminder of the form "remember the DECIMAL=. Allow ; in complex output. page 205, line 3 after "comma" add ", or a semicolon if the decimal edit mode is COMMA," page 205, lines 5 and 6. After each "comma" add ", or the semicolon if the decimal edit mode is COMMA," -------------------------------------------------------------------- Edits for SELECTED_CHAR_KIND(R) Page 244, line 35, add "The transformational function SELECTED_CHAR_KIND returns the character kind type parameter value that corresponds to the character set named by its argument." Page 250, line37+ SELECTED_CHAR_KIND(R) Character kind type parameter value, given character set name Page 293, 14+ add 13.14.xx SELECTED_CHAR_KIND(R) Description. Returns the value of the kind type parameter of the character set named by its argument. Class. Transformational function. Argument. R shall be scalar and of type default character. Result Characteristics. Default integer scalar. Result. The result has a value equal to the value of t kind type parameter of the default or ASCII character data type if R has the value DEFAULT or ASCII. The result has the value of the kind type parameter of the ISO 10646 character data type if R has the value ISO10646 and the processor supports ISO 10646 characters, otherwise it has the value -1. The result has the value -1 if R is not the name of a supported character set. R is interpreted without respect to case or trailing blanks. Example. SELECTED_CHAR_KIND('ASCII') has the value 1 on a processor that uses 1 as the kind type parameter for the ACSII character set. Add J3 note, "ISO10646 refers to the 32 bit character set"