2 * CRTDLL wide-char functions
4 * Copyright 1999 Alexandre Julliard
16 #include "wine/unicode.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(crtdll
);
23 /*********************************************************************
24 * CRTDLL__wcsdup (CRTDLL.320)
26 LPWSTR __cdecl
CRTDLL__wcsdup( LPCWSTR str
)
31 int size
= (strlenW(str
) + 1) * sizeof(WCHAR
);
32 ret
= CRTDLL_malloc( size
);
33 if (ret
) memcpy( ret
, str
, size
);
39 /*********************************************************************
40 * CRTDLL__wcsicoll (CRTDLL.322)
42 INT __cdecl
CRTDLL__wcsicoll( LPCWSTR str1
, LPCWSTR str2
)
44 /* FIXME: handle collates */
45 return strcmpiW( str1
, str2
);
49 /*********************************************************************
50 * CRTDLL__wcsnset (CRTDLL.325)
52 LPWSTR __cdecl
CRTDLL__wcsnset( LPWSTR str
, WCHAR c
, INT n
)
55 while ((n
-- > 0) && *str
) *str
++ = c
;
60 /*********************************************************************
61 * CRTDLL__wcsrev (CRTDLL.326)
63 LPWSTR __cdecl
CRTDLL__wcsrev( LPWSTR str
)
66 LPWSTR end
= str
+ strlenW(str
) - 1;
77 /*********************************************************************
78 * CRTDLL__wcsset (CRTDLL.327)
80 LPWSTR __cdecl
CRTDLL__wcsset( LPWSTR str
, WCHAR c
)
83 while (*str
) *str
++ = c
;
88 /*********************************************************************
89 * CRTDLL_wcscoll (CRTDLL.506)
91 DWORD __cdecl
CRTDLL_wcscoll( LPCWSTR str1
, LPCWSTR str2
)
93 /* FIXME: handle collates */
94 return strcmpW( str1
, str2
);
98 /*********************************************************************
99 * CRTDLL_wcspbrk (CRTDLL.514)
101 LPWSTR __cdecl
CRTDLL_wcspbrk( LPCWSTR str
, LPCWSTR accept
)
106 for (p
= accept
; *p
; p
++) if (*p
== *str
) return (LPWSTR
)str
;
113 /*********************************************************************
114 * CRTDLL_wctomb (CRTDLL.524)
116 INT __cdecl
CRTDLL_wctomb( LPSTR dst
, WCHAR ch
)
118 return WideCharToMultiByte( CP_ACP
, 0, &ch
, 1, dst
, 6, NULL
, NULL
);
121 /*********************************************************************
122 * CRTDLL_iswalnum (CRTDLL.405)
124 INT __cdecl
CRTDLL_iswalnum( WCHAR wc
)
126 return get_char_typeW(wc
) & (C1_ALPHA
|C1_DIGIT
|C1_LOWER
|C1_UPPER
);
129 /*********************************************************************
130 * CRTDLL_iswalpha (CRTDLL.406)
132 INT __cdecl
CRTDLL_iswalpha( WCHAR wc
)
134 return get_char_typeW(wc
) & (C1_ALPHA
|C1_LOWER
|C1_UPPER
);
137 /*********************************************************************
138 * CRTDLL_iswcntrl (CRTDLL.408)
140 INT __cdecl
CRTDLL_iswcntrl( WCHAR wc
)
142 return get_char_typeW(wc
) & C1_CNTRL
;
145 /*********************************************************************
146 * CRTDLL_iswdigit (CRTDLL.410)
148 INT __cdecl
CRTDLL_iswdigit( WCHAR wc
)
150 return get_char_typeW(wc
) & C1_DIGIT
;
153 /*********************************************************************
154 * CRTDLL_iswgraph (CRTDLL.411)
156 INT __cdecl
CRTDLL_iswgraph( WCHAR wc
)
158 return get_char_typeW(wc
) & (C1_ALPHA
|C1_PUNCT
|C1_DIGIT
|C1_LOWER
|C1_UPPER
);
161 /*********************************************************************
162 * CRTDLL_iswlower (CRTDLL.412)
164 INT __cdecl
CRTDLL_iswlower( WCHAR wc
)
166 return get_char_typeW(wc
) & C1_LOWER
;
169 /*********************************************************************
170 * CRTDLL_iswprint (CRTDLL.413)
172 INT __cdecl
CRTDLL_iswprint( WCHAR wc
)
174 return get_char_typeW(wc
) & (C1_ALPHA
|C1_BLANK
|C1_PUNCT
|C1_DIGIT
|C1_LOWER
|C1_UPPER
);
177 /*********************************************************************
178 * CRTDLL_iswpunct (CRTDLL.414)
180 INT __cdecl
CRTDLL_iswpunct( WCHAR wc
)
182 return get_char_typeW(wc
) & C1_PUNCT
;
185 /*********************************************************************
186 * CRTDLL_iswspace (CRTDLL.415)
188 INT __cdecl
CRTDLL_iswspace( WCHAR wc
)
190 return get_char_typeW(wc
) & C1_SPACE
;
193 /*********************************************************************
194 * CRTDLL_iswupper (CRTDLL.416)
196 INT __cdecl
CRTDLL_iswupper( WCHAR wc
)
198 return get_char_typeW(wc
) & C1_UPPER
;
201 /*********************************************************************
202 * CRTDLL_iswxdigit (CRTDLL.417)
204 INT __cdecl
CRTDLL_iswxdigit( WCHAR wc
)
206 return get_char_typeW(wc
) & C1_XDIGIT
;