xref: /haiku/headers/posix/wchar.h (revision b93201281504cee31f4186f7c6548815940c576e)
1e48a877cSbeveloper /*
2e48a877cSbeveloper  * Copyright (C) 2002 Marcus Overhagen
3e48a877cSbeveloper  * All rights reserved.
4e48a877cSbeveloper  *
5e48a877cSbeveloper  * Distributed under the terms of the MIT license
6e48a877cSbeveloper  */
70cb1c46aSshatty #ifndef _WCHAR_H
80cb1c46aSshatty #define _WCHAR_H
9e48a877cSbeveloper 
10404a0feaSIngo Weinhold #include <stddef.h>
11e589b330SAxel Dörfler #include <stdio.h>
120cb1c46aSshatty 
13*b9320128SIngo Weinhold /* stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does.
14*b9320128SIngo Weinhold  * In all other cases we will do that. */
15404a0feaSIngo Weinhold #ifndef _WINT_T
16abd010bcSJérôme Duval #define _WINT_T
17404a0feaSIngo Weinhold 
18404a0feaSIngo Weinhold #ifndef __WINT_TYPE__
19404a0feaSIngo Weinhold #define __WINT_TYPE__ unsigned int
20404a0feaSIngo Weinhold #endif
21404a0feaSIngo Weinhold 
22404a0feaSIngo Weinhold typedef __WINT_TYPE__ wint_t;
23404a0feaSIngo Weinhold 
24*b9320128SIngo Weinhold #endif	/* _WINT_T */
25404a0feaSIngo Weinhold 
26a34963f3SJérôme Duval typedef int wctype_t;
27abd010bcSJérôme Duval 
28abd010bcSJérôme Duval typedef struct {
29abd010bcSJérôme Duval 	int		__count;
30abd010bcSJérôme Duval 	wint_t	__value;
31abd010bcSJérôme Duval } mbstate_t;
32abd010bcSJérôme Duval 
330cb1c46aSshatty 
3430589be5SIngo Weinhold #ifdef __cplusplus
3530589be5SIngo Weinhold extern "C" {
3630589be5SIngo Weinhold #endif
3730589be5SIngo Weinhold 
38a34963f3SJérôme Duval extern wint_t	fgetwc(FILE *);
39a34963f3SJérôme Duval extern wchar_t	*fgetws(wchar_t *, int, FILE *);
40a34963f3SJérôme Duval extern wint_t	fputwc(wchar_t, FILE *);
41a34963f3SJérôme Duval extern int		fputws(const wchar_t *, FILE *);
42a34963f3SJérôme Duval extern wint_t	getwc(FILE *);
43a34963f3SJérôme Duval extern wint_t	getwchar(void);
44a34963f3SJérôme Duval 
45a34963f3SJérôme Duval extern int	iswalnum(wint_t);
46a34963f3SJérôme Duval extern int	iswalpha(wint_t);
47a34963f3SJérôme Duval extern int	iswcntrl(wint_t);
48a34963f3SJérôme Duval extern int	iswdigit(wint_t);
49a34963f3SJérôme Duval extern int	iswgraph(wint_t);
50a34963f3SJérôme Duval extern int	iswlower(wint_t);
51a34963f3SJérôme Duval extern int	iswprint(wint_t);
52a34963f3SJérôme Duval extern int	iswpunct(wint_t);
53a34963f3SJérôme Duval extern int	iswspace(wint_t);
54a34963f3SJérôme Duval extern int	iswupper(wint_t);
55a34963f3SJérôme Duval extern int	iswxdigit(wint_t);
56a34963f3SJérôme Duval extern int 	iswctype(wint_t, wctype_t);
57a34963f3SJérôme Duval 
58a34963f3SJérôme Duval extern wint_t	putwc(wchar_t, FILE *);
59a34963f3SJérôme Duval extern wint_t	putwchar(wchar_t);
60a34963f3SJérôme Duval 
61a34963f3SJérôme Duval extern size_t 	mbrlen(const char *s, size_t n, mbstate_t *ps);
62a34963f3SJérôme Duval extern size_t 	mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
63a34963f3SJérôme Duval extern size_t	mbsrtowcs(wchar_t *dst, const char **src, size_t len,
64e0f9a4e8SJérôme Duval 					mbstate_t *ps);
65a34963f3SJérôme Duval extern int		mbsinit(const mbstate_t *);
66a34963f3SJérôme Duval 
67a34963f3SJérôme Duval extern wint_t	towlower(wint_t);
68a34963f3SJérôme Duval extern wint_t	towupper(wint_t);
69a34963f3SJérôme Duval extern wint_t	ungetwc(wint_t, FILE *);
70a34963f3SJérôme Duval 
71a34963f3SJérôme Duval extern size_t   wcrtomb(char *, wchar_t, mbstate_t *);
72a34963f3SJérôme Duval extern wchar_t	*wcscat(wchar_t *, const wchar_t *);
73a34963f3SJérôme Duval extern wchar_t	*wcschr(const wchar_t *, wchar_t);
74a34963f3SJérôme Duval extern int      wcscmp(const wchar_t *ws1, const wchar_t *ws2);
75a34963f3SJérôme Duval extern int      wcscoll(const wchar_t *ws1, const wchar_t *ws2);
76a34963f3SJérôme Duval extern wchar_t	*wcscpy(wchar_t *, const wchar_t *);
77a34963f3SJérôme Duval extern size_t	wcscspn(const wchar_t *, const wchar_t *);
78a34963f3SJérôme Duval extern size_t	wcsftime(wchar_t *, size_t, const wchar_t *,
79a34963f3SJérôme Duval 					const struct tm *);
80a34963f3SJérôme Duval extern size_t	wcslen(const wchar_t *);
81a34963f3SJérôme Duval extern wchar_t 	*wcsncat(wchar_t *, const wchar_t *, size_t);
82a34963f3SJérôme Duval extern int		wcsncmp(const wchar_t *, const wchar_t *, size_t);
83a34963f3SJérôme Duval extern wchar_t	*wcsncpy(wchar_t *, const wchar_t *, size_t);
84a34963f3SJérôme Duval extern wchar_t	*wcspbrk(const wchar_t *, const wchar_t *);
85a34963f3SJérôme Duval extern wchar_t	*wcsrchr(const wchar_t *, wchar_t);
86a34963f3SJérôme Duval extern size_t   wcsrtombs(char *dst, const wchar_t **src, size_t len,
87e0f9a4e8SJérôme Duval 					mbstate_t *ps);
88a34963f3SJérôme Duval extern size_t	wcsspn(const wchar_t *, const wchar_t *);
89a34963f3SJérôme Duval extern double	wcstod(const wchar_t *, wchar_t **);
90a34963f3SJérôme Duval extern wchar_t	*wcstok(wchar_t *, const wchar_t *, wchar_t **);
91a34963f3SJérôme Duval extern long int	wcstol(const wchar_t *, wchar_t **, int);
92a34963f3SJérôme Duval extern unsigned long int	wcstoul(const wchar_t *, wchar_t **, int);
93a34963f3SJérôme Duval extern wchar_t	*wcswcs(const wchar_t *, const wchar_t *);
94a34963f3SJérôme Duval extern int		wcswidth(const wchar_t *, size_t);
95a34963f3SJérôme Duval extern size_t	wcsxfrm(wchar_t *, const wchar_t *, size_t);
96a34963f3SJérôme Duval extern wctype_t	wctype(const char *);
97a34963f3SJérôme Duval extern int		wcwidth(wchar_t);
98e0f9a4e8SJérôme Duval 
9930589be5SIngo Weinhold #ifdef __cplusplus
10030589be5SIngo Weinhold }
10130589be5SIngo Weinhold #endif
10230589be5SIngo Weinhold 
103e0f9a4e8SJérôme Duval #define WEOF ((wint_t)(-1))
1040cb1c46aSshatty 
1050cb1c46aSshatty #endif /* _WCHAR_H */
106