diff options
author | Howard Hinnant <hhinnant@apple.com> | 2011-09-23 20:11:27 +0400 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2011-09-23 20:11:27 +0400 |
commit | dbe8111948d372a6f7445e86a0ac985717fbe1bc (patch) | |
tree | c1b32170cbebef28cb095d90a69cbea28a050397 /libcxx/include/support | |
parent | a54fd541c23916eb65b252da1690516cb09f6731 (diff) |
Work on Windows port by Ruben Van Boxem
llvm-svn: 140384
Diffstat (limited to 'libcxx/include/support')
-rw-r--r-- | libcxx/include/support/win32/locale.h | 43 | ||||
-rw-r--r-- | libcxx/include/support/win32/support.h | 8 |
2 files changed, 47 insertions, 4 deletions
diff --git a/libcxx/include/support/win32/locale.h b/libcxx/include/support/win32/locale.h index c53b27a959c0..6be80acecb63 100644 --- a/libcxx/include/support/win32/locale.h +++ b/libcxx/include/support/win32/locale.h @@ -18,13 +18,44 @@ #define strtold_l _strtod_l #define isdigit_l _isdigit_l #define isxdigit_l _isxdigit_l -#define newlocale _create_locale +#define strcoll_l _strcoll_l +#define strxfrm_l _strxfrm_l +#define wcscoll_l _wcscoll_l +#define wcsxfrm_l _wcsxfrm_l +#define toupper_l _toupper_l +#define tolower_l _tolower_l +#define iswspace_l _iswspace_l +#define iswprint_l _iswprint_l +#define iswcntrl_l _iswcntrl_l +#define iswupper_l _iswupper_l +#define iswlower_l _iswlower_l +#define iswalpha_l _iswalpha_l +#define iswdigit_l _iswdigit_l +#define iswpunct_l _iswpunct_l +#define iswxdigit_l _iswxdigit_l +#define towupper_l _towupper_l +#define towlower_l _towlower_l +#define strftime_l _strftime_l +inline int isblank_l( int c, locale_t /*loc*/ ) +{ + return ( c == ' ' || c == '\t' ); +} +inline int iswblank_l( wint_t c, locale_t /*loc*/ ) +{ + return ( c == L' ' || c == L'\t' ); +} #define freelocale _free_locale +// ignore base; it is always 0 in libc++ code +inline locale_t newlocale( int mask, const char * locale, locale_t /*base*/ ) +{ + return _create_locale( mask, locale ); +} + // FIXME: first call _configthreadlocale(_ENABLE_PER_THREAD_LOCALE) somewhere // FIXME: return types are different, need to make locale_t from char* inline locale_t uselocale(locale_t newloc) { - return newlocale( LC_ALL, setlocale(LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale) ); + return _create_locale( LC_ALL, setlocale(LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale) ); } #define LC_COLLATE_MASK _M_COLLATE @@ -33,5 +64,9 @@ inline locale_t uselocale(locale_t newloc) #define LC_NUMERIC_MASK _M_NUMERIC #define LC_TIME_MASK _M_TIME #define LC_MESSAGES_MASK _M_MESSAGES - -enum { NL_SETD=0, NL_CAT_LOCALE=1 }; +#define LC_ALL_MASK ( LC_COLLATE_MASK \ + | LC_CTYPE_MASK \ + | LC_MESSAGES_MASK \ + | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK ) diff --git a/libcxx/include/support/win32/support.h b/libcxx/include/support/win32/support.h index 1a464bf7bfa2..48225690d7aa 100644 --- a/libcxx/include/support/win32/support.h +++ b/libcxx/include/support/win32/support.h @@ -12,4 +12,12 @@ Functions and constants used in libc++ that are missing from the Windows C library. */ +#if __MINGW32__ +#include <stdio.h> +#define swprintf snwprintf +#endif // __MINGW32__ int vasprintf( char **sptr, const char *__restrict__ fmt , va_list ap ); +size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src, + size_t nmc, size_t len, mbstate_t *__restrict__ ps ); +size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src, + size_t nwc, size_t len, mbstate_t *__restrict__ ps ); |