Chapter Contents |
Previous |
Next |
Localization |
SAS/C defines the following locales:
"S370"
|
is a locale that defines conventions traditionally associated with the 370 mainframe environment. |
"POSIX"
|
is a locale that defines conventions traditionally associated with UNIX implementations, as codified by the POSIX 1003.2 standard. |
"C"
|
is the locale in effect when your
program begins execution. For programs called with
exec
linkage, this is the same as the
"POSIX"
locale. For other programs, it is the
same as the
"S370"
locale. |
""
|
is a locale that represents the best
fit for local customs. The
""
locale interpretation is controlled by several environment variable
settings. See the
setlocale
function description for more information. |
Three other locales are supplied by the SAS/C Library.
For details on these locales, see Library-Supplied Locales.
As mentioned earlier, you can also supply your own locales; see User-Added Locales for details. A locale is divided
into categories, which define different parts of the whole locale.
You can change one category without having to change the entire locale.
For example, you can change the way currency is displayed without changing
the expression of dates and time. The categories of locale defined in
<locale.h>
are as follows:
LC_ALL
|
affects all the categories at once. |
LC_COLLATE
|
affects the collating sequence.
This changes how
strcoll
and
strxfrm
work. |
LC_CTYPE
|
affects how the character type macros
(such as
isgraph
) work.
LC_CTYPE
also affects the multibyte
functions (such as
mblen
and
wcstombs
) as well as
the treatment of multibyte characters by the formatted I/O functions (such
as
printf
and
sprintf
) and the string functions.
|
LC_MONETARY
|
affects how currency values are formatted. |
LC_NUMERIC
|
affects the character used for the decimal point. |
LC_TIME
|
affects how
strftime
formats time values. This category does
not affect the behavior of
asctime
. |
The Locale Structure lconv |
<locale.h>
defines the structure
struct lconv
. The standard members of this structure are explained in the following
list. The default
"C"
locale values, as defined by the ANSI and ISO C standards, are in parentheses
after the descriptions. A default value of CHAR_MAX indicates the information
is not available.
char *decimal_point
"."
)
char *thousands_sep
""
)
char *grouping
""
)
char *int_curr_symbol
""
)
char *currency_symbol
""
)
char *mon_decimal_point
""
)
char *mon_thousands_sep
""
)
char *mon_grouping
""
)
char *positive_sign
""
)
char *negative_sign
""
)
char int_frac_digits
CHAR_MAX
)
char frac_digits
CHAR_MAX
)
char p_cs_precedes
1
if the
currency_symbol
and a nonnegative monetary value are separated by a space, otherwise
it is set to
0
. (
CHAR_MAX
)
char p_sep_by_space
1
if the
currency_symbol
comes before a nonnegative monetary value; it is set to
0
if the
currency_symbol
comes after the value.
(
CHAR_MAX
)
char n_cs_precedes
1
if the
currency_symbol
and a negative monetary value are separated by a space, otherwise
it is set to
0
. (
CHAR_MAX
)
char n_sep_by_space
1
if the
currency_symbol
comes before a negative monetary value; it is set to
0
if the
currency_symbol
comes after the value. (
CHAR_MAX
)
char p_sign_posn
positive_sign
for
a nonnegative monetary value. (
CHAR_MAX
)
char n_sign_posn
negative_sign
for
a negative monetary value. (
CHAR_MAX
)
The elements of
grouping
and
mon_grouping
are defined by the following
values:
The value of
p_sign_posn
and
n_sign_posn
is defined by the following:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.