diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index c232f5b..6fcd170 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -29,7 +29,11 @@ RANLIB := ppc-amigaos-ranlib COPY := cp -p DELETE := rm -rf MAKEDIR := mkdir -p -LOG_COMMAND := 2>&1 | tee -a compiler.log +# Enabling the LOG_COMMAND has the consequence that a rule will not +# fail on an error because only the exit status from the tee command +# will be considered +#LOG_COMMAND := 2>&1 | tee -a compiler.log +LOG_COMMAND := # You may need to request a specific compiler version in order to # build the baserel versions of the library. At this time of # writing (2008-11-06) GCC 4.0.4 and below support the -mbaserel diff --git a/library/changes b/library/changes index a76cfee..f6b57d8 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,11 @@ +c.lib 1.216 (xxx) + +- Add some wchar and multbyte-string related functions to allow gcc + building a libstdc++ library with wide char support. For now, the + functions are mostly stub ones only. They can be implemented on + demand. + + c.lib 1.215 (26.6.2017) - Added -fno-aggressive-loop-optimizations option when building crtbegin.c diff --git a/library/include/stddef.h b/library/include/stddef.h index 817af4d..b78b0eb 100644 --- a/library/include/stddef.h +++ b/library/include/stddef.h @@ -61,7 +61,11 @@ extern "C" { typedef int ptrdiff_t; typedef unsigned int size_t; + +/* wchar_t is a built-in type in C++ */ +#ifndef __cplusplus typedef unsigned short wchar_t; +#endif /****************************************************************************/ diff --git a/library/include/wchar.h b/library/include/wchar.h index ddcbbac..053a80d 100644 --- a/library/include/wchar.h +++ b/library/include/wchar.h @@ -43,6 +43,10 @@ /****************************************************************************/ +#ifndef _SYS_CLIB2_STDC_H +#include +#endif /* _SYS_CLIB2_STDC_H */ + #ifndef _STDDEF_H #include #endif /* _STDDEF_H */ @@ -63,6 +67,10 @@ #include #endif /* _LOCALE_H */ +#ifndef _STDINT_H +#include +#endif + /****************************************************************************/ #ifdef __cplusplus @@ -72,8 +80,6 @@ extern "C" { /****************************************************************************/ #define WEOF (-1) -#define WCHAR_MAX 65535 -#define WCHAR_MIN 0 /****************************************************************************/ @@ -164,7 +170,7 @@ extern int swprintf(wchar_t *s, const wchar_t *format, ...); extern int vfwprintf(FILE *stream,const wchar_t *format,va_list arg); extern int vwprintf(const wchar_t *format,va_list arg); -extern int vswprintf(char *s, const wchar_t *format,va_list arg); +extern int vswprintf(wchar_t *s, size_t maxlen, const wchar_t *format, va_list arg); /****************************************************************************/ @@ -177,7 +183,7 @@ extern size_t wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const /****************************************************************************/ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(__cplusplus) extern size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict ps); extern size_t mbrtowc(wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps); @@ -186,8 +192,9 @@ extern size_t mbsnrtowcs(wchar_t *restrict dst, const char **restrict src, size_ extern size_t mbsrtowcs(wchar_t *restrict dst, const char **restrict src, size_t len, mbstate_t *restrict ps); extern size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict ps); +extern int wcscoll(const wchar_t *ws1, const wchar_t *ws2); extern int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t loc); -extern size_t wcscspn(const wchar_t *ws1, const wchar_t *ws2); +extern size_t wcscspn(const wchar_t *s, const wchar_t *c); extern size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps); extern wchar_t * wcsrchr(const wchar_t *ws, wchar_t wc); extern size_t wcsrtombs(char *restrict dst, const wchar_t **restrict src, size_t len, mbstate_t *restrict ps); diff --git a/library/libc.gmk b/library/libc.gmk index 1a8cddd..e0ea214 100644 --- a/library/libc.gmk +++ b/library/libc.gmk @@ -234,6 +234,7 @@ C_LIB := \ stdlib_main_stub.o \ stdlib_malloc.o \ stdlib_math.o \ + stdlib_mbtowc.o \ stdlib_mkdtemp.o \ stdlib_mkstemp.o \ stdlib_mktemp.o \ @@ -374,7 +375,78 @@ C_LIB := \ unistd_unlink.o \ unistd_usleep.o \ utime_utime.o \ - utsname_uname.o + utsname_uname.o \ + wchar_btowc.o \ + wchar_fgetwc.o \ + wchar_fgetws.o \ + wchar_fputwc.o \ + wchar_fputws.o \ + wchar_fwide.o \ + wchar_fwprintf.o \ + wchar_fwscanf.o \ + wchar_getwc.o \ + wchar_getwchar.o \ + wchar_mbrlen.o \ + wchar_mbrtowc.o \ + wchar_mbsinit.o \ + wchar_mbsrtowcs.o \ + wchar_putwc.o \ + wchar_putwchar.o \ + wchar_swprintf.o \ + wchar_swscanf.o \ + wchar_ungetwc.o \ + wchar_vfwprintf.o \ + wchar_vswprintf.o \ + wchar_vwprintf.o \ + wchar_wcrtomb.o \ + wchar_wcscat.o \ + wchar_wcschr.o \ + wchar_wcscmp.o \ + wchar_wcscpy.o \ + wchar_wcscspn.o \ + wchar_wcsftime.o \ + wchar_wcslen.o \ + wchar_wcsncat.o \ + wchar_wcsncmp.o \ + wchar_wcsncpy.o \ + wchar_wscoll.o \ + wchar_wcspbrk.o \ + wchar_wcsrtombs.o \ + wchar_wcsspn.o \ + wchar_wcstod.o \ + wchar_wcstok.o \ + wchar_wcstol.o \ + wchar_wcstoll.o \ + wchar_wcstoul.o \ + wchar_wcstoull.o \ + wchar_wcsxfrm.o \ + wchar_wctob.o \ + wchar_wmemchr.o \ + wchar_wmemcmp.o \ + wchar_wmemcpy.o \ + wchar_wmemmove.o \ + wchar_wmemset.o \ + wchar_wprintf.o \ + wchar_wscanf.o \ + wchar_wscoll.o \ + wctype_iswalnum.o \ + wctype_iswalpha.o \ + wctype_iswblank.o \ + wctype_iswcntrl.o \ + wctype_iswctype.o \ + wctype_iswdigit.o \ + wctype_iswgraph.o \ + wctype_iswlower.o \ + wctype_iswprint.o \ + wctype_iswpunc.o \ + wctype_iswspace.o \ + wctype_iswupper.o \ + wctype_iswxdigit.o \ + wctype_towctrans.o \ + wctype_towlower.o \ + wctype_towupper.o \ + wctype_wctrans.o \ + wctype_wctype.o ############################################################################## diff --git a/library/stdlib_mbtowc.c b/library/stdlib_mbtowc.c index 0d592a6..9db5ee6 100644 --- a/library/stdlib_mbtowc.c +++ b/library/stdlib_mbtowc.c @@ -37,13 +37,13 @@ /****************************************************************************/ -#if defined(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) int mbtowc(wchar_t *restrict pwc, const char *restrict s, size_t n) { - /* ZZZ unimplemented */ - return(-1); + errno = EILSEQ; + return -1; } #endif diff --git a/library/wchar_mbrtowc.c b/library/wchar_mbrtowc.c new file mode 100644 index 0000000..05f59c0 --- /dev/null +++ b/library/wchar_mbrtowc.c @@ -0,0 +1,64 @@ +/* + * $Id: wchar_mbrlen.c,v 1.3 2006-01-08 12:04:27 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2015 by Olaf Barthel + * 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. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 _WCHAR_HEADERS_H +#include "wchar_headers.h" +#endif /* _WCHAR_HEADERS_H */ + +/****************************************************************************/ + +/* Mostly non-working stub based on bionic */ + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +size_t +mbrtowc(wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps) +{ + if (s == NULL) + { + s = ""; + pwc = NULL; + } + + if (n == 0) + { + if (pwc) + *pwc = 0; + return 0; + } + + if (pwc) + *pwc = *s; + + return (*s != 0); +} +#endif /* __STDC_VERSION__ && __STDC_VERSION__ >= 199901L */ diff --git a/library/wchar_mbsinit.c b/library/wchar_mbsinit.c index 1233ae1..44dc9b5 100644 --- a/library/wchar_mbsinit.c +++ b/library/wchar_mbsinit.c @@ -40,6 +40,5 @@ int mbsinit(const mbstate_t *ps) { - /* ZZZ unimplemented */ - return(0); + return !ps || !*(unsigned *)ps; } diff --git a/library/wchar_vswprintf.c b/library/wchar_vswprintf.c index b2773f6..b296bdb 100644 --- a/library/wchar_vswprintf.c +++ b/library/wchar_vswprintf.c @@ -38,7 +38,7 @@ /****************************************************************************/ int -vswprintf(char *s, const wchar_t *format,va_list arg) +vswprintf(wchar_t *s, size_t maxlen, const wchar_t *format, va_list arg) { /* ZZZ unimplemented */ return(0); diff --git a/library/wchar_wcscat.c b/library/wchar_wcscat.c index 7859d14..dc605be 100644 --- a/library/wchar_wcscat.c +++ b/library/wchar_wcscat.c @@ -35,11 +35,13 @@ #include "wchar_headers.h" #endif /* _WCHAR_HEADERS_H */ +/* Implementation based on musl */ + /****************************************************************************/ wchar_t * wcscat(wchar_t *dest, const wchar_t *src) { - /* ZZZ unimplemented */ - return(NULL); + wcscpy(dest + wcslen(dest), src); + return dest; } diff --git a/library/wchar_wcschr.c b/library/wchar_wcschr.c index c2d4fbd..12c44b9 100644 --- a/library/wchar_wcschr.c +++ b/library/wchar_wcschr.c @@ -37,9 +37,12 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wcschr(const wchar_t *s, wchar_t c) { - /* ZZZ unimplemented */ - return(NULL); + if (!c) return (wchar_t *)s + wcslen(s); + for (; *s && *s != c; s++); + return *s ? (wchar_t *)s : 0; } diff --git a/library/wchar_wcscmp.c b/library/wchar_wcscmp.c index 0c8103d..c12ff67 100644 --- a/library/wchar_wcscmp.c +++ b/library/wchar_wcscmp.c @@ -40,6 +40,6 @@ int wcscmp(const wchar_t *s1, const wchar_t * s2) { - /* ZZZ unimplemented */ - return(0); + for (; *s1==*s2 && *s1 && *s2; s1++, s2++); + return *s1 - *s2; } diff --git a/library/wchar_wcscpy.c b/library/wchar_wcscpy.c index 94b2ad9..d71fa25 100644 --- a/library/wchar_wcscpy.c +++ b/library/wchar_wcscpy.c @@ -40,6 +40,7 @@ wchar_t * wcscpy(wchar_t *dest, const wchar_t *src) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *a = dest; + while ((*dest++ = *src++)); + return a; } diff --git a/library/wchar_wcscspn.c b/library/wchar_wcscspn.c new file mode 100644 index 0000000..a43782f --- /dev/null +++ b/library/wchar_wcscspn.c @@ -0,0 +1,50 @@ +/* + * $Id: wchar_wcsspn.c,v 1.3 2006-01-08 12:04:27 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2015 by Olaf Barthel + * 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. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 _WCHAR_HEADERS_H +#include "wchar_headers.h" +#endif /* _WCHAR_HEADERS_H */ + +/****************************************************************************/ + +/* Implementation based on musl */ + +size_t +wcscspn(const wchar_t *s, const wchar_t *c) +{ + const wchar_t *a; + if (!c[0]) return wcslen(s); + if (!c[1]) return (s=wcschr(a=s, *c)) ? (size_t)(s-a) : wcslen(a); + for (a=s; *s && !wcschr(c, *s); s++); + return s-a; +} diff --git a/library/wchar_wcslen.c b/library/wchar_wcslen.c index 9ecc861..cc7393a 100644 --- a/library/wchar_wcslen.c +++ b/library/wchar_wcslen.c @@ -37,9 +37,12 @@ /****************************************************************************/ +/* Implementation based on musl */ + size_t wcslen(const wchar_t *s) { - /* ZZZ unimplemented */ - return(0); + const wchar_t *a; + for (a=s; *s; s++); + return s-a; } diff --git a/library/wchar_wcsncat.c b/library/wchar_wcsncat.c index 3155dc0..c993592 100644 --- a/library/wchar_wcsncat.c +++ b/library/wchar_wcsncat.c @@ -37,9 +37,14 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t n) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *a = dest; + dest += wcslen(dest); + while (n && *src) n--, *dest++ = *src++; + *dest++ = 0; + return a; } diff --git a/library/wchar_wcsncmp.c b/library/wchar_wcsncmp.c index dc62d39..4363d3f 100644 --- a/library/wchar_wcsncmp.c +++ b/library/wchar_wcsncmp.c @@ -37,9 +37,11 @@ /****************************************************************************/ +/* Implementation based on musl */ + int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) { - /* ZZZ unimplemented */ - return(0); + for (; n && *s1==*s2 && *s1 && *s2; n--, s1++, s2++); + return n ? *s1 - *s2 : 0; } diff --git a/library/wchar_wcsncpy.c b/library/wchar_wcsncpy.c index 0862776..f969bfd 100644 --- a/library/wchar_wcsncpy.c +++ b/library/wchar_wcsncpy.c @@ -37,9 +37,13 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *a = dest; + while (n && *src) n--, *dest++ = *src++; + wmemset(dest, 0, n); + return a; } diff --git a/library/wchar_wcspbrk.c b/library/wchar_wcspbrk.c index 75bd74a..83897a4 100644 --- a/library/wchar_wcspbrk.c +++ b/library/wchar_wcspbrk.c @@ -37,7 +37,7 @@ /****************************************************************************/ -wchar_t +wchar_t * wcspbrk(const wchar_t *s, const wchar_t *set) { /* ZZZ unimplemented */ diff --git a/library/wchar_wctob.c b/library/wchar_wctob.c new file mode 100644 index 0000000..704d657 --- /dev/null +++ b/library/wchar_wctob.c @@ -0,0 +1,45 @@ +/* + * $Id: wchar_wmemchr.c,v 1.3 2006-01-08 12:04:27 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2015 by Olaf Barthel + * 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. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 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 _WCHAR_HEADERS_H +#include "wchar_headers.h" +#endif /* _WCHAR_HEADERS_H */ + +/****************************************************************************/ + +int +wctob(wint_t c) +{ + if (c < 128U) return c; + return EOF; +} diff --git a/library/wchar_wmemchr.c b/library/wchar_wmemchr.c index 840911b..003a40c 100644 --- a/library/wchar_wmemchr.c +++ b/library/wchar_wmemchr.c @@ -37,9 +37,11 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wmemchr(const wchar_t *ptr, wchar_t val, size_t len) { - /* ZZZ unimplemented */ - return(NULL); + for (; len && *ptr != val; len--, ptr++); + return len ? (wchar_t *)ptr : 0; } diff --git a/library/wchar_wmemcmp.c b/library/wchar_wmemcmp.c index b43fe93..454f348 100644 --- a/library/wchar_wmemcmp.c +++ b/library/wchar_wmemcmp.c @@ -37,9 +37,11 @@ /****************************************************************************/ +/* Implementation based on musl */ + int wmemcmp(const wchar_t *ptr1, const wchar_t *ptr2, size_t len) { - /* ZZZ unimplemented */ - return(0); + for (; len && *ptr1==*ptr2; len--, ptr1++, ptr2++); + return len ? *ptr1-*ptr2 : 0; } diff --git a/library/wchar_wmemcpy.c b/library/wchar_wmemcpy.c index 230b7c3..95f1b36 100644 --- a/library/wchar_wmemcpy.c +++ b/library/wchar_wmemcpy.c @@ -37,9 +37,12 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wmemcpy(wchar_t *dest, const wchar_t *src, size_t len) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *a = dest; + while (len--) *dest++ = *src++; + return a; } diff --git a/library/wchar_wmemmove.c b/library/wchar_wmemmove.c index 809ed84..06ffb54 100644 --- a/library/wchar_wmemmove.c +++ b/library/wchar_wmemmove.c @@ -37,9 +37,15 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wmemmove(wchar_t *dest, const wchar_t * src, size_t len) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *d0 = dest; + if ((size_t)(dest-src) < len) + while (len--) dest[len] = src[len]; + else + while (len--) *dest++ = *src++; + return d0; } diff --git a/library/wchar_wmemset.c b/library/wchar_wmemset.c index a593d51..e584832 100644 --- a/library/wchar_wmemset.c +++ b/library/wchar_wmemset.c @@ -37,9 +37,12 @@ /****************************************************************************/ +/* Implementation based on musl */ + wchar_t * wmemset(wchar_t *ptr, int val, size_t len) { - /* ZZZ unimplemented */ - return(NULL); + wchar_t *ret = ptr; + while (len--) *ptr++ = val; + return ret; } diff --git a/library/wctype_iswalnum.c b/library/wctype_iswalnum.c index 14fd7b2..834ff00 100644 --- a/library/wctype_iswalnum.c +++ b/library/wctype_iswalnum.c @@ -37,9 +37,10 @@ /****************************************************************************/ +/* Implementation based on musl */ + int iswalnum(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return iswdigit(c) || iswalpha(c); } diff --git a/library/wctype_iswalpha.c b/library/wctype_iswalpha.c index 8840140..d90c00f 100644 --- a/library/wctype_iswalpha.c +++ b/library/wctype_iswalpha.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswalpha(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isalpha(c); } diff --git a/library/wctype_iswblank.c b/library/wctype_iswblank.c index a28f969..11fb9f3 100644 --- a/library/wctype_iswblank.c +++ b/library/wctype_iswblank.c @@ -35,11 +35,14 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ +/* Implementation based on musl */ + int iswblank(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isblank(c); } diff --git a/library/wctype_iswcntrl.c b/library/wctype_iswcntrl.c index 802422e..029e1d2 100644 --- a/library/wctype_iswcntrl.c +++ b/library/wctype_iswcntrl.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswcntrl(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return iscntrl(c); } diff --git a/library/wctype_iswdigit.c b/library/wctype_iswdigit.c index dcb1595..46e5aeb 100644 --- a/library/wctype_iswdigit.c +++ b/library/wctype_iswdigit.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswdigit(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isdigit(c); } diff --git a/library/wctype_iswgraph.c b/library/wctype_iswgraph.c index 3c63dba..5c18f87 100644 --- a/library/wctype_iswgraph.c +++ b/library/wctype_iswgraph.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswgraph(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isgraph(c); } diff --git a/library/wctype_iswlower.c b/library/wctype_iswlower.c index cac10a8..fe32f8d 100644 --- a/library/wctype_iswlower.c +++ b/library/wctype_iswlower.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswlower(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return islower(c); } diff --git a/library/wctype_iswpunc.c b/library/wctype_iswpunc.c index 40d98ea..62f4f09 100644 --- a/library/wctype_iswpunc.c +++ b/library/wctype_iswpunc.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int -iswpunc(wint_t c) +iswpunct(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return ispunct(c); } diff --git a/library/wctype_iswspace.c b/library/wctype_iswspace.c index 8c5afa4..ced9faf 100644 --- a/library/wctype_iswspace.c +++ b/library/wctype_iswspace.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswspace(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isspace(c); } diff --git a/library/wctype_iswupper.c b/library/wctype_iswupper.c index 5abc11e..e3f7bf9 100644 --- a/library/wctype_iswupper.c +++ b/library/wctype_iswupper.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswupper(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isupper(c); } diff --git a/library/wctype_iswxdigit.c b/library/wctype_iswxdigit.c index 3489cac..06e4b50 100644 --- a/library/wctype_iswxdigit.c +++ b/library/wctype_iswxdigit.c @@ -35,11 +35,12 @@ #include #endif /* _WCTYPE_HEADERS_H */ +#include + /****************************************************************************/ int iswxdigit(wint_t c) { - /* ZZZ unimplemented */ - return(0); + return isxdigit(c); }