LOCALECONV(3,L) AIX Technical Reference LOCALECONV(3,L) ------------------------------------------------------------------------------- localeconv PURPOSE Sets components of an object type struct lconv with appropriate formatting values. SYNTAX #include <locale.h> struct lconv *localeconv (int category, const char *locale); DESCRIPTION The localeconv subroutine sets the components of an object type struct lconv with values appropriate for the formatting of numeric quantities (monetary and otherwise) according to rules of the current locale. The members of the structure with the type char * are pointers to strings, any of which (except decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. The members with type char are non-negative numbers, any of which can be CHAR_MAX, to indicate that the value is not available in current locale. The members include the following: +-------------------+-------------------------------------------------------+ | Variable | Description | +-------------------+-------------------------------------------------------+ | decimal_point | The decimal-point character used to format non- | | | monetary quantities. | +-------------------+-------------------------------------------------------+ | thousands_sep | The character used to separate groups of digits | | | before the decimal-point character in formatted non- | | | monetary quantities. | +-------------------+-------------------------------------------------------+ | grouping | A string whose elements indicate the size of each | | | group of digits in formatted non-monetary quantities. | +-------------------+-------------------------------------------------------+ | int_curr_symbol | The international currency symbol applicable to the | | | current locale. The first three characters contain | | | the alphabetic international currency symbol in | | | accordance with those specified in the ISO 4217 Codes | | | for the Representation of Currency and Funds. The | | | fourth character (immediately preceding the NULL | | | character) is the character used to separate the | | | international currency symbol from the monetary quan- | | | tity. | +-------------------+-------------------------------------------------------+ Processed November 7, 1990 LOCALECONV(3,L) 1
LOCALECONV(3,L) AIX Technical Reference LOCALECONV(3,L) +-------------------+-------------------------------------------------------+ | Variable | Description | +-------------------+-------------------------------------------------------+ | currency_symbol | The locale currency applicable to the current locale. | +-------------------+-------------------------------------------------------+ | mon_decimal_point | The decimal-point used to format monetary quantities. | +-------------------+-------------------------------------------------------+ | mon_thousands_sep | The separator for groups of digits before the | | | decimal-point in formatted monetary quantities. | +-------------------+-------------------------------------------------------+ | mon_grouping | A string whose elements indicate the size of each | | | group of digits in formatted monetary quantities. | +-------------------+-------------------------------------------------------+ | positive_sign | The strings used to indicate a non-negative-valued | | | formatted monetary quantity. | +-------------------+-------------------------------------------------------+ | negative_sign | The strings used to indicate a negative-valued for- | | | matted monetary quantity. | +-------------------+-------------------------------------------------------+ | int_frac_digits | The number of fractional digits (those after the | | | decimal-point) to be displayed in an internationally | | | formatted monetary quantity. | +-------------------+-------------------------------------------------------+ | frac_digits | The number of fractional digits (those after the | | | decimal-point) to be displayed in a formatted mone- | | | tary quantity. | +-------------------+-------------------------------------------------------+ | p_cs_precedes | Set to 1 or 0 if the currency_symbol respectively | | | precedes or succeeds the value for a non-negative | | | formatted monetary quantity. | +-------------------+-------------------------------------------------------+ | p_sep_by_space | Set to 1 or 0 if the currency_symbol is or is not | | | separated by a space from the value for a non- | | | negative formatted monetary quantity. | +-------------------+-------------------------------------------------------+ | n_cs_precedes | Set to 1 or 0 if the currency_symbol respectively | | | precedes or succeeds the value for a negative for- | | | matted monetary quantity. | +-------------------+-------------------------------------------------------+ | n_sep_by_space | Set to 1 or 0 if the currency_symbol is or is not | | | separated by a space from the value for a negative | | | formatted monetary quantity. | +-------------------+-------------------------------------------------------+ | p_sign_posn | Set to a value indicating the positioning of the | | | positive_sign for a non-negative formatted monetary. | +-------------------+-------------------------------------------------------+ | n_sign_posn | Set to a value indicating the positioning of the | | | negative_sign for a negative formatted monetary quan- | | | tity. | +-------------------+-------------------------------------------------------+ Processed November 7, 1990 LOCALECONV(3,L) 2
LOCALECONV(3,L) AIX Technical Reference LOCALECONV(3,L) +-----------------------------------------------------------------------------+ |The elements of grouping and mon_grouping are interpreted according to the | |following | +----------+------------------------------------------------------------------+ |Value | Description | +----------+------------------------------------------------------------------+ |CHAR_MAX | No further grouping is to be performed. | +----------+------------------------------------------------------------------+ |0 | The previous element is to be repeatedly used for the remainder | | | of digits. | +----------+------------------------------------------------------------------+ |other | The integer value is the number of digits that comprise the | | | current group. The next element is examined to determine the | | | size of the next group of digits before the current group. | +----------+------------------------------------------------------------------+ +-------------------------------------------+ |The value of p_sign_posn and n_sign_posn | |is interpreted according to the | |following. | +-----+-------------------------------------+ |Value| Description | +-----+-------------------------------------+ |0 | Parentheses surround the quantity | | | and currency_symbol. | +-----+-------------------------------------+ |1 | The sign string precedes the | | | quantity and currency_symbol. | +-----+-------------------------------------+ |2 | The sign string succeeds the | | | quantity and currency_symbol. | +-----+-------------------------------------+ |3 | The sign strings immediately | | | precedes the currency_symbol. | +-----+-------------------------------------+ |4 | The sign strings immediately | | | succeeds the currency_symbol. | +-----+-------------------------------------+ The implementation behaves as if no library functions call the localeconv function. EXAMPLES The following table illustrates the rules which may be used by four countries to format monetary quantities. Processed November 7, 1990 LOCALECONV(3,L) 3
LOCALECONV(3,L) AIX Technical Reference LOCALECONV(3,L) +---------------------------------------------------------------+ | Examples of Monetary Representations | +---------------+---------------+---------------+---------------+ | Country | Positive | Negative | International | | | Format | Format | 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 | Kr1.234,56 | kr11.234,56- | NOK 1.234,56 | +---------------+---------------+---------------+---------------+ | Switzerland | SFrs.1,234.56 | SFrs.1,234.56C| CHF 1,234.56 | +---------------+---------------+---------------+---------------+ Processed November 7, 1990 LOCALECONV(3,L) 4
LOCALECONV(3,L) AIX Technical Reference LOCALECONV(3,L) +----------------------------------------------------------------+ | For these four countries, the respective values for the mone- | | tary members of the structure returned by LOCALECONV are | +--------------------+-------------------------------------------+ | | Country | +--------------------+-------+------------+-------+--------------+ | Variable | Italy | Netherlands| Norway| Switzerland | +--------------------+-------+------------+-------+--------------+ | int_curr_symbol | "ITL."| "NLG" | "NOK" | "CHF" | +--------------------+-------+------------+-------+--------------+ | currency_symbol | "L." | "F" | "kr" | "SFrs." | +--------------------+-------+------------+-------+--------------+ | mon_decimal_point | "" | "," | "," | "." | +--------------------+-------+------------+-------+--------------+ | mon_thousands_sep | "." | "." | "." | "," | +--------------------+-------+------------+-------+--------------+ | mon_grouping | "3" | "3" | "3" | "3" | +--------------------+-------+------------+-------+--------------+ | positive_sign | "" | "" | "" | "" | +--------------------+-------+------------+-------+--------------+ | negative_sign | "-" | "-" | "-" | "C" | +--------------------+-------+------------+-------+--------------+ | int_frac_digits | 0 | 2 | 2 | 2 | +--------------------+-------+------------+-------+--------------+ | frac_digits | 0 | 2 | 2 | 2 | +--------------------+-------+------------+-------+--------------+ | p_cs_precedes | 1 | 1 | 1 | 1 | +--------------------+-------+------------+-------+--------------+ | p_sep_by_space | 0 | 1 | 0 | 0 | +--------------------+-------+------------+-------+--------------+ | n_cs_precedes | 1 | 1 | 1 | 1 | +--------------------+-------+------------+-------+--------------+ | n_sep_by_space | 0 | 1 | 0 | 0 | +--------------------+-------+------------+-------+--------------+ | p_sign_posn | 1 | 1 | 1 | 1 | +--------------------+-------+------------+-------+--------------+ | n_sign_posn | 1 | 4 | 2 | 2 | +--------------------+-------+------------+-------+--------------+ RETURN VALUE The localeconv subroutine returns a pointer to the filled-in object. The structure pointed to by the return value will not be modified by the program, but may be overwritten by a subsequent call to the localeconv subroutine. In addition, calls to the setlocale subroutine with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may overwrite the contents of the structure. Processed November 7, 1990 LOCALECONV(3,L) 5