2 * Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
15 /* stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does.
16 * In all other cases we will do that. */
21 #define __WINT_TYPE__ unsigned int
24 typedef __WINT_TYPE__
wint_t;
34 char data
[1024 + 8]; /* 1024 bytes for data, 8 for alignment space */
38 #define WEOF ((wint_t)(-1))
40 #define WCHAR_MIN 0x00000000UL
41 #define WCHAR_MAX 0x7FFFFFFFUL
44 * Haiku is always using UTF32 in wchars, other encodings can be handled
45 * by converting to/from wchar by means of mbrtowc() or wcrtomb().
53 extern wint_t btowc(int);
55 extern wint_t fgetwc(FILE *stream
);
56 extern wchar_t *fgetws(wchar_t *dest
, int destLength
, FILE *stream
);
57 extern wint_t fputwc(wchar_t wc
, FILE *stream
);
58 extern int fputws(const wchar_t *wcs
, FILE *stream
);
59 extern int fwide(FILE *stream
, int mode
);
60 extern int fwprintf(FILE *stream
, const wchar_t *format
, ...);
61 extern int fwscanf(FILE *stream
, const wchar_t *format
, ...);
62 extern wint_t getwc(FILE *stream
);
63 extern wint_t getwchar(void);
65 extern size_t mbrlen(const char *s
, size_t n
, mbstate_t *mbState
);
66 extern size_t mbrtowc(wchar_t *dest
, const char *src
, size_t srcLength
,
68 extern int mbsinit(const mbstate_t *mbState
);
69 extern size_t mbsnrtowcs(wchar_t *dest
, const char **src
, size_t srcLength
,
70 size_t destLength
, mbstate_t *mbState
);
71 extern size_t mbsrtowcs(wchar_t *dest
, const char **src
, size_t destLength
,
74 extern wint_t putwc(wchar_t wc
, FILE *stream
);
75 extern wint_t putwchar(wchar_t wc
);
77 extern int swprintf(wchar_t *dest
, size_t destLength
,
78 const wchar_t *format
, ...);
79 extern int swscanf(const wchar_t *wcs
, const wchar_t *format
, ...);
81 extern wint_t ungetwc(wint_t wc
, FILE *stream
);
83 extern int vfwprintf(FILE *stream
, const wchar_t *format
, va_list arg
);
84 extern int vfwscanf(FILE *stream
, const wchar_t *format
, va_list arg
);
85 extern int vswprintf(wchar_t *dest
, size_t destLength
,
86 const wchar_t *format
, va_list arg
);
87 extern int vswscanf(const wchar_t *wcs
, const wchar_t *format
,
89 extern int vwprintf(const wchar_t *format
, va_list arg
);
90 extern int vwscanf(const wchar_t *format
, va_list arg
);
92 extern wchar_t *wcpcpy(wchar_t *dest
, const wchar_t *src
);
93 extern wchar_t *wcpncpy(wchar_t *dest
, const wchar_t *src
, size_t srcLength
);
94 extern size_t wcrtomb(char *dest
, wchar_t wc
, mbstate_t *mbState
);
95 extern int wcscasecmp(const wchar_t *wcs1
, const wchar_t *wcs2
);
96 extern wchar_t *wcscat(wchar_t *dest
, const wchar_t *src
);
97 extern wchar_t *wcschr(const wchar_t *wcs
, wchar_t wc
);
99 extern wchar_t *wcschrnul(const wchar_t *wcs
, wchar_t wc
);
101 extern int wcscmp(const wchar_t *wcs1
, const wchar_t *wcs2
);
102 extern int wcscoll(const wchar_t *wcs1
, const wchar_t *wcs2
);
103 extern wchar_t *wcscpy(wchar_t *dest
, const wchar_t *src
);
104 extern size_t wcscspn(const wchar_t *wcs
, const wchar_t *reject
);
105 extern wchar_t *wcsdup(const wchar_t *wcs
);
106 extern size_t wcsftime(wchar_t *dest
, size_t destLength
,
107 const wchar_t *format
, const struct tm
*timeptr
);
108 extern size_t wcslcat(wchar_t *dest
, const wchar_t *src
, size_t maxLength
);
109 extern size_t wcslcpy(wchar_t *dest
, const wchar_t *src
, size_t maxLength
);
110 extern size_t wcslen(const wchar_t *wcs
);
111 extern int wcsncasecmp(const wchar_t *wcs1
, const wchar_t *wcs2
,
113 extern wchar_t *wcsncat(wchar_t *dest
, const wchar_t *src
, size_t srcLength
);
114 extern int wcsncmp(const wchar_t *wcs1
, const wchar_t *wcs2
,
116 extern wchar_t *wcsncpy(wchar_t *dest
, const wchar_t *src
, size_t srcLength
);
117 extern size_t wcsnlen(const wchar_t *wcs
, size_t maxLength
);
118 extern size_t wcsnrtombs(char *dest
, const wchar_t **src
, size_t srcLength
,
119 size_t destLength
, mbstate_t *mbState
);
120 extern wchar_t *wcspbrk(const wchar_t *wcs
, const wchar_t *accept
);
121 extern wchar_t *wcsrchr(const wchar_t *wcs
, wchar_t wc
);
122 extern size_t wcsrtombs(char *dest
, const wchar_t **src
, size_t destLength
,
124 extern size_t wcsspn(const wchar_t *wcs
, const wchar_t *accept
);
125 extern wchar_t *wcsstr(const wchar_t *haystack
, const wchar_t *needle
);
126 extern double wcstod(const wchar_t *wcs
, wchar_t **endPtr
);
127 extern float wcstof(const wchar_t *wcs
, wchar_t **endPtr
);
128 extern wchar_t *wcstok(wchar_t *wcs1
, const wchar_t *wcs2
, wchar_t **ptr
);
129 extern long wcstol(const wchar_t *wcs
, wchar_t **endPtr
, int base
);
130 extern long double wcstold(const wchar_t *wcs
, wchar_t **endPtr
);
131 extern long long wcstoll(const wchar_t *wcs
, wchar_t **endPtr
, int base
);
132 extern unsigned long wcstoul(const wchar_t *wcs
, wchar_t **endPtr
,
134 extern unsigned long long wcstoull(const wchar_t *wcs
, wchar_t **endPtr
,
136 extern wchar_t *wcswcs(const wchar_t *haystack
, const wchar_t *needle
);
137 extern int wcswidth(const wchar_t *wcs
, size_t length
);
138 extern size_t wcsxfrm(wchar_t *dest
, const wchar_t *src
, size_t destLength
);
139 extern int wctob(wint_t wc
);
140 extern int wcwidth(wchar_t wc
);
141 extern wchar_t *wmemchr(const wchar_t *wcs
, wchar_t wc
, size_t n
);
142 extern int wmemcmp(const wchar_t *wcs1
, const wchar_t *wcs2
, size_t n
);
143 extern wchar_t *wmemcpy(wchar_t *dest
, const wchar_t *src
, size_t n
);
144 extern wchar_t *wmemmove(wchar_t *dest
, const wchar_t *src
, size_t n
);
146 extern wchar_t *wmempcpy(wchar_t *dest
, const wchar_t *src
, size_t n
);
148 extern wchar_t *wmemset(wchar_t *dest
, wchar_t wc
, size_t n
);
150 extern int wprintf(const wchar_t *format
, ...);
151 extern int wscanf(const wchar_t *format
, ...);
157 #endif /* _WCHAR_H */