xref: /haiku/headers/posix/wchar.h (revision 746cac055adc6ac3308c7bc2d29040fb95689cc9)
1 /*
2  * Copyright 2008 Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _WCHAR_H
6 #define _WCHAR_H
7 
8 #include <stddef.h>
9 #include <stdio.h>
10 
11 /* stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does.
12  * In all other cases we will do that. */
13 #ifndef _WINT_T
14 #define _WINT_T
15 
16 #ifndef __WINT_TYPE__
17 #define __WINT_TYPE__ unsigned int
18 #endif
19 
20 typedef __WINT_TYPE__ wint_t;
21 
22 #endif	/* _WINT_T */
23 
24 typedef int wctype_t;
25 
26 typedef struct {
27 	int		__count;
28 	wint_t	__value;
29 } mbstate_t;
30 
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 extern wint_t	fgetwc(FILE *);
37 extern wchar_t	*fgetws(wchar_t *, int, FILE *);
38 extern wint_t	fputwc(wchar_t, FILE *);
39 extern int		fputws(const wchar_t *, FILE *);
40 extern wint_t	getwc(FILE *);
41 extern wint_t	getwchar(void);
42 
43 extern int	iswalnum(wint_t);
44 extern int	iswalpha(wint_t);
45 extern int	iswcntrl(wint_t);
46 extern int	iswdigit(wint_t);
47 extern int	iswgraph(wint_t);
48 extern int	iswlower(wint_t);
49 extern int	iswprint(wint_t);
50 extern int	iswpunct(wint_t);
51 extern int	iswspace(wint_t);
52 extern int	iswupper(wint_t);
53 extern int	iswxdigit(wint_t);
54 extern int 	iswctype(wint_t, wctype_t);
55 
56 extern wint_t	putwc(wchar_t, FILE *);
57 extern wint_t	putwchar(wchar_t);
58 
59 extern size_t 	mbrlen(const char *s, size_t n, mbstate_t *ps);
60 extern size_t 	mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
61 extern size_t	mbsrtowcs(wchar_t *dst, const char **src, size_t len,
62 					mbstate_t *ps);
63 extern int		mbsinit(const mbstate_t *);
64 
65 extern wint_t	towlower(wint_t);
66 extern wint_t	towupper(wint_t);
67 extern wint_t	ungetwc(wint_t, FILE *);
68 
69 extern size_t   wcrtomb(char *, wchar_t, mbstate_t *);
70 extern wchar_t	*wcscat(wchar_t *, const wchar_t *);
71 extern wchar_t	*wcschr(const wchar_t *, wchar_t);
72 extern int      wcscmp(const wchar_t *ws1, const wchar_t *ws2);
73 extern int      wcscoll(const wchar_t *ws1, const wchar_t *ws2);
74 extern wchar_t	*wcscpy(wchar_t *, const wchar_t *);
75 extern size_t	wcscspn(const wchar_t *, const wchar_t *);
76 extern size_t	wcsftime(wchar_t *, size_t, const wchar_t *,
77 					const struct tm *);
78 extern size_t	wcslen(const wchar_t *);
79 extern wchar_t 	*wcsncat(wchar_t *, const wchar_t *, size_t);
80 extern int		wcsncmp(const wchar_t *, const wchar_t *, size_t);
81 extern wchar_t	*wcsncpy(wchar_t *, const wchar_t *, size_t);
82 extern wchar_t	*wcspbrk(const wchar_t *, const wchar_t *);
83 extern wchar_t	*wcsrchr(const wchar_t *, wchar_t);
84 extern size_t   wcsrtombs(char *dst, const wchar_t **src, size_t len,
85 					mbstate_t *ps);
86 extern size_t	wcsspn(const wchar_t *, const wchar_t *);
87 extern double	wcstod(const wchar_t *, wchar_t **);
88 extern wchar_t	*wcstok(wchar_t *, const wchar_t *, wchar_t **);
89 extern long int	wcstol(const wchar_t *, wchar_t **, int);
90 extern unsigned long int	wcstoul(const wchar_t *, wchar_t **, int);
91 extern wchar_t	*wcswcs(const wchar_t *, const wchar_t *);
92 extern int		wcswidth(const wchar_t *, size_t);
93 extern size_t	wcsxfrm(wchar_t *, const wchar_t *, size_t);
94 extern wctype_t	wctype(const char *);
95 extern int		wcwidth(wchar_t);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #define WEOF ((wint_t)(-1))
102 
103 #endif /* _WCHAR_H */
104