msvcrt: Added some assembly glue for the asm bits of __CxxFrameHandler
[wine] / dlls / msvcrt / wcs.c
1 /*
2  * msvcrt.dll wide-char functions
3  *
4  * Copyright 1999 Alexandre Julliard
5  * Copyright 2000 Jon Griffiths
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21 #include <limits.h>
22 #include <stdio.h>
23 #include <math.h>
24 #include <assert.h>
25 #include "msvcrt.h"
26 #include "winnls.h"
27 #include "wine/unicode.h"
28 #include "wine/debug.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
31
32
33 /* INTERNAL: MSVCRT_malloc() based wstrndup */
34 MSVCRT_wchar_t* msvcrt_wstrndup(const MSVCRT_wchar_t *buf, unsigned int size)
35 {
36   MSVCRT_wchar_t* ret;
37   unsigned int len = strlenW(buf), max_len;
38
39   max_len = size <= len? size : len + 1;
40
41   ret = MSVCRT_malloc(max_len * sizeof (MSVCRT_wchar_t));
42   if (ret)
43   {
44     memcpy(ret,buf,max_len * sizeof (MSVCRT_wchar_t));
45     ret[max_len] = 0;
46   }
47   return ret;
48 }
49
50 /*********************************************************************
51  *              _wcsdup (MSVCRT.@)
52  */
53 MSVCRT_wchar_t* _wcsdup( const MSVCRT_wchar_t* str )
54 {
55   MSVCRT_wchar_t* ret = NULL;
56   if (str)
57   {
58     int size = (strlenW(str) + 1) * sizeof(MSVCRT_wchar_t);
59     ret = MSVCRT_malloc( size );
60     if (ret) memcpy( ret, str, size );
61   }
62   return ret;
63 }
64
65 /*********************************************************************
66  *              _wcsicoll (MSVCRT.@)
67  */
68 INT _wcsicoll( const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* str2 )
69 {
70   /* FIXME: handle collates */
71   return strcmpiW( str1, str2 );
72 }
73
74 /*********************************************************************
75  *              _wcsnset (MSVCRT.@)
76  */
77 MSVCRT_wchar_t* _wcsnset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c, MSVCRT_size_t n )
78 {
79   MSVCRT_wchar_t* ret = str;
80   while ((n-- > 0) && *str) *str++ = c;
81   return ret;
82 }
83
84 /*********************************************************************
85  *              _wcsrev (MSVCRT.@)
86  */
87 MSVCRT_wchar_t* _wcsrev( MSVCRT_wchar_t* str )
88 {
89   MSVCRT_wchar_t* ret = str;
90   MSVCRT_wchar_t* end = str + strlenW(str) - 1;
91   while (end > str)
92   {
93     MSVCRT_wchar_t t = *end;
94     *end--  = *str;
95     *str++  = t;
96   }
97   return ret;
98 }
99
100 /*********************************************************************
101  *              _wcsset (MSVCRT.@)
102  */
103 MSVCRT_wchar_t* _wcsset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c )
104 {
105   MSVCRT_wchar_t* ret = str;
106   while (*str) *str++ = c;
107   return ret;
108 }
109
110 /*********************************************************************
111  *              wcstod (MSVCRT.@)
112  */
113 double MSVCRT_wcstod(const MSVCRT_wchar_t* lpszStr, MSVCRT_wchar_t** end)
114 {
115   const MSVCRT_wchar_t* str = lpszStr;
116   int negative = 0;
117   double ret = 0, divisor = 10.0;
118
119   TRACE("(%s,%p) semi-stub\n", debugstr_w(lpszStr), end);
120
121   /* FIXME:
122    * - Should set errno on failure
123    * - Should fail on overflow
124    * - Need to check which input formats are allowed
125    */
126   while (isspaceW(*str))
127     str++;
128
129   if (*str == '-')
130   {
131     negative = 1;
132     str++;
133   }
134
135   while (isdigitW(*str))
136   {
137     ret = ret * 10.0 + (*str - '0');
138     str++;
139   }
140   if (*str == '.')
141     str++;
142   while (isdigitW(*str))
143   {
144     ret = ret + (*str - '0') / divisor;
145     divisor *= 10;
146     str++;
147   }
148
149   if (*str == 'E' || *str == 'e' || *str == 'D' || *str == 'd')
150   {
151     int negativeExponent = 0;
152     int exponent = 0;
153     if (*(++str) == '-')
154     {
155       negativeExponent = 1;
156       str++;
157     }
158     while (isdigitW(*str))
159     {
160       exponent = exponent * 10 + (*str - '0');
161       str++;
162     }
163     if (exponent != 0)
164     {
165       if (negativeExponent)
166         ret = ret / pow(10.0, exponent);
167       else
168         ret = ret * pow(10.0, exponent);
169     }
170   }
171
172   if (negative)
173     ret = -ret;
174
175   if (end)
176     *end = (MSVCRT_wchar_t*)str;
177
178   TRACE("returning %g\n", ret);
179   return ret;
180 }
181
182
183 typedef struct pf_output_t
184 {
185     int used;
186     int len;
187     BOOL unicode;
188     union {
189         LPWSTR W;
190         LPSTR  A;
191     } buf;
192 } pf_output;
193
194 typedef struct pf_flags_t
195 {
196     char Sign, LeftAlign, Alternate, PadZero;
197     int FieldLength, Precision;
198     char IntegerLength, IntegerDouble;
199     char WideString;
200     char Format;
201 } pf_flags;
202
203 /*
204  * writes a string of characters to the output
205  * returns -1 if the string doesn't fit in the output buffer
206  * return the length of the string if all characters were written
207  */
208 static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
209 {
210     int space = out->len - out->used;
211
212     if( len < 0 )
213         len = strlenW( str );
214     if( out->unicode )
215     {
216         LPWSTR p = out->buf.W + out->used;
217
218         if( space >= len )
219         {
220             memcpy( p, str, len*sizeof(WCHAR) );
221             out->used += len;
222             return len;
223         }
224         if( space > 0 )
225             memcpy( p, str, space*sizeof(WCHAR) );
226         out->used += len;
227     }
228     else
229     {
230         int n = WideCharToMultiByte( CP_ACP, 0, str, len, NULL, 0, NULL, NULL );
231         LPSTR p = out->buf.A + out->used;
232
233         if( space >= n )
234         {
235             WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL );
236             out->used += n;
237             return len;
238         }
239         if( space > 0 )
240             WideCharToMultiByte( CP_ACP, 0, str, len, p, space, NULL, NULL );
241         out->used += n;
242     }
243     return -1;
244 }
245
246 static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len )
247 {
248     int space = out->len - out->used;
249
250     if( len < 0 )
251         len = strlen( str );
252     if( !out->unicode )
253     {
254         LPSTR p = out->buf.A + out->used;
255
256         if( space >= len )
257         {
258             memcpy( p, str, len );
259             out->used += len;
260             return len;
261         }
262         if( space > 0 )
263             memcpy( p, str, space );
264         out->used += len;
265     }
266     else
267     {
268         int n = MultiByteToWideChar( CP_ACP, 0, str, len, NULL, 0 );
269         LPWSTR p = out->buf.W + out->used;
270
271         if( space >= n )
272         {
273             MultiByteToWideChar( CP_ACP, 0, str, len, p, n );
274             out->used += n;
275             return len;
276         }
277         if( space > 0 )
278             MultiByteToWideChar( CP_ACP, 0, str, len, p, space );
279         out->used += n;
280     }
281     return -1;
282 }
283
284 static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left )
285 {
286     int i, r = 0;
287
288     if( flags->Sign && !( flags->Format == 'd' || flags->Format == 'i' ) )
289         flags->Sign = 0;
290
291     if( left && flags->Sign )
292     {
293         flags->FieldLength--;
294         if( flags->PadZero )
295             r = pf_output_stringA( out, &flags->Sign, 1 );
296     }
297
298     if( ( !left &&  flags->LeftAlign ) || 
299         (  left && !flags->LeftAlign ))
300     {
301         for( i=0; (i<(flags->FieldLength-len)) && (r>=0); i++ )
302         {
303             if( left && flags->PadZero )
304                 r = pf_output_stringA( out, "0", 1 );
305             else
306                 r = pf_output_stringA( out, " ", 1 );
307         }
308     }
309
310     if( left && flags->Sign && !flags->PadZero )
311         r = pf_output_stringA( out, &flags->Sign, 1 );
312
313     return r;
314 }
315
316 static inline int pf_output_format_W( pf_output *out, LPCWSTR str,
317                                       int len, pf_flags *flags )
318 {
319     int r = 0;
320
321     if( len < 0 )
322         len = strlenW( str );
323
324     if (flags->Precision >= 0 && flags->Precision < len)
325         len = flags->Precision;
326
327     r = pf_fill( out, len, flags, 1 );
328
329     if( r>=0 )
330         r = pf_output_stringW( out, str, len );
331
332     if( r>=0 )
333         r = pf_fill( out, len, flags, 0 );
334
335     return r;
336 }
337
338 static inline int pf_output_format_A( pf_output *out, LPCSTR str,
339                                       int len, pf_flags *flags )
340 {
341     int r = 0;
342
343     if( len < 0 )
344         len = strlen( str );
345
346     if (flags->Precision >= 0 && flags->Precision < len)
347         len = flags->Precision;
348
349     r = pf_fill( out, len, flags, 1 );
350
351     if( r>=0 )
352         r = pf_output_stringA( out, str, len );
353
354     if( r>=0 )
355         r = pf_fill( out, len, flags, 0 );
356
357     return r;
358 }
359
360 static inline BOOL pf_is_integer_format( char fmt )
361 {
362     static const char float_fmts[] = "diouxX";
363     if (!fmt)
364         return FALSE;
365     return strchr( float_fmts, fmt ) ? TRUE : FALSE;
366 }
367
368 static inline BOOL pf_is_double_format( char fmt )
369 {
370     static const char float_fmts[] = "aeEfgG";
371     if (!fmt)
372         return FALSE;
373     return strchr( float_fmts, fmt ) ? TRUE : FALSE;
374 }
375
376 static inline BOOL pf_is_valid_format( char fmt )
377 {
378     static const char float_fmts[] = "acCdeEfgGinouxX";
379     if (!fmt)
380         return FALSE;
381     return strchr( float_fmts, fmt ) ? TRUE : FALSE;
382 }
383
384 static void pf_rebuild_format_string( char *p, pf_flags *flags )
385 {
386     *p++ = '%';
387     if( flags->Sign )
388         *p++ = flags->Sign;
389     if( flags->LeftAlign )
390         *p++ = flags->LeftAlign;
391     if( flags->Alternate )
392         *p++ = flags->Alternate;
393     if( flags->PadZero )
394         *p++ = flags->PadZero;
395     if( flags->FieldLength )
396     {
397         sprintf(p, "%d", flags->FieldLength);
398         p += strlen(p);
399     }
400     if( flags->Precision >= 0 )
401     {
402         sprintf(p, ".%d", flags->Precision);
403         p += strlen(p);
404     }
405     *p++ = flags->Format;
406     *p++ = 0;
407 }
408
409 /* pf_integer_conv:  prints x to buf, including alternate formats,
410    but not the sign */
411 static void pf_integer_conv( char *buf, pf_flags *flags, LONGLONG x )
412 {
413     unsigned int base;
414     char *digits;
415
416     int i, j, k;
417     char tmp[40];
418
419     base = 10;
420     if( flags->Format == 'o' )
421         base = 8;
422     else if( flags->Format == 'x' || flags->Format == 'X' )
423         base = 16;
424
425     if( flags->Format == 'X' )
426         digits = "0123456789ABCDEFX";
427     else
428         digits = "0123456789abcdefx";
429
430     if( x < 0 && ( flags->Format == 'd' || flags->Format == 'i' ) )
431     {
432         x = -x;
433         flags->Sign = '-';
434     }
435
436     /* Do conversion (backwards) */
437     i = 0;
438     if( x == 0 && flags->Precision )
439         tmp[i++] = '0';
440     else
441         while( x != 0 )
442         {
443             j = (ULONGLONG) x % base;
444             x = (ULONGLONG) x / base;
445             tmp[i++] = digits[j];
446         }
447     k = flags->Precision - i;
448     while( k-- > 0 )
449         tmp[i++] = '0';
450     if( flags->Alternate )
451     {
452         if( base == 16 )
453         {
454             tmp[i++] = digits[16];
455             tmp[i++] = '0';
456         }
457         else if( base == 8 && tmp[i-1] != '0' )
458             tmp[i++] = '0';
459     }
460
461     /* Reverse for buf */
462     j = 0;
463     while( i-- > 0 )
464         buf[j++] = tmp[i];
465     buf[j] = '\0';
466
467     /* Adjust precision so pf_fill won't truncate the number later */
468     flags->Precision = strlen( buf );
469
470     return;
471 }
472
473 /*********************************************************************
474  *  pf_vsnprintf  (INTERNAL)
475  *
476  *  implements both A and W vsnprintf functions
477  */
478 static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
479 {
480     int r;
481     LPCWSTR q, p = format;
482     pf_flags flags;
483
484     TRACE("format is %s\n",debugstr_w(format));
485     while (*p)
486     {
487         q = strchrW( p, '%' );
488
489         /* there's no % characters left, output the rest of the string */
490         if( !q )
491         {
492             r = pf_output_stringW(out, p, -1);
493             if( r<0 )
494                 return r;
495             p += r;
496             continue;
497         }
498
499         /* there's characters before the %, output them */
500         if( q != p )
501         {
502             r = pf_output_stringW(out, p, q - p);
503             if( r<0 )
504                 return r;
505             p = q;
506         }
507
508         /* we must be at a % now, skip over it */
509         assert( *p == '%' );
510         p++;
511
512         /* output a single % character */
513         if( *p == '%' )
514         {
515             r = pf_output_stringW(out, p++, 1);
516             if( r<0 )
517                 return r;
518             continue;
519         }
520
521         /* parse the flags */
522         memset( &flags, 0, sizeof flags );
523         while (*p)
524         {
525             if( *p == '+' || *p == ' ' )
526             {
527                 if ( flags.Sign != '+' )
528                     flags.Sign = *p;
529             }
530             else if( *p == '-' )
531                 flags.LeftAlign = *p;
532             else if( *p == '0' )
533                 flags.PadZero = *p;
534             else if( *p == '#' )
535                 flags.Alternate = *p;
536             else
537                 break;
538             p++;
539         }
540
541         /* deal with the field width specifier */
542         flags.FieldLength = 0;
543         if( *p == '*' ) 
544         {
545             flags.FieldLength = va_arg( valist, int );
546             p++;
547         }
548         else while( isdigit(*p) )
549         {
550             flags.FieldLength *= 10;
551             flags.FieldLength += *p++ - '0';
552         }
553
554         /* deal with precision */
555         flags.Precision = -1;
556         if( *p == '.' )
557         {
558             flags.Precision = 0;
559             p++;
560             if( *p == '*' )
561             {
562                 flags.Precision = va_arg( valist, int );
563                 p++;
564             }
565             else while( isdigit(*p) )
566             {
567                 flags.Precision *= 10;
568                 flags.Precision += *p++ - '0';
569             }
570         }
571
572         /* deal with integer width modifier */
573         while( *p )
574         {
575             if( *p == 'h' || *p == 'l' || *p == 'L' )
576             {
577                 flags.IntegerLength = *p;
578                 p++;
579             }
580             else if( *p == 'I' )
581             {
582                 if( *(p+1) == '6' && *(p+2) == '4' )
583                 {
584                     flags.IntegerDouble++;
585                     p += 3;
586                 }
587                 else if( *(p+1) == '3' && *(p+2) == '2' )
588                     p += 3;
589                 else if( isdigit(*(p+1)) || *(p+1) == 0 )
590                     break;
591                 else
592                     p++;
593             }
594             else if( *p == 'w' )
595                 flags.WideString = *p++;
596             else if( *p == 'F' )
597                 p++; /* ignore */
598             else
599                 break;
600         }
601
602         flags.Format = *p;
603         r = 0;
604
605         /* output a unicode string */
606         if( ( flags.Format == 's' && (flags.WideString || flags.IntegerLength == 'l' )) ||
607             ( !out->unicode && flags.Format == 'S' ) ||
608             ( out->unicode && flags.Format == 's' ) )
609         {
610             LPCWSTR str = va_arg( valist, const WCHAR * );
611
612             if( str )
613                 r = pf_output_format_W( out, str, -1, &flags );
614             else
615                 r = pf_output_format_A( out, "(null)", -1, &flags );
616         }
617
618         /* output a ASCII string */
619         else if( ( flags.Format == 's' && flags.IntegerLength == 'h' ) ||
620             ( out->unicode && flags.Format == 'S' ) ||
621             ( !out->unicode && flags.Format == 's' ) )
622         {
623             LPCSTR str = va_arg( valist, const CHAR * );
624
625             if( str )
626                 r = pf_output_format_A( out, str, -1, &flags );
627             else
628                 r = pf_output_format_A( out, "(null)", -1, &flags );
629         }
630
631         /* output a single wide character */
632         else if( ( flags.Format == 'c' && flags.IntegerLength == 'w' ) ||
633             ( out->unicode && flags.Format == 'c' ) ||
634             ( !out->unicode && flags.Format == 'C' ) )
635         {
636             WCHAR ch = va_arg( valist, int );
637
638             r = pf_output_format_W( out, &ch, 1, &flags );
639         }
640
641         /* output a single ascii character */
642         else if( ( flags.Format == 'c' && flags.IntegerLength == 'h' ) ||
643             ( out->unicode && flags.Format == 'C' ) ||
644             ( !out->unicode && flags.Format == 'c' ) )
645         {
646             CHAR ch = va_arg( valist, int );
647
648             r = pf_output_format_A( out, &ch, 1, &flags );
649         }
650
651         /* output a pointer */
652         else if( flags.Format == 'p' )
653         {
654             char pointer[11];
655
656             flags.PadZero = 0;
657             if( flags.Alternate )
658                 sprintf(pointer, "0X%08lX", va_arg(valist, long));
659             else
660                 sprintf(pointer, "%08lX", va_arg(valist, long));
661             r = pf_output_format_A( out, pointer, -1, &flags );
662         }
663
664         /* deal with %n */
665         else if( flags.Format == 'n' )
666         {
667             int *x = va_arg(valist, int *);
668             *x = out->used;
669         }
670
671         /* deal with 64-bit integers */
672         else if( pf_is_integer_format( flags.Format ) && flags.IntegerDouble )
673         {
674             char number[40], *x = number;
675
676             if( flags.FieldLength >= sizeof number )
677                 x = HeapAlloc( GetProcessHeap(), 0, flags.FieldLength+1 );
678
679             pf_integer_conv( x, &flags, va_arg(valist, LONGLONG) );
680
681             r = pf_output_format_A( out, x, -1, &flags );
682             if( x != number )
683                 HeapFree( GetProcessHeap(), 0, number );
684         }
685
686         /* deal with integers and floats using libc's printf */
687         else if( pf_is_valid_format( flags.Format ) )
688         {
689             char fmt[20], number[40], *x = number;
690
691             if( flags.FieldLength >= sizeof number )
692                 x = HeapAlloc( GetProcessHeap(), 0, flags.FieldLength+1 );
693
694             pf_rebuild_format_string( fmt, &flags );
695
696             if( pf_is_double_format( flags.Format ) )
697                 sprintf( x, fmt, va_arg(valist, double) );
698             else
699                 sprintf( x, fmt, va_arg(valist, int) );
700
701             r = pf_output_stringA( out, x, -1 );
702             if( x != number )
703                 HeapFree( GetProcessHeap(), 0, number );
704         }
705         else
706             continue;
707
708         if( r<0 )
709             return r;
710         p++;
711     }
712
713     /* check we reached the end, and null terminate the string */
714     assert( *p == 0 );
715     r = pf_output_stringW( out, p, 1 );
716     if( r<0 )
717         return r;
718
719     return out->used - 1;
720 }
721
722 /*********************************************************************
723  *              _vsnprintf (MSVCRT.@)
724  */
725 int MSVCRT_vsnprintf( char *str, unsigned int len,
726                 const char *format, va_list valist )
727 {
728     DWORD sz;
729     LPWSTR formatW = NULL;
730     pf_output out;
731     int r;
732
733     out.unicode = FALSE;
734     out.buf.A = str;
735     out.used = 0;
736     out.len = len;
737
738     if( format )
739     {
740         sz = MultiByteToWideChar( CP_ACP, 0, format, -1, NULL, 0 );
741         formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
742         MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
743     }
744
745     r = pf_vsnprintf( &out, formatW, valist );
746
747     HeapFree( GetProcessHeap(), 0, formatW );
748
749     return r;
750 }
751
752 /*********************************************************************
753  *              _vsnwsprintf (MSVCRT.@)
754  */
755 int MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
756                               const WCHAR *format, va_list valist )
757 {
758     pf_output out;
759
760     out.unicode = TRUE;
761     out.buf.W = str;
762     out.used = 0;
763     out.len = len;
764
765     return pf_vsnprintf( &out, format, valist );
766 }
767
768 /*********************************************************************
769  *              sprintf (MSVCRT.@)
770  */
771 int MSVCRT_sprintf( char *str, const char *format, ... )
772 {
773     va_list ap;
774     int r;
775
776     va_start( ap, format );
777     r = MSVCRT_vsnprintf( str, INT_MAX, format, ap );
778     va_end( ap );
779     return r;
780 }
781
782 /*********************************************************************
783  *              swprintf (MSVCRT.@)
784  */
785 int MSVCRT_swprintf( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ... )
786 {
787     va_list ap;
788     int r;
789
790     va_start( ap, format );
791     r = MSVCRT_vsnwprintf( str, INT_MAX, format, ap );
792     va_end( ap );
793     return r;
794 }
795
796 /*********************************************************************
797  *              vswprintf (MSVCRT.@)
798  */
799 int MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, va_list args )
800 {
801     return MSVCRT_vsnwprintf( str, INT_MAX, format, args );
802 }
803
804 /*********************************************************************
805  *              wcscoll (MSVCRT.@)
806  */
807 int MSVCRT_wcscoll( const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* str2 )
808 {
809   /* FIXME: handle collates */
810   return strcmpW( str1, str2 );
811 }
812
813 /*********************************************************************
814  *              wcspbrk (MSVCRT.@)
815  */
816 MSVCRT_wchar_t* MSVCRT_wcspbrk( const MSVCRT_wchar_t* str, const MSVCRT_wchar_t* accept )
817 {
818   const MSVCRT_wchar_t* p;
819   while (*str)
820   {
821     for (p = accept; *p; p++) if (*p == *str) return (MSVCRT_wchar_t*)str;
822       str++;
823   }
824   return NULL;
825 }
826
827 /*********************************************************************
828  *              wctomb (MSVCRT.@)
829  */
830 INT MSVCRT_wctomb( char *dst, MSVCRT_wchar_t ch )
831 {
832   return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL );
833 }
834
835 /*********************************************************************
836  *              iswalnum (MSVCRT.@)
837  */
838 INT MSVCRT_iswalnum( MSVCRT_wchar_t wc )
839 {
840     return isalnumW( wc );
841 }
842
843 /*********************************************************************
844  *              iswalpha (MSVCRT.@)
845  */
846 INT MSVCRT_iswalpha( MSVCRT_wchar_t wc )
847 {
848     return isalphaW( wc );
849 }
850
851 /*********************************************************************
852  *              iswcntrl (MSVCRT.@)
853  */
854 INT MSVCRT_iswcntrl( MSVCRT_wchar_t wc )
855 {
856     return iscntrlW( wc );
857 }
858
859 /*********************************************************************
860  *              iswdigit (MSVCRT.@)
861  */
862 INT MSVCRT_iswdigit( MSVCRT_wchar_t wc )
863 {
864     return isdigitW( wc );
865 }
866
867 /*********************************************************************
868  *              iswgraph (MSVCRT.@)
869  */
870 INT MSVCRT_iswgraph( MSVCRT_wchar_t wc )
871 {
872     return isgraphW( wc );
873 }
874
875 /*********************************************************************
876  *              iswlower (MSVCRT.@)
877  */
878 INT MSVCRT_iswlower( MSVCRT_wchar_t wc )
879 {
880     return islowerW( wc );
881 }
882
883 /*********************************************************************
884  *              iswprint (MSVCRT.@)
885  */
886 INT MSVCRT_iswprint( MSVCRT_wchar_t wc )
887 {
888     return isprintW( wc );
889 }
890
891 /*********************************************************************
892  *              iswpunct (MSVCRT.@)
893  */
894 INT MSVCRT_iswpunct( MSVCRT_wchar_t wc )
895 {
896     return ispunctW( wc );
897 }
898
899 /*********************************************************************
900  *              iswspace (MSVCRT.@)
901  */
902 INT MSVCRT_iswspace( MSVCRT_wchar_t wc )
903 {
904     return isspaceW( wc );
905 }
906
907 /*********************************************************************
908  *              iswupper (MSVCRT.@)
909  */
910 INT MSVCRT_iswupper( MSVCRT_wchar_t wc )
911 {
912     return isupperW( wc );
913 }
914
915 /*********************************************************************
916  *              iswxdigit (MSVCRT.@)
917  */
918 INT MSVCRT_iswxdigit( MSVCRT_wchar_t wc )
919 {
920     return isxdigitW( wc );
921 }