s/isascii/__isascii/ along with appropriate shims in include/support because
isascii isn't supposed to be part of C++.
On second thought, this probably breaks OSX and any other platform that doesn't
have support shims. I'm not sure of the best way to proceed on that.
http://reviews.llvm.org/D5385
Files:
include/__locale
include/locale
include/support/android/locale_bionic.h
include/support/ibm/xlocale.h
include/support/newlib/xlocale.h
include/support/solaris/xlocale.h
include/support/xlocale/xlocale.h
src/locale.cpp
Index: include/__locale
===================================================================
--- include/__locale
+++ include/__locale
@@ -526,31 +526,31 @@
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
- return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
+ return __isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
}
_LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{
for (; __low != __high; ++__low, ++__vec)
- *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
+ *__vec = __isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
return __low;
}
_LIBCPP_ALWAYS_INLINE
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
- if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
+ if (__isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
break;
return __low;
}
_LIBCPP_ALWAYS_INLINE
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
- if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
+ if (!(__isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
break;
return __low;
}
Index: include/locale
===================================================================
--- include/locale
+++ include/locale
@@ -193,6 +193,11 @@
#include <ctime>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <support/win32/locale_win32.h>
+#elif defined(_NEWLIB_VERSION)
+// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
+// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
+// has had a chance to bake for a bit
+#include <support/newlib/xlocale.h>
#elif !defined(__ANDROID__)
#include <nl_types.h>
#endif
@@ -229,7 +234,8 @@
// OSX has nice foo_l() functions that let you turn off use of the global
// locale. Linux, not so much. The following functions avoid the locale when
// that's possible and otherwise do the wrong thing. FIXME.
-#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX)
+#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
+ defined(_NEWLIB_VERSION)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
@@ -3673,7 +3679,7 @@
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
-#if defined(_WIN32) || defined(__ANDROID__)
+#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
return -1;
#else // _WIN32 || __ANDROID__
catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
@@ -3688,7 +3694,7 @@
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
const string_type& __dflt) const
{
-#if defined(_WIN32) || defined(__ANDROID__)
+#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
return __dflt;
#else // _WIN32
string __ndflt;
@@ -3710,7 +3716,7 @@
void
messages<_CharT>::do_close(catalog __c) const
{
-#if !defined(_WIN32) && !defined(__ANDROID__)
+#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
if (__c != -1)
__c <<= 1;
nl_catd __cat = (nl_catd)__c;
Index: include/support/android/locale_bionic.h
===================================================================
--- include/support/android/locale_bionic.h
+++ include/support/android/locale_bionic.h
@@ -20,173 +20,17 @@
#include <stdlib.h>
#include <xlocale.h>
-static inline int isalnum_l(int c, locale_t) {
- return isalnum(c);
-}
-
-static inline int isalpha_l(int c, locale_t) {
- return isalpha(c);
-}
-
-static inline int isblank_l(int c, locale_t) {
- return isblank(c);
-}
-
-static inline int iscntrl_l(int c, locale_t) {
- return iscntrl(c);
-}
-
-static inline int isdigit_l(int c, locale_t) {
- return isdigit(c);
-}
-
-static inline int isgraph_l(int c, locale_t) {
- return isgraph(c);
-}
-
-static inline int islower_l(int c, locale_t) {
- return islower(c);
-}
-
-static inline int isprint_l(int c, locale_t) {
- return isprint(c);
-}
-
-static inline int ispunct_l(int c, locale_t) {
- return ispunct(c);
-}
-
-static inline int isspace_l(int c, locale_t) {
- return isspace(c);
-}
-
-static inline int isupper_l(int c, locale_t) {
- return isupper(c);
-}
-
-static inline int isxdigit_l(int c, locale_t) {
- return isxdigit(c);
-}
-
-static inline int iswalnum_l(wint_t c, locale_t) {
- return iswalnum(c);
-}
-
-static inline int iswalpha_l(wint_t c, locale_t) {
- return iswalpha(c);
-}
-
-static inline int iswblank_l(wint_t c, locale_t) {
- return iswblank(c);
-}
-
-static inline int iswcntrl_l(wint_t c, locale_t) {
- return iswcntrl(c);
-}
-
-static inline int iswdigit_l(wint_t c, locale_t) {
- return iswdigit(c);
-}
-
-static inline int iswgraph_l(wint_t c, locale_t) {
- return iswgraph(c);
-}
-
-static inline int iswlower_l(wint_t c, locale_t) {
- return iswlower(c);
-}
-
-static inline int iswprint_l(wint_t c, locale_t) {
- return iswprint(c);
-}
-
-static inline int iswpunct_l(wint_t c, locale_t) {
- return iswpunct(c);
-}
-
-static inline int iswspace_l(wint_t c, locale_t) {
- return iswspace(c);
-}
-
-static inline int iswupper_l(wint_t c, locale_t) {
- return iswupper(c);
-}
-
-static inline int iswxdigit_l(wint_t c, locale_t) {
- return iswxdigit(c);
-}
-
-static inline int toupper_l(int c, locale_t) {
- return toupper(c);
-}
-
-static inline int tolower_l(int c, locale_t) {
- return tolower(c);
-}
-
-static inline int towupper_l(int c, locale_t) {
- return towupper(c);
-}
-
-static inline int towlower_l(int c, locale_t) {
- return towlower(c);
-}
-
-static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
- return strcoll(s1, s2);
-}
-
-static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
- locale_t) {
- return strxfrm(dest, src, n);
-}
-
-static inline size_t strftime_l(char *s, size_t max, const char *format,
- const struct tm *tm, locale_t) {
- return strftime(s, max, format, tm);
-}
-
-static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
- return wcscoll(ws1, ws2);
-}
-
-static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
- locale_t) {
- return wcsxfrm(dest, src, n);
-}
-
-static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
- return strtold(nptr, endptr);
-}
-
-static inline long long strtoll_l(const char *nptr, char **endptr, size_t base,
- locale_t) {
- return strtoll(nptr, endptr, base);
-}
-
-static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
- size_t base, locale_t) {
- return strtoull(nptr, endptr, base);
-}
-
-static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
- size_t base, locale_t) {
- return wcstoll(nptr, endptr, base);
-}
-
-static inline unsigned long long wcstoull_l(const wchar_t *nptr,
- wchar_t **endptr, size_t base,
- locale_t) {
- return wcstoull(nptr, endptr, base);
-}
-
-static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
- locale_t) {
- return wcstold(nptr, endptr);
+static inline __isascii(int c) {
+ int isascii(int c);
+ return isascii(c);
}
#ifdef __cplusplus
}
#endif
+
+// Share implementaiton with Newlib
+#include <support/xlocale/xlocale.h>
+
#endif // defined(__ANDROID__)
#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
Index: include/support/ibm/xlocale.h
===================================================================
--- include/support/ibm/xlocale.h
+++ include/support/ibm/xlocale.h
@@ -18,6 +18,11 @@
extern "C" {
#endif
+static inline __isascii(int c) {
+ int isascii(int c);
+ return isascii(c);
+}
+
#if !defined(_AIX71)
// AIX 7.1 and higher has these definitions. Definitions and stubs
// are provied here as a temporary workaround on AIX 6.1.
Index: include/support/newlib/xlocale.h
===================================================================
--- include/support/newlib/xlocale.h
+++ include/support/newlib/xlocale.h
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
+#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
+
+#if defined(_NEWLIB_VERSION)
+
+#include <cstdlib>
+#include <clocale>
+#include <cwctype>
+#include <ctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline __isascii(int c) {
+ // Newlib provides this, but in the header it is under
+ // `#if !defined(__STRICT_ANSI__)`, which is defined when C++-ing... so we have
+ // duck under that velvet rope.
+ int isascii(int c);
+ return isascii(c);
+}
+
+// Patch over newlib's lack of extended locale support
+typedef void *locale_t;
+static inline locale_t duplocale(locale_t) {
+ return NULL;
+}
+
+static inline void freelocale(locale_t) {
+}
+
+static inline locale_t newlocale(int, const char *, locale_t) {
+ return NULL;
+}
+
+static inline locale_t uselocale(locale_t) {
+ return NULL;
+}
+
+#define LC_COLLATE_MASK (1 << LC_COLLATE)
+#define LC_CTYPE_MASK (1 << LC_CTYPE)
+#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
+#define LC_MONETARY_MASK (1 << LC_MONETARY)
+#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
+#define LC_TIME_MASK (1 << LC_TIME)
+#define LC_ALL_MASK (LC_COLLATE_MASK|\
+ LC_CTYPE_MASK|\
+ LC_MONETARY_MASK|\
+ LC_NUMERIC_MASK|\
+ LC_TIME_MASK|\
+ LC_MESSAGES_MASK)
+
+// Share implementaiton with android bionic
+#include <support/xlocale/xlocale.h>
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _NEWLIB_VERSION
+
+#endif
Index: include/support/solaris/xlocale.h
===================================================================
--- include/support/solaris/xlocale.h
+++ include/support/solaris/xlocale.h
@@ -18,6 +18,10 @@
extern "C" {
#endif
+static inline __isascii(int c) {
+ int isascii(int c);
+ return isascii(c);
+}
typedef struct _LC_locale_t* locale_t;
Index: include/support/xlocale/xlocale.h
===================================================================
--- include/support/xlocale/xlocale.h
+++ include/support/xlocale/xlocale.h
@@ -0,0 +1,194 @@
+// -*- C++ -*-
+//===------------------- support/xlocale/xlocale.h ------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// This is a shared implementation of a shim to provide extended locale support
+// on top of libc's that don't support it (like Android's bionic, and Newlib).
+//
+// The 'illusion' only works when the specified locale is "C" or "POSIX", but
+// that's about as good as we can do without implementing full xlocale support
+// in the underlying libc.
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
+#define _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline int isalnum_l(int c, locale_t) {
+ return isalnum(c);
+}
+
+static inline int isalpha_l(int c, locale_t) {
+ return isalpha(c);
+}
+
+static inline int isblank_l(int c, locale_t) {
+ return isblank(c);
+}
+
+static inline int iscntrl_l(int c, locale_t) {
+ return iscntrl(c);
+}
+
+static inline int isdigit_l(int c, locale_t) {
+ return isdigit(c);
+}
+
+static inline int isgraph_l(int c, locale_t) {
+ return isgraph(c);
+}
+
+static inline int islower_l(int c, locale_t) {
+ return islower(c);
+}
+
+static inline int isprint_l(int c, locale_t) {
+ return isprint(c);
+}
+
+static inline int ispunct_l(int c, locale_t) {
+ return ispunct(c);
+}
+
+static inline int isspace_l(int c, locale_t) {
+ return isspace(c);
+}
+
+static inline int isupper_l(int c, locale_t) {
+ return isupper(c);
+}
+
+static inline int isxdigit_l(int c, locale_t) {
+ return isxdigit(c);
+}
+
+static inline int iswalnum_l(wint_t c, locale_t) {
+ return iswalnum(c);
+}
+
+static inline int iswalpha_l(wint_t c, locale_t) {
+ return iswalpha(c);
+}
+
+static inline int iswblank_l(wint_t c, locale_t) {
+ return iswblank(c);
+}
+
+static inline int iswcntrl_l(wint_t c, locale_t) {
+ return iswcntrl(c);
+}
+
+static inline int iswdigit_l(wint_t c, locale_t) {
+ return iswdigit(c);
+}
+
+static inline int iswgraph_l(wint_t c, locale_t) {
+ return iswgraph(c);
+}
+
+static inline int iswlower_l(wint_t c, locale_t) {
+ return iswlower(c);
+}
+
+static inline int iswprint_l(wint_t c, locale_t) {
+ return iswprint(c);
+}
+
+static inline int iswpunct_l(wint_t c, locale_t) {
+ return iswpunct(c);
+}
+
+static inline int iswspace_l(wint_t c, locale_t) {
+ return iswspace(c);
+}
+
+static inline int iswupper_l(wint_t c, locale_t) {
+ return iswupper(c);
+}
+
+static inline int iswxdigit_l(wint_t c, locale_t) {
+ return iswxdigit(c);
+}
+
+static inline int toupper_l(int c, locale_t) {
+ return toupper(c);
+}
+
+static inline int tolower_l(int c, locale_t) {
+ return tolower(c);
+}
+
+static inline int towupper_l(int c, locale_t) {
+ return towupper(c);
+}
+
+static inline int towlower_l(int c, locale_t) {
+ return towlower(c);
+}
+
+static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
+ return strcoll(s1, s2);
+}
+
+static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
+ locale_t) {
+ return strxfrm(dest, src, n);
+}
+
+static inline size_t strftime_l(char *s, size_t max, const char *format,
+ const struct tm *tm, locale_t) {
+ return strftime(s, max, format, tm);
+}
+
+static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
+ return wcscoll(ws1, ws2);
+}
+
+static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
+ locale_t) {
+ return wcsxfrm(dest, src, n);
+}
+
+static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
+ return strtold(nptr, endptr);
+}
+
+static inline long long strtoll_l(const char *nptr, char **endptr, int base,
+ locale_t) {
+ return strtoll(nptr, endptr, base);
+}
+
+static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
+ int base, locale_t) {
+ return strtoull(nptr, endptr, base);
+}
+
+static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
+ int base, locale_t) {
+ return wcstoll(nptr, endptr, base);
+}
+
+static inline unsigned long long wcstoull_l(const wchar_t *nptr,
+ wchar_t **endptr, int base,
+ locale_t) {
+ return wcstoull(nptr, endptr, base);
+}
+
+static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
+ locale_t) {
+ return wcstold(nptr, endptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
Index: src/locale.cpp
===================================================================
--- src/locale.cpp
+++ src/locale.cpp
@@ -765,7 +765,7 @@
const ctype_base::mask ctype_base::blank;
const ctype_base::mask ctype_base::alnum;
const ctype_base::mask ctype_base::graph;
-
+
locale::id ctype<wchar_t>::id;
ctype<wchar_t>::~ctype()
@@ -775,86 +775,86 @@
bool
ctype<wchar_t>::do_is(mask m, char_type c) const
{
- return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
+ return __isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
}
const wchar_t*
ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
{
for (; low != high; ++low, ++vec)
- *vec = static_cast<mask>(isascii(*low) ?
+ *vec = static_cast<mask>(__isascii(*low) ?
ctype<char>::classic_table()[*low] : 0);
return low;
}
const wchar_t*
ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
{
for (; low != high; ++low)
- if (isascii(*low) && (ctype<char>::classic_table()[*low] & m))
+ if (__isascii(*low) && (ctype<char>::classic_table()[*low] & m))
break;
return low;
}
const wchar_t*
ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
{
for (; low != high; ++low)
- if (!(isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
+ if (!(__isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
break;
return low;
}
wchar_t
ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+ return __isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
+ return __isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
- return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
+ return (__isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
#endif
}
const wchar_t*
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+ *low = __isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- *low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
+ *low = __isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
- *low = (isascii(*low) && islower_l(*low, __cloc())) ? (*low-L'a'+L'A') : *low;
+ *low = (__isascii(*low) && islower_l(*low, __cloc())) ? (*low-L'a'+L'A') : *low;
#endif
return low;
}
wchar_t
ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+ return __isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
+ return __isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
#else
- return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
+ return (__isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
#endif
}
const wchar_t*
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+ *low = __isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- *low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
+ *low = __isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
#else
- *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-L'A'+L'a' : *low;
+ *low = (__isascii(*low) && isupper_l(*low, __cloc())) ? *low-L'A'+L'a' : *low;
#endif
return low;
}
@@ -876,16 +876,16 @@
char
ctype<wchar_t>::do_narrow(char_type c, char dfault) const
{
- if (isascii(c))
+ if (__isascii(c))
return static_cast<char>(c);
return dfault;
}
const wchar_t*
ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
{
for (; low != high; ++low, ++dest)
- if (isascii(*low))
+ if (__isascii(*low))
*dest = static_cast<char>(*low);
else
*dest = dfault;
@@ -915,64 +915,64 @@
ctype<char>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ?
+ return __isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
- return isascii(c) ?
+ return __isascii(c) ?
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
#else
- return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
+ return (__isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
#endif
}
const char*
ctype<char>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ?
+ *low = __isascii(*low) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
*low = static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
- *low = isascii(*low) ?
+ *low = __isascii(*low) ?
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
#else
- *low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low;
+ *low = (__isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low;
#endif
return low;
}
char
ctype<char>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ?
+ return __isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- return isascii(c) ?
+ return __isascii(c) ?
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
#else
- return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c;
+ return (__isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c;
#endif
}
const char*
ctype<char>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
+ *low = __isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
*low = static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
- *low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
+ *low = __isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
#else
- *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
+ *low = (__isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
#endif
return low;
}
@@ -994,16 +994,16 @@
char
ctype<char>::do_narrow(char_type c, char dfault) const
{
- if (isascii(c))
+ if (__isascii(c))
return static_cast<char>(c);
return dfault;
}
const char*
ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
{
for (; low != high; ++low, ++dest)
- if (isascii(*low))
+ if (__isascii(*low))
*dest = *low;
else
*dest = dfault;
@@ -1199,7 +1199,7 @@
{
for (; low != high; ++low, ++vec)
{
- if (isascii(*low))
+ if (__isascii(*low))
*vec = static_cast<mask>(ctype<char>::classic_table()[*low]);
else
{
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits