]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Locale/localeconv.c
1 /* $NetBSD: localeconv.c,v 1.13 2005/11/29 03:11:59 christos Exp $ */
4 * Written by J.T. Conklin <jtc@NetBSD.org>.
8 #include <sys/EfiCdefs.h>
9 #if defined(LIBC_SCCS) && !defined(lint)
10 __RCSID("$NetBSD: localeconv.c,v 1.13 2005/11/29 03:11:59 christos Exp $");
11 #endif /* LIBC_SCCS and not lint */
13 #include <sys/localedef.h>
17 * The localeconv() function constructs a struct lconv from the current
18 * monetary and numeric locales.
20 * Because localeconv() may be called many times (especially by library
21 * routines like printf() & strtod()), the approprate members of the
22 * lconv structure are computed only when the monetary or numeric
23 * locale has been changed.
25 int __mlocale_changed
= 1;
26 int __nlocale_changed
= 1;
29 * Return the current locale conversion.
34 static struct lconv ret
;
36 if (__mlocale_changed
) {
39 __UNCONST(_CurrentMonetaryLocale
->int_curr_symbol
);
41 __UNCONST(_CurrentMonetaryLocale
->currency_symbol
);
42 ret
.mon_decimal_point
=
43 __UNCONST(_CurrentMonetaryLocale
->mon_decimal_point
);
44 ret
.mon_thousands_sep
=
45 __UNCONST(_CurrentMonetaryLocale
->mon_thousands_sep
);
47 __UNCONST(_CurrentMonetaryLocale
->mon_grouping
);
49 __UNCONST(_CurrentMonetaryLocale
->positive_sign
);
51 __UNCONST(_CurrentMonetaryLocale
->negative_sign
);
52 ret
.int_frac_digits
= _CurrentMonetaryLocale
->int_frac_digits
;
53 ret
.frac_digits
= _CurrentMonetaryLocale
->frac_digits
;
54 ret
.p_cs_precedes
= _CurrentMonetaryLocale
->p_cs_precedes
;
55 ret
.p_sep_by_space
= _CurrentMonetaryLocale
->p_sep_by_space
;
56 ret
.n_cs_precedes
= _CurrentMonetaryLocale
->n_cs_precedes
;
57 ret
.n_sep_by_space
= _CurrentMonetaryLocale
->n_sep_by_space
;
58 ret
.p_sign_posn
= _CurrentMonetaryLocale
->p_sign_posn
;
59 ret
.n_sign_posn
= _CurrentMonetaryLocale
->n_sign_posn
;
60 ret
.int_p_cs_precedes
=
61 _CurrentMonetaryLocale
->int_p_cs_precedes
;
62 ret
.int_n_cs_precedes
=
63 _CurrentMonetaryLocale
->int_n_cs_precedes
;
64 ret
.int_p_sep_by_space
=
65 _CurrentMonetaryLocale
->int_p_sep_by_space
;
66 ret
.int_n_sep_by_space
=
67 _CurrentMonetaryLocale
->int_n_sep_by_space
;
68 ret
.int_p_sign_posn
= _CurrentMonetaryLocale
->int_p_sign_posn
;
69 ret
.int_n_sign_posn
= _CurrentMonetaryLocale
->int_n_sign_posn
;
70 __mlocale_changed
= 0;
73 if (__nlocale_changed
) {
76 __UNCONST(_CurrentNumericLocale
->decimal_point
);
78 __UNCONST(_CurrentNumericLocale
->thousands_sep
);
80 __UNCONST(_CurrentNumericLocale
->grouping
);
81 __nlocale_changed
= 0;