This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
78
libsrc/common/locale.c
Normal file
78
libsrc/common/locale.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* locale.c
|
||||
*
|
||||
* Ullrich von Bassewitz, 11.12.1998
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <locale.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Data in this module is read-only, put it into the RODATA segment */
|
||||
#pragma dataseg ("RODATA");
|
||||
|
||||
/* For memory efficiency use a separate empty string */
|
||||
static const char EmptyString [] = "";
|
||||
|
||||
static struct lconv lc = {
|
||||
EmptyString, /* currency_symbol */
|
||||
".", /* decimal_point */
|
||||
EmptyString, /* grouping */
|
||||
EmptyString, /* int_curr_symbol */
|
||||
EmptyString, /* mon_decimal_point */
|
||||
EmptyString, /* mon_grouping */
|
||||
EmptyString, /* mon_thousands_sep */
|
||||
EmptyString, /* negative_sign */
|
||||
EmptyString, /* positive_sign */
|
||||
EmptyString, /* thousands_sep */
|
||||
CHAR_MAX, /* frac_digits */
|
||||
CHAR_MAX, /* int_frac_digits */
|
||||
CHAR_MAX, /* n_cs_precedes */
|
||||
CHAR_MAX, /* n_sep_by_space */
|
||||
CHAR_MAX, /* n_sign_posn */
|
||||
CHAR_MAX, /* p_cs_precedes */
|
||||
CHAR_MAX, /* p_sep_by_space */
|
||||
CHAR_MAX, /* p_sign_posn */
|
||||
};
|
||||
|
||||
/* Restore the old data segment name */
|
||||
#pragma dataseg ("DATA");
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
struct lconv* localeconv (void)
|
||||
{
|
||||
return &lc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char* setlocale (int, const char* locale)
|
||||
{
|
||||
if (locale == 0 || (locale [0] == 'C' && locale [1] == '\0') || locale [0] == '\0') {
|
||||
/* No change, or value already set, our locale is the "C" locale */
|
||||
return "C";
|
||||
} else {
|
||||
/* Cannot set this one */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user