mirror of https://github.com/adtools/clib2.git
Implement few wide char functions.
This commit is contained in:
parent
846eebc66c
commit
6f3b3b6d28
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,6 @@
|
|||
int
|
||||
wctob(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
if (c < 128U) return c;
|
||||
return EOF;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,10 @@
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Implementation based on musl */
|
||||
|
||||
int
|
||||
iswalnum(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
return iswdigit(c) || iswalpha(c);
|
||||
}
|
||||
|
|
|
@ -35,11 +35,12 @@
|
|||
#include <wctype.h>
|
||||
#endif /* _WCTYPE_HEADERS_H */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
iswalpha(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
return isalpha(c);
|
||||
}
|
||||
|
|
|
@ -35,11 +35,14 @@
|
|||
#include <wctype.h>
|
||||
#endif /* _WCTYPE_HEADERS_H */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Implementation based on musl */
|
||||
|
||||
int
|
||||
iswblank(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
return isblank(c);
|
||||
}
|
||||
|
|
|
@ -35,11 +35,12 @@
|
|||
#include <wctype.h>
|
||||
#endif /* _WCTYPE_HEADERS_H */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
iswdigit(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
return isdigit(c);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue