]> git.sur5r.net Git - cc65/blob - libsrc/common/locale.c
This commit was generated by cvs2svn to compensate for changes in r2,
[cc65] / libsrc / common / locale.c
1 /*
2  * locale.c
3  *
4  * Ullrich von Bassewitz, 11.12.1998
5  */
6
7
8
9 #include <locale.h>
10 #include <limits.h>
11
12
13
14 /*****************************************************************************/
15 /*                                   Data                                    */
16 /*****************************************************************************/
17
18
19
20 /* Data in this module is read-only, put it into the RODATA segment */
21 #pragma dataseg ("RODATA");
22
23 /* For memory efficiency use a separate empty string */
24 static const char EmptyString [] = "";
25
26 static struct lconv lc = {
27     EmptyString,        /* currency_symbol */
28     ".",                /* decimal_point */
29     EmptyString,        /* grouping */
30     EmptyString,        /* int_curr_symbol */
31     EmptyString,        /* mon_decimal_point */
32     EmptyString,        /* mon_grouping */
33     EmptyString,        /* mon_thousands_sep */
34     EmptyString,        /* negative_sign */
35     EmptyString,        /* positive_sign */
36     EmptyString,        /* thousands_sep */
37     CHAR_MAX,           /* frac_digits */
38     CHAR_MAX,           /* int_frac_digits */
39     CHAR_MAX,           /* n_cs_precedes */
40     CHAR_MAX,           /* n_sep_by_space */
41     CHAR_MAX,           /* n_sign_posn */
42     CHAR_MAX,           /* p_cs_precedes */
43     CHAR_MAX,           /* p_sep_by_space */
44     CHAR_MAX,           /* p_sign_posn */
45 };
46
47 /* Restore the old data segment name */
48 #pragma dataseg ("DATA");
49
50
51
52 /*****************************************************************************/
53 /*                                   Code                                    */
54 /*****************************************************************************/
55
56
57
58 struct lconv* localeconv (void)
59 {
60     return &lc;
61 }
62
63
64
65 char* setlocale (int, const char* locale)
66 {
67     if (locale == 0 || (locale [0] == 'C' && locale [1] == '\0') || locale [0] == '\0') {
68         /* No change, or value already set, our locale is the "C" locale */
69         return "C";
70     } else {
71         /* Cannot set this one */
72         return 0;
73     }
74 }
75
76
77
78