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