Cygwin: mmap: use 64K pages for bookkeeping, second attempt
[newlib-cygwin.git] / newlib / libc / locale / localeconv.c
blob5f34a785fa252c93c5cd80d4b0e826f2ed794e49
1 #include "newlib.h"
2 #include <reent.h>
3 #include "setlocale.h"
5 struct lconv *
6 __localeconv_l (struct __locale_t *locale)
8 struct lconv *lconv = &locale->lconv;
9 if (locale == __get_C_locale ())
10 return lconv;
12 #ifdef __HAVE_LOCALE_INFO__
13 const struct lc_numeric_T *n = __get_numeric_locale (locale);
14 const struct lc_monetary_T *m = __get_monetary_locale (locale);
16 lconv->decimal_point = (char *) n->decimal_point;
17 lconv->thousands_sep = (char *) n->thousands_sep;
18 lconv->grouping = (char *) n->grouping;
19 lconv->int_curr_symbol = (char *) m->int_curr_symbol;
20 lconv->currency_symbol = (char *) m->currency_symbol;
21 lconv->mon_decimal_point = (char *) m->mon_decimal_point;
22 lconv->mon_thousands_sep = (char *) m->mon_thousands_sep;
23 lconv->mon_grouping = (char *) m->mon_grouping;
24 lconv->positive_sign = (char *) m->positive_sign;
25 lconv->negative_sign = (char *) m->negative_sign;
26 lconv->int_frac_digits = m->int_frac_digits[0];
27 lconv->frac_digits = m->frac_digits[0];
28 lconv->p_cs_precedes = m->p_cs_precedes[0];
29 lconv->p_sep_by_space = m->p_sep_by_space[0];
30 lconv->n_cs_precedes = m->n_cs_precedes[0];
31 lconv->n_sep_by_space = m->n_sep_by_space[0];
32 lconv->p_sign_posn = m->p_sign_posn[0];
33 lconv->n_sign_posn = m->n_sign_posn[0];
34 #ifdef __HAVE_LOCALE_INFO_EXTENDED__
35 lconv->int_p_cs_precedes = m->int_p_cs_precedes[0];
36 lconv->int_p_sep_by_space = m->int_p_sep_by_space[0];
37 lconv->int_n_cs_precedes = m->int_n_cs_precedes[0];
38 lconv->int_n_sep_by_space = m->int_n_sep_by_space[0];
39 lconv->int_n_sign_posn = m->int_n_sign_posn[0];
40 lconv->int_p_sign_posn = m->int_p_sign_posn[0];
41 #else /* !__HAVE_LOCALE_INFO_EXTENDED__ */
42 lconv->int_p_cs_precedes = m->p_cs_precedes[0];
43 lconv->int_p_sep_by_space = m->p_sep_by_space[0];
44 lconv->int_n_cs_precedes = m->n_cs_precedes[0];
45 lconv->int_n_sep_by_space = m->n_sep_by_space[0];
46 lconv->int_n_sign_posn = m->n_sign_posn[0];
47 lconv->int_p_sign_posn = m->p_sign_posn[0];
48 #endif /* !__HAVE_LOCALE_INFO_EXTENDED__ */
49 #endif /* __HAVE_LOCALE_INFO__ */
50 return lconv;
53 struct lconv *
54 _localeconv_r (struct _reent *data)
56 /* Note that we always fall back to the global locale, even in case
57 of specifying a reent. Otherwise a call to _localeconv_r would just
58 crash if the reent locale pointer is NULL. */
59 return __localeconv_l (__get_current_locale ());
62 #ifndef _REENT_ONLY
63 struct lconv *
64 localeconv (void)
66 return __localeconv_l (__get_current_locale ());
68 #endif