Document revision date: 19 July 1999
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

DEC C Run-Time Library Utilities Reference Manual


Previous Contents Index

2.4 LC_MESSAGES Category

The LC_MESSAGES category defines the format for affirmative and negative system responses. This category begins with the LC_MESSAGES header and ends with the END LC_MESSAGES trailer.

All operands for the LC_MESSAGES category are defined as strings or extended regular expressions bounded by double quotation marks ("). These operands are separated from the keyword they define by one or more blank characters (spaces or tabs). Two adjacent double quotation marks ("") indicate an undefined value.

Table 2-3 lists the statement keywords recognized in the LC_MESSAGES category.

Table 2-3 LC_MESSAGES Category Keywords
Keyword Description
copy Specifies the name of an existing locale to be used as the definition of this category.

If you specify a copy statement, you cannot specify any other keyword.

yesexpr Specifies an extended regular expression that describes the acceptable affirmative response to a question expecting an affirmative or negative response.
noexpr Specifies an extended regular expression that describes the acceptable negative response to a question expecting an affirmative or negative response.
yesstr Specifies the locale's equivalent of an acceptable affirmative response.

This string is accessible to applications through the nl_langinfo subroutine as nl_langinfo (YESSTR). Note that yesstr is likely to be withdrawn from the XPG4 standard; yesexpr is the recommended alternative.

nostr Specifies the locale's equivalent of an acceptable negative response.

This string is accessible to applications through the nl_langinfo subroutine as nl_langinfo (NOSTR). Note that nostr is likely to be withdrawn from the XPG4 standard; noexpr is the recommended alternative.

The following is a sample LC_MESSAGES category specified in a locale definition source file:


LC_MESSAGES 
# 
yesexpr "<circumflex><left-square-bracket><y><Y>\
<right-square-bracket>" 
noexpr  "<circumflex><left-square-bracket><n><N>\
<right-square-bracket>" 
yesstr  "<y><e><s>" 
nostr   "<n><o>" 
# 
END LC_MESSAGES 

2.5 LC_MONETARY Category

The LC_MONETARY category defines rules and symbols for formatting monetary numeric information. This category begins with the LC_MONETARY header and ends with the END LC_MONETARY trailer.

2.5.1 LC_MONETARY Keywords

All operands for the LC_MONETARY category keywords are defined as string or integer values. String values are bounded by double quotation marks ("). All values are separated from the keyword they define by one or more blank characters (spaces or tabs). Two adjacent double quotation marks ("") indicate an undefined string value. A negative one (--1) indicates an undefined integer value.

Table 2-4 lists the statement keywords recognized in the LC_MONETARY category.

Table 2-4 LC_MONETARY Category Keywords
Keyword Description
copy Specifies the name of an existing locale to be used as the definition of this category.

If you specify a copy statement, you cannot specify any other keyword.

int_curr_symbol Specifies the string used for the international currency symbol.

The operand for this keyword is a 4-character string+. The first three characters contain the alphabetic international currency symbol. The fourth character defines a character separator for insertion between the international currency symbol and a monetary quantity.

currency_symbol Specifies the string used for the local currency symbol.
mon_decimal_point Specifies the decimal delimiter string used for formatting monetary quantities.
mon_thousands_sep Specifies the character separator used for grouping digits to the left of the decimal delimiter in formatted monetary quantities.
mon_grouping Specifies a string that defines the size of each group of digits in formatted monetary quantities.

The operand for this keyword consists of a sequence of integers separated by semicolons. Each integer specifies the number of digits in a group. The first integer defines the size of the group immediately to the left of the decimal delimiter. Subsequent integers define succeeding groups to the left of the previous group. If the last integer is not --1, it is used to group any remaining digits. If the last integer is --1, no further grouping is performed.

A sample interpretation of the mon_grouping statement follows. Assuming a value of 123456789 to be formatted and a mon_thousands_sep operand of ' (single quotation mark), the following results occur:
mon_grouping Formatted Value
3;-1 123456'789
3 123'456'789
3;2;-1 1234'56'789
3;2 12'34'56'789

positive_sign Specifies the string used to indicate a nonnegative-formatted monetary quantity.
negative_sign Specifies the string used to indicate a negative-formatted monetary quantity.
int_frac_digits Specifies an integer value representing the number of fractional digits (those after the decimal delimiter) to be displayed in a formatted monetary quantity using the int_curr_symbol value.
frac_digits Specifies an integer value representing the number of fractional digits (those after the decimal delimiter) to be displayed in a formatted monetary quantity using the currency_symbol value.
p_cs_precedes Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string precedes or follows the value for a nonnegative-formatted monetary quantity.

The following integer values are recognized:
0 The currency symbol follows the monetary quantity.
1 The currency symbol precedes the monetary quantity.

p_sep_by_space Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string is separated by a space from a nonnegative-formatted monetary quantity.

The following integer values are recognized:
0 No space separates the currency symbol from the monetary quantity.
1 A space separates the currency symbol from the monetary quantity.
2 A space separates the currency symbol and the positive_sign string, if adjacent.

n_cs_precedes Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string precedes or follows the value for a negative-formatted monetary quantity.

The following integer values are recognized:
0 The currency symbol follows the monetary quantity.
1 The currency symbol precedes the monetary quantity.

n_sep_by_space Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string is separated by a space from a negative-formatted monetary quantity.

The following integer values are recognized:
0 No space separates the currency symbol from the monetary quantity.
1 A space separates the currency symbol from the monetary quantity.
2 A space separates the currency symbol and the negative_sign string, if adjacent.

p_sign_posn Specifies an integer value indicating the positioning of the positive_sign string for a nonnegative-formatted monetary quantity.

The following integer values are recognized:
0 A left parenthesis and right parenthesis symbol enclose both the monetary quantity and the int_curr_symbol or currency_symbol string.
1 The positive_sign string precedes the quantity and the int_curr_symbol or currency_symbol string.
2 The positive_sign string follows the quantity and the int_curr_symbol or currency_symbol string.
3 The positive_sign string immediately precedes the int_curr_symbol or currency_symbol string.
4 The positive_sign string immediately follows the int_curr_symbol or currency_symbol string.

n_sign_posn Specifies an integer value indicating the positioning of the negative_sign string for a negative-formatted monetary quantity.

The following integer values are recognized:
0 A left parenthesis and right parenthesis symbol enclose both the monetary quantity and the int_curr_symbol or currency_symbol string.
1 The negative_sign string precedes the quantity and the int_curr_symbol or currency_symbol string.
2 The negative_sign string follows the quantity and the int_curr_symbol or currency_symbol string.
3 The negative_sign string immediately precedes the int_curr_symbol or currency_symbol string.
4 The negative_sign string immediately follows the int_curr_symbol or currency_symbol string.


+The current implementation of the DEC C Run-Time Library allows more than four characters to be specified. However, the user should not rely on this fact and use it exactly as specified. The 4-character limit will be implemented in a future version of the DEC C Run-Time Library.

2.5.2 Monetary Format Variations

You can produce a unique customized monetary format by changing the value of a single statement. Table 2-5 shows the results of using all combinations of defined values for the p_cs_precedes, p_sep_by_space, and p_sign_posn statements.

Table 2-5 Monetary Format Variations
  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$+

The following is a sample LC_MONETARY category specified in a locale definition source file:


LC_MONETARY 
# 
int_curr_symbol         "<U><S><D><space>" 
currency_symbol         "<dollar-sign>" 
mon_decimal_point       "<period>" 
mon_thousands_sep       "<comma>" 
mon_grouping            3 
positive_sign           "<plus-sign>" 
negative_sign           "<hyphen>" 
int_frac_digits         2 
frac_digits             2 
p_cs_precedes           1 
p_sep_by_space          2 
n_cs_precedes           1 
n_sep_by_space          2 
p_sign_posn             3 
n_sign_posn             3 
# 
END LC_MONETARY 

2.6 LC_NUMERIC Category

The LC_NUMERIC category defines rules and symbols for formatting nonmonetary numeric information. This category begins with the LC_NUMERIC and ends with the END LC_NUMERIC trailer.

All operands for the LC_NUMERIC category keywords are defined as string or integer values. String values are bounded by double quotation marks ("). All values are separated from the keyword they define by one or more blank characters (spaces or tabs). Two adjacent double quotation characters ("") indicate an undefined string value. A negative one (--1) indicates an undefined integer value.

Table 2-6 lists the statement keywords recognized in the LC_NUMERIC category.

Table 2-6 LC_NUMERIC Category Keywords
Keyword Description
copy Specifies the name of an existing locale to be used as the definition of this category.

If you specify a copy statement, you cannot specify any other keyword.

decimal_point Specifies the decimal delimiter string used to format nonmonetary numeric quantities.

This keyword cannot be omitted and cannot be set to the undefined string value.

thousands_sep Specifies the string separator used for grouping digits to the left of the decimal delimiter in formatted nonmonetary numeric quantities.
grouping Defines the size of each group of digits in formatted monetary quantities.

The operand for the grouping keyword consists of a sequence of integers separated by semicolons. Each integer specifies the number of digits in a group. The first integer defines the size of the group immediately to the left of the decimal delimiter. Subsequent integers define succeeding groups to the left of the previous group. Grouping is performed for each integer specified for the grouping keyword. If the last integer is not --1, it is used repeatedly to group any remaining digits. If the last integer is --1, no more grouping is performed.

A sample interpretation of the grouping statement follows. Assuming a value of 123456789 to be formatted and a thousands_sep operand of ' (single quotation mark), the following results occur:
mon_grouping Formatted Value
3;-1 123456'789
3 123'456'789
3;2;-1 1234'56'789
3;2 12'34'56'789

The following is a sample LC_NUMERIC category specified in a locale definition source file:


LC_NUMERIC 
# 
decimal_point   "<period>" 
thousands_sep   "<comma>" 
grouping        <3> 
# 
END LC_NUMERIC 

2.7 LC_TIME Category

The LC_TIME category defines rules and symbols for formatting time and date information. This category begins with the LC_TIME category header and ends with the END LC_TIME trailer.

All operands for the LC_TIME category keywords are defined as string or integer values. String values are bounded by double quotation marks ("). All values are separated from the keyword they define by one or more blank characters (spaces or tabs). Two adjacent double quotation characters ("") indicate an undefined string value. Field descriptors, described later in this section, are used by commands and subroutines that query the LC_TIME category to represent elements of time and date formats.

2.7.1 Keywords

Table 2-7 lists the statement keywords recognized in the LC_TIME category.

Table 2-7 LC_TIME Category Keywords
Keyword Description
copy Specifies the name of an existing locale to be used as the definition of this category.

If you specify a copy statement, you cannot specify any other keyword.

abday Defines the abbreviated weekday names corresponding to the %a field descriptor.

Recognized values consist of seven strings separated by semicolons. The first string corresponds to the abbreviated name for the first day of the week (Sun), the second to the abbreviated name for the second day of the week, and so on.

day Defines the full spelling of the weekday names corresponding to the %A field descriptor.

Recognized values consist of seven strings separated by semicolons. The first string corresponds to the full spelling of the name of the first day of the week (Sunday), the second to the name of the second day of the week, and so on.

abmon Defines the abbreviated month names corresponding to the %b field descriptor.

Recognized values consist of 12 strings separated by semicolons. The first string corresponds to the abbreviated name for the first month of the year (Jan), the second to the abbreviated name for the second month of the year, and so on.

mon Defines the full spelling of the month names corresponding to the %B field descriptor.

Recognized values consist of 12 strings separated by semicolons. The first string corresponds to the full spelling of the name for the first month of the year (January), the second to the full spelling of the name for the second month of the year, and so on.

d_t_fmt Defines the string used for the standard date-and-time format corresponding to the %c field descriptor. The string can contain any combination of characters and field descriptors.
d_fmt Defines the string used for the standard date format corresponding to the %x field descriptor. The string can contain any combination of characters and field descriptors.
t_fmt Defines the string used for the standard time format corresponding to the %X field descriptor. The string can contain any combination of characters and field descriptors.
am_pm Defines the strings used to represent a.m. (before noon) and p.m. (afternoon) corresponding to the %p field descriptor.

Recognized values consist of two strings separated by semicolons. The first string corresponds to the a.m. designation, the second string corresponds to the p.m. designation.

t_fmt_ampm Defines the string used for the standard 12-hour time format that includes an am_pm value (%p field descriptor).

This statement corresponds to the %r field descriptor. The string can contain any combination of characters and field descriptors. If the string is empty, the 12-hour format is not supported by the locale.

era Defines how the years are counted and displayed for each era in a locale, corresponding to the %E field descriptor modifier.

For each era, there must be one string in the following format:

direction: offset: start_date: end_date: name: format

The variables for the era string format are defined as follows:

  • direction --- Specifies a minus (-) or a plus (+) character.

    The minus character (-) indicates that years count in the negative direction when moving from the start date to the end date. The plus character (+) indicates that years count in the positive direction when moving from the start date to the end date.

  • offset --- Specifies a number representing the first year of the era corresponding to the %Ey field descriptor.
  • start_date --- Specifies the starting date of the era in yyyy/mm/dd format, where yyyy, mm, and dd are the year, month, and day, respectively, on the Gregorian calendar.

    Years prior to the year A.D. 1 are represented as negative numbers. For example, an era beginning March 5 in the year 100 B.C. would be represented as -100/03/05.

  • end_date --- Specifies the ending date of the era in the same form used for the start_date variable or one of the two special values -* or +*.

    A -* value indicates that the ending date of the era extends backward to the beginning of time. A +* value indicates that the ending date of the era extends forward to the end of time. Therefore, the ending date can be chronologically before or after the starting date of the era. For example, the strings for the Christian eras A.D. and B.C. would be entered, respectively, in the following way:

     +:0:0000/01/01:+*:AD:%Ey %EC
    
    +:1:-0001/12/31:-*:BC:%Ey %EC
  • name --- Specifies a string representing the name of the era that is substituted for the %EC field descriptor.
  • format --- Specifies a strftime, strptime, and wcsftime format string to use when formatting the %EY field descriptor.

    This string can contain any strftime, strptime, and wcsftime format control characters (except %EY) and locale-dependent multibyte characters.

An era value consists of one string (enclosed in quotation marks) for each era. If more than one era is specified, each era string is separated by a semicolon (;).

era_d_fmt Defines the string used to represent the date in alternate-era format corresponding to the %Ex field descriptor. The string can contain any combination of characters and field descriptors.
era_t_fmt Defines the locale's alternative time format as represented by the %EX field descriptor for strftime, strptime, and wcsftime.
era_d_t_fmt Defines the locale's alternative date-and-time format as represented by the %Ec field descriptor for strftime, strptime, and wcsftime.
alt_digits Defines alternate strings for digits corresponding to the %O field descriptor.

Recognized values consist of a group of strings separated by semicolons. The first string represents the alternate string for 0 (zero), the second string represents the alternate string for 1, and so on. You can specify a maximum of 100 alternate strings.


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6494PRO_002.HTML