wchar.h 2.11 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*
 * Unicode definitions
 *
 * Derived from the mingw header written by Colin Peters.
 * Modified for Wine use by Jon Griffiths and Francois Gouget.
 * This file is in the public domain.
 */
#ifndef __WINE_WCHAR_H
#define __WINE_WCHAR_H
10

11
#include <corecrt_wctype.h>
12
#include <corecrt_wdirect.h>
13
#include <corecrt_wio.h>
14
#include <corecrt_wprocess.h>
15 16
#include <corecrt_wstdio.h>
#include <corecrt_wstdlib.h>
17
#include <corecrt_wstring.h>
18
#include <corecrt_wtime.h>
19
#include <sys/stat.h>
20

21 22 23 24
#ifdef __cplusplus
extern "C" {
#endif

25 26 27 28
#ifndef WCHAR_MIN  /* also in stdint.h */
#define WCHAR_MIN 0U
#define WCHAR_MAX 0xffffU
#endif
29

30
typedef int mbstate_t;
31

32 33
#ifndef _WLOCALE_DEFINED
#define _WLOCALE_DEFINED
34
_ACRTIMP wchar_t* __cdecl _wsetlocale(int,const wchar_t*);
35 36
#endif /* _WLOCALE_DEFINED */

37 38 39 40 41 42 43
wchar_t __cdecl btowc(int);
size_t  __cdecl mbrlen(const char *,size_t,mbstate_t*);
size_t  __cdecl mbrtowc(wchar_t*,const char*,size_t,mbstate_t*);
size_t  __cdecl mbsrtowcs(wchar_t*,const char**,size_t,mbstate_t*);
size_t  __cdecl wcrtomb(char*,wchar_t,mbstate_t*);
size_t  __cdecl wcsrtombs(char*,const wchar_t**,size_t,mbstate_t*);
int     __cdecl wctob(wint_t);
44 45

_ACRTIMP errno_t __cdecl wmemcpy_s(wchar_t *, size_t, const wchar_t *, size_t);
46

47 48 49 50 51 52 53 54
static inline wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n)
{
    const wchar_t *end;
    for (end = s + n; s < end; s++)
        if (*s == c) return (wchar_t*)s;
    return NULL;
}

55 56 57 58 59 60 61 62 63 64 65
static inline int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
{
    size_t i;
    for (i = 0; i < n; i++)
    {
        if (s1[i] > s2[i]) return 1;
        if (s1[i] < s2[i]) return -1;
    }
    return 0;
}

66 67
static inline wchar_t* __cdecl wmemcpy(wchar_t *dst, const wchar_t *src, size_t n)
{
68
    return (wchar_t*)memcpy(dst, src, n * sizeof(wchar_t));
69 70
}

71 72
static inline wchar_t* __cdecl wmemmove(wchar_t *dst, const wchar_t *src, size_t n)
{
73
    return (wchar_t*)memmove(dst, src, n * sizeof(wchar_t));
74 75
}

76 77 78 79 80 81 82 83
static inline wchar_t* __cdecl wmemset(wchar_t *s, wchar_t c, size_t n)
{
    size_t i;
    for (i = 0; i < n; i++)
        s[i] = c;
    return s;
}

84 85 86 87 88
#ifdef __cplusplus
}
#endif

#endif /* __WINE_WCHAR_H */