Merge "Revert "Revert "Add locale aware APIs."""
This commit is contained in:
commit
37f09d6d2e
16 changed files with 432 additions and 0 deletions
|
@ -109,6 +109,7 @@ libc_bionic_src_files := \
|
||||||
bionic/clone.cpp \
|
bionic/clone.cpp \
|
||||||
bionic/__cmsg_nxthdr.cpp \
|
bionic/__cmsg_nxthdr.cpp \
|
||||||
bionic/connect.cpp \
|
bionic/connect.cpp \
|
||||||
|
bionic/ctype.cpp \
|
||||||
bionic/__cxa_guard.cpp \
|
bionic/__cxa_guard.cpp \
|
||||||
bionic/__cxa_pure_virtual.cpp \
|
bionic/__cxa_pure_virtual.cpp \
|
||||||
bionic/dirent.cpp \
|
bionic/dirent.cpp \
|
||||||
|
@ -205,10 +206,16 @@ libc_bionic_src_files := \
|
||||||
bionic/socket.cpp \
|
bionic/socket.cpp \
|
||||||
bionic/stat.cpp \
|
bionic/stat.cpp \
|
||||||
bionic/statvfs.cpp \
|
bionic/statvfs.cpp \
|
||||||
|
bionic/strcoll_l.cpp \
|
||||||
bionic/strerror.cpp \
|
bionic/strerror.cpp \
|
||||||
bionic/strerror_r.cpp \
|
bionic/strerror_r.cpp \
|
||||||
|
bionic/strftime_l.cpp \
|
||||||
bionic/strsignal.cpp \
|
bionic/strsignal.cpp \
|
||||||
bionic/strtold.cpp \
|
bionic/strtold.cpp \
|
||||||
|
bionic/strtold_l.cpp \
|
||||||
|
bionic/strtoll_l.cpp \
|
||||||
|
bionic/strtoull_l.cpp \
|
||||||
|
bionic/strxfrm_l.cpp \
|
||||||
bionic/stubs.cpp \
|
bionic/stubs.cpp \
|
||||||
bionic/symlink.cpp \
|
bionic/symlink.cpp \
|
||||||
bionic/sysconf.cpp \
|
bionic/sysconf.cpp \
|
||||||
|
|
89
libc/bionic/ctype.cpp
Normal file
89
libc/bionic/ctype.cpp
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
int isalnum_l(int c, locale_t) {
|
||||||
|
return isalnum(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isalpha_l(int c, locale_t) {
|
||||||
|
return isalpha(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isascii_l(int c, locale_t) {
|
||||||
|
return isascii(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isblank_l(int c, locale_t) {
|
||||||
|
return isblank(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int iscntrl_l(int c, locale_t) {
|
||||||
|
return iscntrl(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isdigit_l(int c, locale_t) {
|
||||||
|
return isdigit(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isgraph_l(int c, locale_t) {
|
||||||
|
return isgraph(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int islower_l(int c, locale_t) {
|
||||||
|
return islower(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isprint_l(int c, locale_t) {
|
||||||
|
return isprint(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ispunct_l(int c, locale_t) {
|
||||||
|
return ispunct(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isspace_l(int c, locale_t) {
|
||||||
|
return isspace(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isupper_l(int c, locale_t) {
|
||||||
|
return isupper(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isxdigit_l(int c, locale_t) {
|
||||||
|
return isxdigit(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int toupper_l(int c, locale_t) {
|
||||||
|
return toupper(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolower_l(int c, locale_t) {
|
||||||
|
return tolower(c);
|
||||||
|
}
|
33
libc/bionic/strcoll_l.cpp
Normal file
33
libc/bionic/strcoll_l.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int strcoll_l(const char *s1, const char *s2, locale_t) {
|
||||||
|
return strcoll(s1, s2);
|
||||||
|
}
|
34
libc/bionic/strftime_l.cpp
Normal file
34
libc/bionic/strftime_l.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
size_t strftime_l(char *s, size_t max, const char *format, const struct tm *tm,
|
||||||
|
locale_t) {
|
||||||
|
return strftime(s, max, format, tm);
|
||||||
|
}
|
33
libc/bionic/strtold_l.cpp
Normal file
33
libc/bionic/strtold_l.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
long double strtold_l(const char *nptr, char **endptr, locale_t) {
|
||||||
|
return strtold(nptr, endptr);
|
||||||
|
}
|
33
libc/bionic/strtoll_l.cpp
Normal file
33
libc/bionic/strtoll_l.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
long long strtoll_l(const char *nptr, char **endptr, size_t base, locale_t) {
|
||||||
|
return strtoll(nptr, endptr, base);
|
||||||
|
}
|
34
libc/bionic/strtoull_l.cpp
Normal file
34
libc/bionic/strtoull_l.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
unsigned long long strtoull_l(const char *nptr, char **endptr, size_t base,
|
||||||
|
locale_t) {
|
||||||
|
return strtoull(nptr, endptr, base);
|
||||||
|
}
|
33
libc/bionic/strxfrm_l.cpp
Normal file
33
libc/bionic/strxfrm_l.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t) {
|
||||||
|
return strxfrm(dest, src, n);
|
||||||
|
}
|
|
@ -219,3 +219,25 @@ size_t wcsnrtombs(char* dst, const wchar_t** src, size_t nwc, size_t len, mbstat
|
||||||
size_t wcsrtombs(char* dst, const wchar_t** src, size_t len, mbstate_t* ps) {
|
size_t wcsrtombs(char* dst, const wchar_t** src, size_t len, mbstate_t* ps) {
|
||||||
return wcsnrtombs(dst, src, SIZE_MAX, len, ps);
|
return wcsnrtombs(dst, src, SIZE_MAX, len, ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
|
||||||
|
return wcscoll(ws1, ws2);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t) {
|
||||||
|
return wcsxfrm(dest, src, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr, size_t base,
|
||||||
|
locale_t) {
|
||||||
|
return wcstoll(nptr, endptr, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long wcstoull_l(const wchar_t *nptr, wchar_t **endptr,
|
||||||
|
size_t base, locale_t) {
|
||||||
|
return wcstoull(nptr, endptr, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
long double wcstold_l(const wchar_t *nptr, wchar_t **endptr, locale_t) {
|
||||||
|
return wcstold(nptr, endptr);
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <wctype.h>
|
||||||
|
|
||||||
// TODO: these only work for the ASCII range; rewrite to dlsym icu4c? http://b/14499654
|
// TODO: these only work for the ASCII range; rewrite to dlsym icu4c? http://b/14499654
|
||||||
|
|
||||||
|
@ -46,6 +47,19 @@ int iswspace(wint_t wc) { return isspace(wc); }
|
||||||
int iswupper(wint_t wc) { return isupper(wc); }
|
int iswupper(wint_t wc) { return isupper(wc); }
|
||||||
int iswxdigit(wint_t wc) { return isxdigit(wc); }
|
int iswxdigit(wint_t wc) { return isxdigit(wc); }
|
||||||
|
|
||||||
|
int iswalnum_l(wint_t c, locale_t) { return iswalnum(c); }
|
||||||
|
int iswalpha_l(wint_t c, locale_t) { return iswalpha(c); }
|
||||||
|
int iswblank_l(wint_t c, locale_t) { return iswblank(c); }
|
||||||
|
int iswcntrl_l(wint_t c, locale_t) { return iswcntrl(c); }
|
||||||
|
int iswdigit_l(wint_t c, locale_t) { return iswdigit(c); }
|
||||||
|
int iswgraph_l(wint_t c, locale_t) { return iswgraph(c); }
|
||||||
|
int iswlower_l(wint_t c, locale_t) { return iswlower(c); }
|
||||||
|
int iswprint_l(wint_t c, locale_t) { return iswprint(c); }
|
||||||
|
int iswpunct_l(wint_t c, locale_t) { return iswpunct(c); }
|
||||||
|
int iswspace_l(wint_t c, locale_t) { return iswspace(c); }
|
||||||
|
int iswupper_l(wint_t c, locale_t) { return iswupper(c); }
|
||||||
|
int iswxdigit_l(wint_t c, locale_t) { return iswxdigit(c); }
|
||||||
|
|
||||||
int iswctype(wint_t wc, wctype_t char_class) {
|
int iswctype(wint_t wc, wctype_t char_class) {
|
||||||
switch (char_class) {
|
switch (char_class) {
|
||||||
case WC_TYPE_ALNUM: return iswalnum(wc);
|
case WC_TYPE_ALNUM: return iswalnum(wc);
|
||||||
|
@ -64,9 +78,16 @@ int iswctype(wint_t wc, wctype_t char_class) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iswctype_l(wint_t wc, wctype_t char_class, locale_t) {
|
||||||
|
return iswctype(wc, char_class);
|
||||||
|
}
|
||||||
|
|
||||||
wint_t towlower(wint_t wc) { return tolower(wc); }
|
wint_t towlower(wint_t wc) { return tolower(wc); }
|
||||||
wint_t towupper(wint_t wc) { return toupper(wc); }
|
wint_t towupper(wint_t wc) { return toupper(wc); }
|
||||||
|
|
||||||
|
int towupper_l(int c, locale_t) { return towupper(c); }
|
||||||
|
int towlower_l(int c, locale_t) { return towlower(c); }
|
||||||
|
|
||||||
wctype_t wctype(const char* property) {
|
wctype_t wctype(const char* property) {
|
||||||
static const char* const properties[WC_TYPE_MAX] = {
|
static const char* const properties[WC_TYPE_MAX] = {
|
||||||
"<invalid>",
|
"<invalid>",
|
||||||
|
@ -81,6 +102,10 @@ wctype_t wctype(const char* property) {
|
||||||
return static_cast<wctype_t>(0);
|
return static_cast<wctype_t>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wctype_t wctype_l(const char* property, locale_t) {
|
||||||
|
return wctype(property);
|
||||||
|
}
|
||||||
|
|
||||||
int wcwidth(wchar_t wc) {
|
int wcwidth(wchar_t wc) {
|
||||||
return (wc > 0);
|
return (wc > 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#define _CTYPE_H_
|
#define _CTYPE_H_
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#include <xlocale.h>
|
||||||
|
|
||||||
#define _CTYPE_U 0x01
|
#define _CTYPE_U 0x01
|
||||||
#define _CTYPE_L 0x02
|
#define _CTYPE_L 0x02
|
||||||
|
@ -72,6 +73,22 @@ int isxdigit(int);
|
||||||
int tolower(int);
|
int tolower(int);
|
||||||
int toupper(int);
|
int toupper(int);
|
||||||
|
|
||||||
|
int isalnum_l(int, locale_t);
|
||||||
|
int isalpha_l(int, locale_t);
|
||||||
|
int isascii_l(int, locale_t);
|
||||||
|
int isblank_l(int, locale_t);
|
||||||
|
int iscntrl_l(int, locale_t);
|
||||||
|
int isdigit_l(int, locale_t);
|
||||||
|
int isgraph_l(int, locale_t);
|
||||||
|
int islower_l(int, locale_t);
|
||||||
|
int isprint_l(int, locale_t);
|
||||||
|
int ispunct_l(int, locale_t);
|
||||||
|
int isspace_l(int, locale_t);
|
||||||
|
int isupper_l(int, locale_t);
|
||||||
|
int isxdigit_l(int, locale_t);
|
||||||
|
int tolower_l(int, locale_t);
|
||||||
|
int toupper_l(int, locale_t);
|
||||||
|
|
||||||
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
|
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
|
||||||
|| __XPG_VISIBLE > 600
|
|| __XPG_VISIBLE > 600
|
||||||
int isblank(int);
|
int isblank(int);
|
||||||
|
|
|
@ -75,6 +75,10 @@ extern double strtod(const char*, char**) __LIBC_ABI_PUBLIC__;
|
||||||
extern float strtof(const char*, char**) __LIBC_ABI_PUBLIC__;
|
extern float strtof(const char*, char**) __LIBC_ABI_PUBLIC__;
|
||||||
extern long double strtold(const char*, char**) __LIBC_ABI_PUBLIC__;
|
extern long double strtold(const char*, char**) __LIBC_ABI_PUBLIC__;
|
||||||
|
|
||||||
|
extern long double strtold_l(const char *, char **, locale_t) __LIBC_ABI_PUBLIC__;
|
||||||
|
extern long long strtoll_l(const char *, char **, size_t, locale_t) __LIBC_ABI_PUBLIC__;
|
||||||
|
extern unsigned long long strtoull_l(const char *, char **, size_t, locale_t) __LIBC_ABI_PUBLIC__;
|
||||||
|
|
||||||
extern int atoi(const char*) __purefunc;
|
extern int atoi(const char*) __purefunc;
|
||||||
extern long atol(const char*) __purefunc;
|
extern long atol(const char*) __purefunc;
|
||||||
extern long long atoll(const char*) __purefunc;
|
extern long long atoll(const char*) __purefunc;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <xlocale.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -88,6 +89,9 @@ extern char* strsignal(int sig);
|
||||||
extern int strcoll(const char *, const char *) __purefunc;
|
extern int strcoll(const char *, const char *) __purefunc;
|
||||||
extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
|
extern size_t strxfrm(char* __restrict, const char* __restrict, size_t);
|
||||||
|
|
||||||
|
extern int strcoll_l(const char *, const char *, locale_t) __purefunc;
|
||||||
|
extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
|
||||||
|
|
||||||
#if defined(__BIONIC_FORTIFY)
|
#if defined(__BIONIC_FORTIFY)
|
||||||
|
|
||||||
__errordecl(__memcpy_dest_size_error, "memcpy: prevented write past end of buffer");
|
__errordecl(__memcpy_dest_size_error, "memcpy: prevented write past end of buffer");
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <xlocale.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ extern struct tm* gmtime_r(const time_t*, struct tm*) __LIBC_ABI_PUBLIC__;
|
||||||
|
|
||||||
extern char* strptime(const char*, const char*, struct tm*) __LIBC_ABI_PUBLIC__;
|
extern char* strptime(const char*, const char*, struct tm*) __LIBC_ABI_PUBLIC__;
|
||||||
extern size_t strftime(char*, size_t, const char*, const struct tm*) __LIBC_ABI_PUBLIC__;
|
extern size_t strftime(char*, size_t, const char*, const struct tm*) __LIBC_ABI_PUBLIC__;
|
||||||
|
extern size_t strftime_l(char *, size_t, const char *, const struct tm *, locale_t) __LIBC_ABI_PUBLIC__;
|
||||||
|
|
||||||
extern char* ctime(const time_t*) __LIBC_ABI_PUBLIC__;
|
extern char* ctime(const time_t*) __LIBC_ABI_PUBLIC__;
|
||||||
extern char* ctime_r(const time_t*, char*) __LIBC_ABI_PUBLIC__;
|
extern char* ctime_r(const time_t*, char*) __LIBC_ABI_PUBLIC__;
|
||||||
|
|
|
@ -151,6 +151,13 @@ extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
|
||||||
extern int wprintf(const wchar_t *, ...);
|
extern int wprintf(const wchar_t *, ...);
|
||||||
extern int wscanf(const wchar_t *, ...);
|
extern int wscanf(const wchar_t *, ...);
|
||||||
|
|
||||||
|
extern long long wcstoll_l(const wchar_t *, wchar_t **, size_t, locale_t);
|
||||||
|
extern unsigned long long wcstoull_l(const wchar_t *, wchar_t **, size_t, locale_t);
|
||||||
|
extern long double wcstold_l(const wchar_t *, wchar_t **, locale_t );
|
||||||
|
|
||||||
|
extern int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
|
||||||
|
extern size_t wcsxfrm_l(wchar_t *, const wchar_t *, size_t, locale_t);
|
||||||
|
|
||||||
extern size_t wcslcat(wchar_t*, const wchar_t*, size_t);
|
extern size_t wcslcat(wchar_t*, const wchar_t*, size_t);
|
||||||
extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
|
extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
|
||||||
|
|
||||||
|
|
|
@ -1 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WCTYPE_H_
|
||||||
|
#define _WCTYPE_H_
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
extern int iswalnum_l(wint_t, locale_t);
|
||||||
|
extern int iswalpha_l(wint_t, locale_t);
|
||||||
|
extern int iswblank_l(wint_t, locale_t);
|
||||||
|
extern int iswcntrl_l(wint_t, locale_t);
|
||||||
|
extern int iswdigit_l(wint_t, locale_t);
|
||||||
|
extern int iswgraph_l(wint_t, locale_t);
|
||||||
|
extern int iswlower_l(wint_t, locale_t);
|
||||||
|
extern int iswprint_l(wint_t, locale_t);
|
||||||
|
extern int iswpunct_l(wint_t, locale_t);
|
||||||
|
extern int iswspace_l(wint_t, locale_t);
|
||||||
|
extern int iswupper_l(wint_t, locale_t);
|
||||||
|
extern int iswxdigit_l(wint_t, locale_t);
|
||||||
|
extern int towlower_l(int, locale_t);
|
||||||
|
extern int towupper_l(int, locale_t);
|
||||||
|
|
||||||
|
extern int iswctype_l(wint_t, wctype_t, locale_t);
|
||||||
|
extern wctype_t wctype_l(const char*, locale_t);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif /* _WCTYPE_H_ */
|
||||||
|
|
Loading…
Reference in a new issue