Cleaned up a few inter-dll dependencies. Added a few imports.
[wine/multimedia.git] / dlls / crtdll / wcstring.c
blobcbc480526d662b46ce2435e6bdd966f3f9dec6cc
1 /*
2 * CRTDLL wide-char functions
4 * Copyright 1999 Alexandre Julliard
5 */
7 #include "config.h"
9 #include <ctype.h>
10 #include <stdlib.h>
11 #include <string.h>
13 #include "windef.h"
14 #include "winbase.h"
15 #include "winnls.h"
16 #include "wine/unicode.h"
17 #include "crtdll.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(crtdll);
23 /*********************************************************************
24 * CRTDLL__wcsdup (CRTDLL.320)
26 LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str )
28 LPWSTR ret = NULL;
29 if (str)
31 int size = (strlenW(str) + 1) * sizeof(WCHAR);
32 ret = CRTDLL_malloc( size );
33 if (ret) memcpy( ret, str, size );
35 return ret;
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 )
54 LPWSTR ret = str;
55 while ((n-- > 0) && *str) *str++ = c;
56 return ret;
60 /*********************************************************************
61 * CRTDLL__wcsrev (CRTDLL.326)
63 LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str )
65 LPWSTR ret = str;
66 LPWSTR end = str + strlenW(str) - 1;
67 while (end > str)
69 WCHAR t = *end;
70 *end-- = *str;
71 *str++ = t;
73 return ret;
77 /*********************************************************************
78 * CRTDLL__wcsset (CRTDLL.327)
80 LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c )
82 LPWSTR ret = str;
83 while (*str) *str++ = c;
84 return ret;
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 )
103 LPCWSTR p;
104 while (*str)
106 for (p = accept; *p; p++) if (*p == *str) return (LPWSTR)str;
107 str++;
109 return NULL;
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;