Module: wine Branch: master Commit: c948a6cf9201152a664ab4976da51bdfac59deaa URL: https://source.winehq.org/git/wine.git/?a=commit;h=c948a6cf9201152a664ab4976...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jun 29 11:48:20 2022 +0200
ntdll: Add a few more isw* functions.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/ntdll.spec | 4 +++ dlls/ntdll/wcstring.c | 83 ++++++++++++++++++++++++++++----------------------- 2 files changed, 49 insertions(+), 38 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index b1650ab4306..fa1941ec811 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1560,10 +1560,14 @@ @ cdecl ispunct(long) @ cdecl isspace(long) @ cdecl isupper(long) +@ cdecl iswalnum(long) @ cdecl iswalpha(long) +@ cdecl iswascii(long) @ cdecl iswctype(long long) @ cdecl iswdigit(long) +@ cdecl iswgraph(long) @ cdecl iswlower(long) +@ cdecl iswprint(long) @ cdecl iswspace(long) @ cdecl iswxdigit(long) @ cdecl isxdigit(long) diff --git a/dlls/ntdll/wcstring.c b/dlls/ntdll/wcstring.c index 9422e4f676c..eef3197c4fe 100644 --- a/dlls/ntdll/wcstring.c +++ b/dlls/ntdll/wcstring.c @@ -384,77 +384,84 @@ INT __cdecl iswctype( WCHAR wc, unsigned short type ) }
+/********************************************************************* + * iswalnum (NTDLL.@) + */ +INT __cdecl iswalnum( WCHAR wc ) +{ + return iswctype( wc, C1_ALPHA | C1_UPPER | C1_LOWER | C1_DIGIT ); +} + + /********************************************************************* * iswalpha (NTDLL.@) */ INT __cdecl iswalpha( WCHAR wc ) { - if (wc >= 256) return 0; - return wctypes[wc] & (C1_ALPHA | C1_UPPER | C1_LOWER); + return iswctype( wc, C1_ALPHA | C1_UPPER | C1_LOWER ); }
/********************************************************************* - * iswdigit (NTDLL.@) - * - * Checks if a unicode char wc is a digit - * - * RETURNS - * TRUE: The unicode char wc is a digit. - * FALSE: Otherwise + * iswascii (NTDLL.@) + */ +INT __cdecl iswascii( WCHAR wc ) +{ + return wc < 0x80; +} + + +/********************************************************************* + * iswdigit (NTDLL.@) */ INT __cdecl iswdigit( WCHAR wc ) { - if (wc >= 256) return 0; - return wctypes[wc] & C1_DIGIT; + return iswctype( wc, C1_DIGIT ); }
/********************************************************************* - * iswlower (NTDLL.@) - * - * Checks if a unicode char wc is a lower case letter - * - * RETURNS - * TRUE: The unicode char wc is a lower case letter. - * FALSE: Otherwise + * iswgraph (NTDLL.@) + */ +INT __cdecl iswgraph( WCHAR wc ) +{ + return iswctype( wc, C1_ALPHA | C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT ); +} + + +/********************************************************************* + * iswlower (NTDLL.@) */ INT __cdecl iswlower( WCHAR wc ) { - if (wc >= 256) return 0; - return wctypes[wc] & C1_LOWER; + return iswctype( wc, C1_LOWER ); }
/********************************************************************* - * iswspace (NTDLL.@) - * - * Checks if a unicode char wc is a white space character - * - * RETURNS - * TRUE: The unicode char wc is a white space character. - * FALSE: Otherwise + * iswprint (NTDLL.@) + */ +INT __cdecl iswprint( WCHAR wc ) +{ + return iswctype( wc, C1_ALPHA | C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK ); +} + + +/********************************************************************* + * iswspace (NTDLL.@) */ INT __cdecl iswspace( WCHAR wc ) { - if (wc >= 256) return 0; - return wctypes[wc] & C1_SPACE; + return iswctype( wc, C1_SPACE ); }
/********************************************************************* - * iswxdigit (NTDLL.@) - * - * Checks if a unicode char wc is an extended digit - * - * RETURNS - * TRUE: The unicode char wc is an extended digit. - * FALSE: Otherwise + * iswxdigit (NTDLL.@) */ INT __cdecl iswxdigit( WCHAR wc ) { - if (wc >= 256) return 0; - return wctypes[wc] & C1_XDIGIT; + return iswctype( wc, C1_XDIGIT ); }