blob: c53b27a959c05b1a493ace04bfd4e2865317f5be [file] [log] [blame]
Howard Hinnant3c78ca02011-09-22 19:10:18 +00001// -*- C++ -*-
2//===--------------------------- support/win32/locale.h --------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11// Locale stuff
12// FIXME: the *_l functions are fairly new, only available on Vista?/7+
13#include <xlocinfo.h> //
14#define locale_t _locale_t
15#define strtoll_l _strtoi64_l
16#define strtoull_l _strtoui64_l
17// FIXME: current msvcrt does not know about long double
18#define strtold_l _strtod_l
19#define isdigit_l _isdigit_l
20#define isxdigit_l _isxdigit_l
21#define newlocale _create_locale
22#define freelocale _free_locale
23// FIXME: first call _configthreadlocale(_ENABLE_PER_THREAD_LOCALE) somewhere
24// FIXME: return types are different, need to make locale_t from char*
25inline locale_t uselocale(locale_t newloc)
26{
27 return newlocale( LC_ALL, setlocale(LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale) );
28}
29
30#define LC_COLLATE_MASK _M_COLLATE
31#define LC_CTYPE_MASK _M_CTYPE
32#define LC_MONETARY_MASK _M_MONETARY
33#define LC_NUMERIC_MASK _M_NUMERIC
34#define LC_TIME_MASK _M_TIME
35#define LC_MESSAGES_MASK _M_MESSAGES
36
37enum { NL_SETD=0, NL_CAT_LOCALE=1 };