Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Contains the source for all the system calls in libc
22 #include <sys/cdefs.h>
23 #include "localeinfo.h"
24 #include "lmonetary.h"
26 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
27 #include "libc_wsd_defs.h"
30 // Muzibour : Include #include <sys/cdefs.h> and then use the macro __BEGIN_DECLS
32 extern int __mlocale_changed;
34 int *GET_WSD_VAR_NAME(__mlocale_changed, g)();
35 #define __mlocale_changed (*GET_WSD_VAR_NAME(__mlocale_changed, g)())
38 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
40 extern unsigned char __clocale_set;
42 unsigned char *GET_WSD_VAR_NAME(__clocale_set, g)();
43 #define __clocale_set (*GET_WSD_VAR_NAME(__clocale_set, g)())
48 int _monetary_using_locale;
51 GET_GLOBAL_VAR_FROM_TLS(_monetary_using_locale, int)
52 #define _monetary_using_locale (*GET_WSD_VAR_NAME(_monetary_using_locale, g)())
56 static char empty[] = "";
57 static char numempty[] = { CHAR_MAX, '\0'};
59 static const char empty[] = "";
60 static const char numempty[] = { CHAR_MAX, '\0'};
64 static const struct lc_monetary_T _C_monetary_locale = {
65 empty, /* int_curr_symbol */
66 empty, /* currency_symbol */
67 empty, /* mon_decimal_point */
68 empty, /* mon_thousands_sep */
69 numempty, /* mon_grouping */
70 empty, /* positive_sign */
71 empty, /* negative_sign */
72 numempty, /* int_frac_digits */
73 numempty, /* frac_digits */
74 numempty, /* p_cs_precedes */
75 numempty, /* p_sep_by_space */
76 numempty, /* n_cs_precedes */
77 numempty, /* n_sep_by_space */
78 numempty, /* p_sign_posn */
79 numempty, /* n_sign_posn */
80 numempty, /* int_p_cs_precedes */
81 numempty, /* int_n_cs_precedes */
82 numempty, /* int_p_sep_by_space */
83 numempty, /* int_n_sep_by_space */
84 numempty, /* int_p_sign_posn */
85 numempty /* int_n_sign_posn */
91 __monetary_load_locale(const char* localeName)
93 //Get an instance of locale object
94 CLocale* locale = CLocale::GetInstance();
95 //Load the monetary(LC_MONETARY category) information
97 TRAPD(result,ret = locale->MonetaryLoadLocaleL(localeName));
98 if ((result != KErrNone) || (ret == -1))
102 __mlocale_changed = 1;
103 _monetary_using_locale = 1;
108 struct lc_monetary_T *
109 __get_current_monetary_locale(void)
111 //Retreive the monetary(LC_MONETARY category) information
112 if(_monetary_using_locale)
114 return (CLocale::GetCurrentMonetaryLocale());
116 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
117 else if(__clocale_set)
119 //return POSIX C locale monetary(LC_MONETARY category) information
120 return ((struct lc_monetary_T *)&_C_monetary_locale);
121 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
124 CLocale *l=CLocale::GetInstance();
125 TRAPD(result,l->MonetaryLoadLocaleL(NULL));
126 if (result != KErrNone)
130 return (CLocale::GetCurrentMonetaryLocale());
138 printf( "int_curr_symbol = %s\n"
139 "currency_symbol = %s\n"
140 "mon_decimal_point = %s\n"
141 "mon_thousands_sep = %s\n"
142 "mon_grouping = %s\n"
143 "positive_sign = %s\n"
144 "negative_sign = %s\n"
145 "int_frac_digits = %d\n"
147 "p_cs_precedes = %d\n"
148 "p_sep_by_space = %d\n"
149 "n_cs_precedes = %d\n"
150 "n_sep_by_space = %d\n"
152 "n_sign_posn = %d\n",
153 "int_p_cs_precedes = %d\n"
154 "int_p_sep_by_space = %d\n"
155 "int_n_cs_precedes = %d\n"
156 "int_n_sep_by_space = %d\n"
157 "int_p_sign_posn = %d\n"
158 "int_n_sign_posn = %d\n",
159 _monetary_locale.int_curr_symbol,
160 _monetary_locale.currency_symbol,
161 _monetary_locale.mon_decimal_point,
162 _monetary_locale.mon_thousands_sep,
163 _monetary_locale.mon_grouping,
164 _monetary_locale.positive_sign,
165 _monetary_locale.negative_sign,
166 _monetary_locale.int_frac_digits[0],
167 _monetary_locale.frac_digits[0],
168 _monetary_locale.p_cs_precedes[0],
169 _monetary_locale.p_sep_by_space[0],
170 _monetary_locale.n_cs_precedes[0],
171 _monetary_locale.n_sep_by_space[0],
172 _monetary_locale.p_sign_posn[0],
173 _monetary_locale.n_sign_posn[0],
174 _monetary_locale.int_p_cs_precedes[0],
175 _monetary_locale.int_p_sep_by_space[0],
176 _monetary_locale.int_n_cs_precedes[0],
177 _monetary_locale.int_n_sep_by_space[0],
178 _monetary_locale.int_p_sign_posn[0],
179 _monetary_locale.int_n_sign_posn[0]
182 #endif /* LOCALE_DEBUG */