Work on Windows port by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140384 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -687,12 +687,12 @@ move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst>
|
||||
|
||||
// swap_ranges
|
||||
|
||||
template <class _C1, class _C2>
|
||||
__bit_iterator<_C2, false>
|
||||
__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
|
||||
__bit_iterator<_C2, false> __result)
|
||||
template <class __C1, class __C2>
|
||||
__bit_iterator<__C2, false>
|
||||
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
|
||||
__bit_iterator<__C2, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C1, false> _I1;
|
||||
typedef __bit_iterator<__C1, false> _I1;
|
||||
typedef typename _I1::difference_type difference_type;
|
||||
typedef typename _I1::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||
@@ -737,12 +737,12 @@ __swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, fa
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C1, class _C2>
|
||||
__bit_iterator<_C2, false>
|
||||
__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
|
||||
__bit_iterator<_C2, false> __result)
|
||||
template <class __C1, class __C2>
|
||||
__bit_iterator<__C2, false>
|
||||
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
|
||||
__bit_iterator<__C2, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C1, false> _I1;
|
||||
typedef __bit_iterator<__C1, false> _I1;
|
||||
typedef typename _I1::difference_type difference_type;
|
||||
typedef typename _I1::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||
@@ -837,11 +837,11 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C1, class _C2>
|
||||
template <class __C1, class __C2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C2, false>
|
||||
swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
|
||||
__bit_iterator<_C2, false> __first2)
|
||||
__bit_iterator<__C2, false>
|
||||
swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
|
||||
__bit_iterator<__C2, false> __first2)
|
||||
{
|
||||
if (__first1.__ctz_ == __first2.__ctz_)
|
||||
return __swap_ranges_aligned(__first1, __last1, __first2);
|
||||
@@ -1213,15 +1213,15 @@ private:
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C2, false>);
|
||||
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C2, false>);
|
||||
template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C1, false>,
|
||||
__bit_iterator<_C2, false>);
|
||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C2, false>);
|
||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C2, false>);
|
||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C2, false>);
|
||||
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
|
||||
__bit_iterator<_D, false>,
|
||||
__bit_iterator<_D, false>);
|
||||
|
@@ -186,7 +186,9 @@ template <class charT> class messages_byname;
|
||||
#endif
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#if !_WIN32
|
||||
#if _WIN32
|
||||
#include <support/win32/support.h> // vasprintf
|
||||
#else // _WIN32
|
||||
#include <nl_types.h>
|
||||
#endif // !_WIN32
|
||||
|
||||
@@ -3711,10 +3713,14 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
#if _WIN32
|
||||
return -1;
|
||||
#else // _WIN32
|
||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||
if (__cat != -1)
|
||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||
return __cat;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@@ -3722,6 +3728,9 @@ typename messages<_CharT>::string_type
|
||||
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
const string_type& __dflt) const
|
||||
{
|
||||
#if _WIN32
|
||||
return __dflt;
|
||||
#else // _WIN32
|
||||
string __ndflt;
|
||||
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
||||
__dflt.c_str(),
|
||||
@@ -3734,16 +3743,19 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
return __w;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
#if !_WIN32
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
catclose(__cat);
|
||||
#endif // !_WIN32
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
|
@@ -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 )
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user