1 // Locale support -*- C++ -*-
2 
3 // Copyright (C) 1999-2018 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 //
26 // ISO C++ 14882: 22.1  Locales
27 //
28 
29 #ifndef _GLIBCXX_USE_CXX11_ABI
30 // Instantiations in this file use the old COW std::string ABI unless included
31 // by another file which defines _GLIBCXX_USE_CXX11_ABI=1. Some instantiations
32 // are guarded by a check for !_GLIBCXX_USE_CXX11_ABI so that they are only
33 // instantiated once, because they are not tagged with abi_tag so should not
34 // be instantiated twice.
35 # define _GLIBCXX_USE_CXX11_ABI 0
36 #endif
37 
38 #include <locale>
39 
40 // Instantiation configuration.
41 #ifndef C
42 # define C char
43 # define C_is_char
44 #endif
45 
46 namespace std _GLIBCXX_VISIBILITY(default)
47 {
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 
50   // moneypunct, money_get, and money_put
51 #if ! _GLIBCXX_USE_CXX11_ABI
52   template struct __moneypunct_cache<C, false>;
53   template struct __moneypunct_cache<C, true>;
54 #endif
55 _GLIBCXX_BEGIN_NAMESPACE_CXX11
56   template class moneypunct<C, false>;
57   template class moneypunct<C, true>;
58   template class moneypunct_byname<C, false>;
59   template class moneypunct_byname<C, true>;
60 _GLIBCXX_END_NAMESPACE_CXX11
61 _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
62   template class money_get<C, istreambuf_iterator<C> >;
63   template class money_put<C, ostreambuf_iterator<C> >;
64   template
65     istreambuf_iterator<C>
66     money_get<C, istreambuf_iterator<C> >::
67     _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
68 		     ios_base&, ios_base::iostate&, string&) const;
69 
70   template
71     istreambuf_iterator<C>
72     money_get<C, istreambuf_iterator<C> >::
73     _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
74 		      ios_base&, ios_base::iostate&, string&) const;
75 
76   template
77     ostreambuf_iterator<C>
78     money_put<C, ostreambuf_iterator<C> >::
79     _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C,
80 		    const string_type&) const;
81 
82   template
83     ostreambuf_iterator<C>
84     money_put<C, ostreambuf_iterator<C> >::
85     _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
86 		     const string_type&) const;
87 _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
88 
89   // numpunct, numpunct_byname, num_get, and num_put
90 #if ! _GLIBCXX_USE_CXX11_ABI
91   template struct __numpunct_cache<C>;
92 #endif
93 _GLIBCXX_BEGIN_NAMESPACE_CXX11
94   template class numpunct<C>;
95   template class numpunct_byname<C>;
96 _GLIBCXX_END_NAMESPACE_CXX11
97 _GLIBCXX_BEGIN_NAMESPACE_LDBL
98 #if ! _GLIBCXX_USE_CXX11_ABI
99   template class num_get<C, istreambuf_iterator<C> >;
100 #endif
101 
102   template
103     istreambuf_iterator<C>
104     num_get<C, istreambuf_iterator<C> >::
105     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
106 		   ios_base&, ios_base::iostate&,
107 		   long&) const;
108 
109   template
110     istreambuf_iterator<C>
111     num_get<C, istreambuf_iterator<C> >::
112     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
113 		   ios_base&, ios_base::iostate&,
114 		   unsigned short&) const;
115 
116   template
117     istreambuf_iterator<C>
118     num_get<C, istreambuf_iterator<C> >::
119     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
120 		   ios_base&, ios_base::iostate&,
121 		   unsigned int&) const;
122 
123   template
124     istreambuf_iterator<C>
125     num_get<C, istreambuf_iterator<C> >::
126     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
127 		   ios_base&, ios_base::iostate&,
128 		   unsigned long&) const;
129 
130 #ifdef _GLIBCXX_USE_LONG_LONG
131   template
132     istreambuf_iterator<C>
133     num_get<C, istreambuf_iterator<C> >::
134     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
135 		   ios_base&, ios_base::iostate&,
136 		   long long&) const;
137 
138   template
139     istreambuf_iterator<C>
140     num_get<C, istreambuf_iterator<C> >::
141     _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
142 		   ios_base&, ios_base::iostate&,
143 		   unsigned long long&) const;
144 #endif
145 
146 #if ! _GLIBCXX_USE_CXX11_ABI
147   template class num_put<C, ostreambuf_iterator<C> >;
148 
149   template
150     ostreambuf_iterator<C>
151     num_put<C, ostreambuf_iterator<C> >::
152     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
153 		  long) const;
154 
155   template
156     ostreambuf_iterator<C>
157     num_put<C, ostreambuf_iterator<C> >::
158     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
159 		  unsigned long) const;
160 
161 #ifdef _GLIBCXX_USE_LONG_LONG
162   template
163     ostreambuf_iterator<C>
164     num_put<C, ostreambuf_iterator<C> >::
165     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
166 		  long long) const;
167 
168   template
169     ostreambuf_iterator<C>
170     num_put<C, ostreambuf_iterator<C> >::
171     _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
172 		  unsigned long long) const;
173 #endif
174 
175   template
176     ostreambuf_iterator<C>
177     num_put<C, ostreambuf_iterator<C> >::
178     _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
179 		    double) const;
180 
181   template
182     ostreambuf_iterator<C>
183     num_put<C, ostreambuf_iterator<C> >::
184     _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
185 		    long double) const;
186 #endif
187 _GLIBCXX_END_NAMESPACE_LDBL
188 
189   // time_get and time_put
190 #if ! _GLIBCXX_USE_CXX11_ABI
191   template class __timepunct<C>;
192   template struct __timepunct_cache<C>;
193   template class time_put<C, ostreambuf_iterator<C> >;
194   template class time_put_byname<C, ostreambuf_iterator<C> >;
195 #else
196   // Instantiate constructor taking __cxx11::string
197   template time_put_byname<C>::time_put_byname(const string&, size_t);
198 #endif
199 _GLIBCXX_BEGIN_NAMESPACE_CXX11
200   template class time_get<C, istreambuf_iterator<C> >;
201   template class time_get_byname<C, istreambuf_iterator<C> >;
202 _GLIBCXX_END_NAMESPACE_CXX11
203 
204   // messages
205 _GLIBCXX_BEGIN_NAMESPACE_CXX11
206   template class messages<C>;
207   template class messages_byname<C>;
208 _GLIBCXX_END_NAMESPACE_CXX11
209 
210   // ctype
ctype_byname(const string & __s,size_t __refs)211   ctype_byname<C>::ctype_byname(const string& __s, size_t __refs)
212   : ctype_byname(__s.c_str(), __refs) { }
213 
214 #if ! _GLIBCXX_USE_CXX11_ABI
215   inline template class __ctype_abstract_base<C>;
216   template class ctype_byname<C>;
217 #endif
218 
219   // codecvt
220 #if ! _GLIBCXX_USE_CXX11_ABI
221   inline template class __codecvt_abstract_base<C, char, mbstate_t>;
222   template class codecvt_byname<C, char, mbstate_t>;
223 #else
224   // Instantiate constructor taking __cxx11::string
225   template codecvt_byname<C, char, mbstate_t>::codecvt_byname(const string&, size_t);
226 #endif
227 
228   // collate
229 _GLIBCXX_BEGIN_NAMESPACE_CXX11
230   template class collate<C>;
231   template class collate_byname<C>;
232 _GLIBCXX_END_NAMESPACE_CXX11
233 
234   // use_facet
235 #if ! _GLIBCXX_USE_CXX11_ABI
236   template
237     const ctype<C>&
238     use_facet<ctype<C> >(const locale&);
239 
240   template
241     const codecvt<C, char, mbstate_t>&
242     use_facet<codecvt<C, char, mbstate_t> >(const locale&);
243 #endif
244 
245   template
246     const collate<C>&
247     use_facet<collate<C> >(const locale&);
248 
249   template
250     const numpunct<C>&
251     use_facet<numpunct<C> >(const locale&);
252 
253 #if ! _GLIBCXX_USE_CXX11_ABI
254   template
255     const num_put<C>&
256     use_facet<num_put<C> >(const locale&);
257 
258   template
259     const num_get<C>&
260     use_facet<num_get<C> >(const locale&);
261 #endif
262 
263   template
264     const moneypunct<C, true>&
265     use_facet<moneypunct<C, true> >(const locale&);
266 
267   template
268     const moneypunct<C, false>&
269     use_facet<moneypunct<C, false> >(const locale&);
270 
271   template
272     const money_put<C>&
273     use_facet<money_put<C> >(const locale&);
274 
275   template
276     const money_get<C>&
277     use_facet<money_get<C> >(const locale&);
278 
279 #if ! _GLIBCXX_USE_CXX11_ABI
280   template
281     const __timepunct<C>&
282     use_facet<__timepunct<C> >(const locale&);
283 
284   template
285     const time_put<C>&
286     use_facet<time_put<C> >(const locale&);
287 #endif
288 
289   template
290     const time_get<C>&
291     use_facet<time_get<C> >(const locale&);
292 
293   template
294     const messages<C>&
295     use_facet<messages<C> >(const locale&);
296 
297   // has_facet
298 #if ! _GLIBCXX_USE_CXX11_ABI
299   template
300     bool
301     has_facet<ctype<C> >(const locale&);
302 
303   template
304     bool
305     has_facet<codecvt<C, char, mbstate_t> >(const locale&);
306 #endif
307 
308   template
309     bool
310     has_facet<collate<C> >(const locale&);
311 
312   template
313     bool
314     has_facet<numpunct<C> >(const locale&);
315 
316 #if ! _GLIBCXX_USE_CXX11_ABI
317   template
318     bool
319     has_facet<num_put<C> >(const locale&);
320 
321   template
322     bool
323     has_facet<num_get<C> >(const locale&);
324 #endif
325 
326   template
327     bool
328     has_facet<moneypunct<C> >(const locale&);
329 
330   template
331     bool
332     has_facet<money_put<C> >(const locale&);
333 
334   template
335     bool
336     has_facet<money_get<C> >(const locale&);
337 
338 #if ! _GLIBCXX_USE_CXX11_ABI
339   template
340     bool
341     has_facet<__timepunct<C> >(const locale&);
342 
343   template
344     bool
345     has_facet<time_put<C> >(const locale&);
346 #endif
347 
348   template
349     bool
350     has_facet<time_get<C> >(const locale&);
351 
352   template
353     bool
354     has_facet<messages<C> >(const locale&);
355 
356 
357 #if ! _GLIBCXX_USE_CXX11_ABI
358   // locale functions.
359   template
360     C*
361     __add_grouping<C>(C*, C, char const*, size_t,
362 			 C const*, C const*);
363 
364   template class __pad<C, char_traits<C> >;
365 
366   template
367     int
368     __int_to_char(C*, unsigned long, const C*,
369 		  ios_base::fmtflags, bool);
370 
371 #ifdef _GLIBCXX_USE_LONG_LONG
372   template
373     int
374     __int_to_char(C*, unsigned long long, const C*,
375 		  ios_base::fmtflags, bool);
376 #endif
377 #endif
378 
379 _GLIBCXX_END_NAMESPACE_VERSION
380 } // namespace
381 
382 // XXX GLIBCXX_ABI Deprecated
383 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char \
384       && _GLIBCXX_USE_CXX11_ABI == 0
385 
386 #pragma GCC diagnostic ignored "-Wattribute-alias"
387 
388 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
389   extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
390 
391 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
392 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
393 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
394 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
395 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
396 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
397 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
398 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
399 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
400 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
401 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
402 		     _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
403 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_,
404 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_);
405 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_,
406 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_);
407 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_,
408 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_);
409 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_,
410 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_);
411 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_,
412 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_);
413 _GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_,
414 		     _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_);
415 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
416 		     _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
417 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
418 		     _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
419 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs,
420 		     _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs);
421 _GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs,
422 		     _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs);
423 
424 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
425