2 * CRTDLL wide-char functions
4 * Copyright 1999 Alexandre Julliard
14 #include "wine/unicode.h"
16 #include "debugtools.h"
18 DEFAULT_DEBUG_CHANNEL(crtdll);
21 /*********************************************************************
22 * CRTDLL__wcsdup (CRTDLL.320)
24 LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str )
29 int size = (strlenW(str) + 1) * sizeof(WCHAR);
30 ret = CRTDLL_malloc( size );
31 if (ret) memcpy( ret, str, size );
37 /*********************************************************************
38 * CRTDLL__wcsicoll (CRTDLL.322)
40 INT __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
42 /* FIXME: handle collates */
43 return strcmpiW( str1, str2 );
47 /*********************************************************************
48 * CRTDLL__wcsnset (CRTDLL.325)
50 LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
53 while ((n-- > 0) && *str) *str++ = c;
58 /*********************************************************************
59 * CRTDLL__wcsrev (CRTDLL.326)
61 LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str )
64 LPWSTR end = str + strlenW(str) - 1;
75 /*********************************************************************
76 * CRTDLL__wcsset (CRTDLL.327)
78 LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c )
81 while (*str) *str++ = c;
86 /*********************************************************************
87 * CRTDLL_wcscoll (CRTDLL.506)
89 DWORD __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 )
91 /* FIXME: handle collates */
92 return strcmpW( str1, str2 );
96 /*********************************************************************
97 * CRTDLL_wcspbrk (CRTDLL.514)
99 LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept )
104 for (p = accept; *p; p++) if (*p == *str) return (LPWSTR)str;
111 /*********************************************************************
112 * CRTDLL_wctomb (CRTDLL.524)
114 INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch )
116 return wctomb( dst, (wchar_t)ch );
119 extern INT __cdecl NTDLL_iswctype( WCHAR wc, WCHAR wct ); /* FIXME */
121 /*********************************************************************
122 * CRTDLL_iswalnum (CRTDLL.405)
124 INT __cdecl CRTDLL_iswalnum( WCHAR wc )
126 return NTDLL_iswctype( wc, 0x0107 );
129 /*********************************************************************
130 * CRTDLL_iswalpha (CRTDLL.406)
132 INT __cdecl CRTDLL_iswalpha( WCHAR wc )
134 return NTDLL_iswctype( wc, 0x0103 );
137 /*********************************************************************
138 * CRTDLL_iswcntrl (CRTDLL.408)
140 INT __cdecl CRTDLL_iswcntrl( WCHAR wc )
142 return NTDLL_iswctype( wc, 0x0020 );
145 /*********************************************************************
146 * CRTDLL_iswdigit (CRTDLL.410)
148 INT __cdecl CRTDLL_iswdigit( WCHAR wc )
150 return NTDLL_iswctype( wc, 0x0004 );
153 /*********************************************************************
154 * CRTDLL_iswgraph (CRTDLL.411)
156 INT __cdecl CRTDLL_iswgraph( WCHAR wc )
158 return NTDLL_iswctype( wc, 0x0117 );
161 /*********************************************************************
162 * CRTDLL_iswlower (CRTDLL.412)
164 INT __cdecl CRTDLL_iswlower( WCHAR wc )
166 return NTDLL_iswctype( wc, 0x0002 );
169 /*********************************************************************
170 * CRTDLL_iswprint (CRTDLL.413)
172 INT __cdecl CRTDLL_iswprint( WCHAR wc )
174 return NTDLL_iswctype( wc, 0x0157 );
177 /*********************************************************************
178 * CRTDLL_iswpunct (CRTDLL.414)
180 INT __cdecl CRTDLL_iswpunct( WCHAR wc )
182 return NTDLL_iswctype( wc, 0x0010 );
185 /*********************************************************************
186 * CRTDLL_iswspace (CRTDLL.415)
188 INT __cdecl CRTDLL_iswspace( WCHAR wc )
190 return NTDLL_iswctype( wc, 0x0008 );
193 /*********************************************************************
194 * CRTDLL_iswupper (CRTDLL.416)
196 INT __cdecl CRTDLL_iswupper( WCHAR wc )
198 return NTDLL_iswctype( wc, 0x0001 );
201 /*********************************************************************
202 * CRTDLL_iswxdigit (CRTDLL.417)
204 INT __cdecl CRTDLL_iswxdigit( WCHAR wc )
206 return NTDLL_iswctype( wc, 0x0080 );