From keld Tue Apr 14 14:34:33 1998 Received: (from keld@localhost) by dkuug.dk (8.6.12/8.6.12) id OAA06560 for sc22wg15; Tue, 14 Apr 1998 14:34:33 +0200 Message-Id: <199804141234.OAA06560@dkuug.dk> From: keld@dkuug.dk (Keld J|rn Simonsen) Date: Tue, 14 Apr 1998 14:34:32 +0200 X-Charset: ISO-8859-1 X-Char-Esc: 29 Mime-Version: 1.0 Content-Type: Text/Plain; Charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Mnemonic-Intro: 29 X-Mailer: Mail User's Shell (7.2.2 4/12/91) To: sc22wg15 Subject: c/POSIX alignment Here is the latest paper to WG14 on alignment with POSIX and WG20 standards. It is mostly intended for the SUWG group, to ascertain that we are going in the right direction, but the mail to the address I had for them bounced. /Keld Comments on SC22 N2620 7.3.2 There should only be one expected result for the toupper() and tolower() functions, respectively. 7.5.2.1 int_curr_symbol different from currency_symbol As there may be differences between the order of how local currency is written and how international currency is written, it is proposed to add the following members (none of which are part of the POSIX spec, but they are part of ISO/IEC FCD 14652) to the lconv struct, as follows: -------- Start Changed Section ---------- 7.5 Localization [#2] ... char int_p_cs_precedes; /* CHAR_MAX */ char int_p_sep_by_space; /* CHAR_MAX */ char int_n_cs_precedes; /* CHAR_MAX */ char int_n_sep_by_space; /* CHAR_MAX */ char int_p_sign_posn; /* CHAR_MAX */ char int_n_sign_posn; /* CHAR_MAX */ -------- End Changed Section ---------- -------- Start Changed Section ---------- 7.5.2.1 The localeconv function [#3] ... char int_p_cs_precedes Set to 1 or 0 if the int_curr_symbol respectively precedes or succeeds the value for a nonnegative formatted monetary quantity. char int_p_sep_by_space Set to 1 or 0 if the int_curr_symbol respectively is or is not separated by a space from the value for a nonnegative formatted monetary quantity. char int_n_cs_precedes Set to 1 or 0 if the int_curr_symbol respectively precedes or succeeds the value for a negative formatted monetary quantity. char int_n_sep_by_space Set to 1 or 0 if the int_curr_symbol respectively is or is not separated by a space from the value for a negative formatted monetary quantity. char int_p_sign_posn Set to a value indicating the positioning of the positive_sign for a nonnegative formatted monetary quantity. char int_n_sign_posn Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity. -------- End Changed Section ---------- In section 7.5.2.1 the examples need to be enhanced. There cannot be a point after ITL. Netherlands use a kind of small "f". Norway have at least a space between "kr" and the value. We need examples with all the new variables, int_p_cs_precedes etc. This is all done in the text below. -------- Start Changed Section ---------- 7.5.2.1 The localeconv function Examples [#8] The following table illustrates the rules which may well be used by five countries to format monetary quantities. Country Positive format Negative format International format Italy L.1.234 -L.1.234 ITL 1.234 Netherlands f 1.234,56 f -1.234,56 NLG 1.234,56 Norway kr 1.234,56 kr 1.234,56- NOK 1.234,56 Switzerland SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 Finland 1.234,56 mk -1.234,56 mk FIM 1.234,56 [#9] For these five countries, the respective values for the monetary members of the structure returned by localeconv are: Italy Netherlands Norway Switzerland Finland int_curr_symbol "ITL " "NLG " "NOK " "CHF " "FIM " currency_symbol "L." "f" "kr" "SFrs." "mk" mon_decimal_point "" "," "," "." "," mon_thousands_sep "." "." "." "," "." mon_grouping "\3" "\3" "\3" "\3" "\3" positive_sign "" "" "" "" "" negative_sign "-" "-" "-" "C" "-" int_frac_digits 0 2 2 2 2 frac_digits 0 2 2 2 2 p_cs_precedes 1 1 1 1 0 p_sep_by_space 0 1 0 0 1 n_cs_precedes 1 1 1 1 0 n_sep_by_space 0 1 0 0 1 p_sign_posn 1 1 1 1 1 n_sign_posn 1 4 2 2 1 int_p_cs_precedes 1 1 1 1 1 int_p_sep_by_space 0 1 0 0 1 int_n_cs_precedes 1 1 1 1 1 int_n_sep_by_space 0 1 0 0 1 int_p_sign_posn 1 1 1 1 1 int_n_sign_posn 1 4 2 2 4 -------- End Changed Section ---------- 7.4.2.1 p_sep_by_space and n_sep_by_space POSIX has added a third possibility for a formatted monetary quantity, so now we have: No space separates the currency_symbol from the value. A space separates the symbol from the value. *New* A space separates the symbol and the value, if these entities are next to eachother. The new parameter is required to properly display monetary amounts in Denmark and a number of other European countries. For example the format "DKK -1.234,56" is very common and not doable with the current C standard. -------- Start Changed Section ---------- 7.5.2.1 The localeconv function [#3] ... char p_sep_by_space Set to 0 if no space separates the currency_symbol from the value for a nonnegative formatted monetary quantity; set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the value, if adjacent. char n_sep_by_space Set to 0 if no space separates the currency_symbol from the value for a negative formatted monetary quantity; set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the value, if adjacent. char int_p_sep_by_space Set to 0 if no space separates the int_curr_symbol from the value for a nonnegative formatted monetary quantity; set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the value, if adjacent. char int_n_sep_by_space Set to 0 if no space separates the int_curr_symbol from the value for a negative formatted monetary quantity; set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the value, if adjacent. -------- End Changed Section ---------- ---------------- added section in rationale ----------------- This section should go into the rationale A table giving example formats for the combinations of p_cs_precedes, p_sign_posn and p_sep_by_space is given below, given that the positive_sign is "+" and the currency_symbol is "$". p_sep_by_space 2 1 0 p_cs_precedes = 1 p_sign_posn = 0 ($ 1.25) ($ 1.25) ($1.25) p_sign_posn = 1 + $1.25 +$ 1.25 +$1.25 p_sign_posn = 2 $1.25 + $ 1.25+ $1.25+ p_sign_posn = 3 + $1.25 +$ 1.25 +$1.25 p_sign_posn = 4 $ +1.25 $+ 1.25 $+1.25 p_cs_precedes = 0 p_sign_posn = 0 (1.25 $) (1.25 $) (1.25$) p_sign_posn = 1 +1.25 $ +1.25 $ +1.25$ p_sign_posn = 2 1.25$ + 1.25 $+ 1.25$+ p_sign_posn = 3 1.25+ $ 1.25 +$ 1.25+$ p_sign_posn = 4 1.25$ + 1.25 $+ 1.25$+ ------------------------------------------------------------------ 7.14.3.5 strftime The date utility in POSIX-2 4.15 and the strftime() function from the Open Group Single Unix Specification has all of the formats of C's strftime() plus more, all of which are proposed to be added to strftime(), ie merged with the current list: %C is replaced by the year divided by 100 and truncated to an integer, as a decimal number (00-99) %D is replaced by the date in the format mm/dd/yy %e is replaced by the day of the month as a decimal number (1-31 in a two-digit field with leading fill) %h a synonym for %b %n is replaced by a character %r is replaced by the 12 h clock time (01-12) using the AM/PM notation; in the "C" locale, this shall be equivalent to "%I:%M:%S %p" %R is replaced by the time in 24 hour notation (%H:%M) %t is replaced by a character A number of modified field descriptors %O and %E are also defined in POSIX.2 (4.15.4.2) or in The Open Group's strftime() definition. Text to be added for the C standard, after the "%%" definition: Some field descriptors can be modified by the E and O modifier characters to indicate a different format or specification as specified in the LC_TIME locale description. If the corresponding data (see era, era_year, era_d_fmt, and alt_digits) is not specified or not supported for the current locale, the unmodified field descriptor value shall be used. %Ec Locale's alternate date and time representation. %EC The name of the base year (period) in the locale's alternate representation. %Ex Locale's alternate date representation. %EX Locale's alternate time representation. %Ey Offset from %EC (year only) in the locale's alternate representation. %EY Full alternate year representation. %Od Day of month using the locale's alternate numeric symbols. %Oe Day of month using the locale's alternate numeric symbols. %OH Hour (24-hour clock) using the locale's alternate numeric symbols. %OI Hour (12-hour clock) using the locale's alternate numeric symbols. %Om Month using the locale's alternate numeric symbols. %OM Minutes using the locale's alternate numeric symbols. %OS Seconds using the locale's alternate numeric symbols. %Ou Weekday using the locale's alternate numeric symbols (Monday=1). %OU Week number of the year (Sunday as the first day of the week) using the locale's alternate numeric symbols. %OV Week number using the locale's alternate numeric symbols, using rules corresponding to %V. %Ow Weekday as number in the locale's alternate representation (Sunday=0). %OW Week number of the year (Monday as the first day of the week) using the locale's alternate numeric symbols. %Oy Year (offset from %C) in alternate representation. --------------------------------------------------