Document revision date: 30 March 2001
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

Compaq C Run-Time Library Utilities Reference Manual


Previous Contents Index

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


LC_CTYPE 
#"alpha" is by default "upper" and "lower" 
#"alnum" is by definition "alpha" and "digit" 
#"print" is by default "alnum", "punct" and the space character 
#"graph" is by default "alnum" and "punct" 
#"tolower" is by default the reverse mapping of "toupper" 
# 
upper   <A>;<B>;<C>;<D>;<E>;<F>;<G>;<H>;<I>;<J>;<K>;<L>;<M>;\
        <N>;<O>;<P>;<Q>;<R>;<S>;<T>;<U>;<V>;<W>;<X>;<Y>;<Z> 
# 
lower   <a>;<b>;<c>;<d>;<e>;<f>;<g>;<h>;<i>;<j>;<k>;<l>;<m>;\
        <n>;<o>;<P>;<q>;<r>;<s>;<t>;<u>;<v>;<w>;<X>;<y>;<z> 
# 
digit   <zero>;<one>;<two>;<three>;<four>;<five>;<six>;\
        <seven>;<eight>;<nine> 
# 
space   <tab>;<newline>;<vertical-tab>;<form-feed>;\
        <carriage-return>;<space> 
# 
cntrl   <alert>;<backspace>;<tab>;<newline>;<vertical-tab>;\
        <form-feed>;<carriage-return>;<NUL>;<SOH>;<STX>;\
        <ETX>;<EOT>;<ENQ>;<ACK>;<SO>;<SI>;<DLE>;<DC1>;<DC2>;\
        <DC3>;<DC4>;<NAK>;<SYN>;<ETB>;<CAN>;<EM>;<SUB>;\
        <ESC>;<IS4>;<IS3>;<IS2>;<IS1>;<DEL> 
# 
punct   <exclamation-mark>;<quotation-mark>;<number-sign>;\
        <dollar-sign>;<percent-sign>;<ampersand>;<asterisk>;\
        <apostrophe>;<left-parenthesis>;<right-parenthesis>;\
        <plus-sign>;<comma>;<hyphen>;<period>;<slash>;\
        <colon>;<semicolon>;<less-than-sign>;<equals-sign>;\
        <greater-than-sign>;<question-mark>;<commercial-at>;\
        <left-square-bracket>;<backslash>;<circumflex>;\
        <right-square-bracket>;<underline>;<grave-accent>;\
        <left-curly-bracket>;<vertical-line>;<tilde>;\
        <right-curly-bracket> 
# 
xdigit  <zero>;<one>;<two>;<three>;<four>;<five>;<six>;\
        <seven>;<eight>;<nine>;<A>;<B>;<C>;<D>;<E>;<F>;\
        <a>;<b>;<c>;<d>;<e>;<f> 
# 
blank   <space>;<tab> 
# 
toupper (<a>,<A>);(<b>,<B>);(<c>,<C>);(<d>,<D>);(<e>,<E>);\
        (<f>,<F>);(<g>,<G>);(<h>,<H>);(<i>,<I>);(<j>,<J>);\
        (<k>,<K>);(<l>,<L>);(<m>,<M>);(<n>,<N>);(<o>,<O>);\
        (<P>,<P>);(<q>,<Q>);(<r>,<R>);(<s>,<S>);(<t>,<T>);\
        (<u>,<U>);(<v>,<V>);(<w>,<W>);(<X>,<X>);(<y>,<Y>);\
        (<z>,<Z>) 
# 
END LC_CTYPE 

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 Compaq 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 Compaq 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 


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