00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
#ifndef _C_LOCALE_H
00037
#define _C_LOCALE_H 1
00038
00039
#pragma GCC system_header
00040
00041
#include <cstring>
00042
#include <cstdio>
00043
#include <clocale>
00044
#include <langinfo.h>
00045
#include <iconv.h>
00046
#include <libintl.h>
00047
00048
#define _GLIBCXX_C_LOCALE_GNU 1
00049
00050
#define _GLIBCXX_NUM_CATEGORIES 6
00051
00052
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00053
namespace __gnu_cxx
00054 {
00055
extern "C" __typeof(uselocale) __uselocale;
00056 }
00057 #endif
00058
00059 namespace std
00060 {
00061
typedef __locale_t __c_locale;
00062
00063
00064
00065
00066
00067
template<
typename _Tv>
00068
int
00069 __convert_from_v(
char* __out,
const int __size,
const char* __fmt,
00070 #
if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00071 _Tv __v,
const __c_locale& __cloc,
int __prec = -1)
00072 {
00073 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
00074
#else
00075
_Tv __v,
const __c_locale&,
int __prec = -1)
00076 {
00077
char* __old = std::setlocale(LC_ALL, NULL);
00078
char* __sav =
new char[std::strlen(__old) + 1];
00079 std::strcpy(__sav, __old);
00080 std::setlocale(LC_ALL,
"C");
00081
#endif
00082
00083
int __ret;
00084
#ifdef _GLIBCXX_USE_C99
00085
if (__prec >= 0)
00086 __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
00087
else
00088 __ret = std::snprintf(__out, __size, __fmt, __v);
00089
#else
00090
if (__prec >= 0)
00091 __ret = std::sprintf(__out, __fmt, __prec, __v);
00092
else
00093 __ret = std::sprintf(__out, __fmt, __v);
00094
#endif
00095
00096
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00097
__gnu_cxx::__uselocale(__old);
00098
#else
00099
std::setlocale(LC_ALL, __sav);
00100
delete [] __sav;
00101
#endif
00102
return __ret;
00103 }
00104 }
00105
00106
#endif