2 * CRTDLL wide-char functions
4 * Copyright 1999 Alexandre Julliard
12 #include "wine/unicode.h"
15 DEFAULT_DEBUG_CHANNEL(crtdll);
18 /*********************************************************************
19 * CRTDLL__wcsdup (CRTDLL.320)
21 LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str )
26 int size = (strlenW(str) + 1) * sizeof(WCHAR);
27 ret = CRTDLL_malloc( size );
28 if (ret) memcpy( ret, str, size );
34 /*********************************************************************
35 * CRTDLL__wcsicoll (CRTDLL.322)
37 INT __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
39 /* FIXME: handle collates */
40 return strcmpiW( str1, str2 );
44 /*********************************************************************
45 * CRTDLL__wcsnset (CRTDLL.325)
47 LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
50 while ((n-- > 0) && *str) *str++ = c;
55 /*********************************************************************
56 * CRTDLL__wcsrev (CRTDLL.326)
58 LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str )
61 LPWSTR end = str + strlenW(str) - 1;
72 /*********************************************************************
73 * CRTDLL__wcsset (CRTDLL.327)
75 LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c )
78 while (*str) *str++ = c;
83 /*********************************************************************
84 * CRTDLL_wcscoll (CRTDLL.506)
86 DWORD __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 )
88 /* FIXME: handle collates */
89 return strcmpW( str1, str2 );
93 /*********************************************************************
94 * CRTDLL_wcspbrk (CRTDLL.514)
96 LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept )
101 for (p = accept; *p; p++) if (*p == *str) return (LPWSTR)str;
108 /*********************************************************************
109 * CRTDLL_wctomb (CRTDLL.524)
111 INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch )
113 return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL );
116 /*********************************************************************
117 * CRTDLL_iswalnum (CRTDLL.405)
119 INT __cdecl CRTDLL_iswalnum( WCHAR wc )
121 return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
124 /*********************************************************************
125 * CRTDLL_iswalpha (CRTDLL.406)
127 INT __cdecl CRTDLL_iswalpha( WCHAR wc )
129 return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
132 /*********************************************************************
133 * CRTDLL_iswcntrl (CRTDLL.408)
135 INT __cdecl CRTDLL_iswcntrl( WCHAR wc )
137 return get_char_typeW(wc) & C1_CNTRL;
140 /*********************************************************************
141 * CRTDLL_iswdigit (CRTDLL.410)
143 INT __cdecl CRTDLL_iswdigit( WCHAR wc )
145 return get_char_typeW(wc) & C1_DIGIT;
148 /*********************************************************************
149 * CRTDLL_iswgraph (CRTDLL.411)
151 INT __cdecl CRTDLL_iswgraph( WCHAR wc )
153 return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
156 /*********************************************************************
157 * CRTDLL_iswlower (CRTDLL.412)
159 INT __cdecl CRTDLL_iswlower( WCHAR wc )
161 return get_char_typeW(wc) & C1_LOWER;
164 /*********************************************************************
165 * CRTDLL_iswprint (CRTDLL.413)
167 INT __cdecl CRTDLL_iswprint( WCHAR wc )
169 return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
172 /*********************************************************************
173 * CRTDLL_iswpunct (CRTDLL.414)
175 INT __cdecl CRTDLL_iswpunct( WCHAR wc )
177 return get_char_typeW(wc) & C1_PUNCT;
180 /*********************************************************************
181 * CRTDLL_iswspace (CRTDLL.415)
183 INT __cdecl CRTDLL_iswspace( WCHAR wc )
185 return get_char_typeW(wc) & C1_SPACE;
188 /*********************************************************************
189 * CRTDLL_iswupper (CRTDLL.416)
191 INT __cdecl CRTDLL_iswupper( WCHAR wc )
193 return get_char_typeW(wc) & C1_UPPER;
196 /*********************************************************************
197 * CRTDLL_iswxdigit (CRTDLL.417)
199 INT __cdecl CRTDLL_iswxdigit( WCHAR wc )
201 return get_char_typeW(wc) & C1_XDIGIT;