BTRFS: Reimplement TreeIterator, add some error checks and remove redundancies.
[haiku.git] / headers / posix / wchar.h
bloba2a82d45475336be6724f106aa4c1cc9c16923d3
1 /*
2 * Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _WCHAR_H
6 #define _WCHAR_H
9 #include <limits.h>
10 #include <stddef.h>
11 #include <stdio.h>
12 #include <time.h>
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. */
17 #ifndef _WINT_T
18 #define _WINT_T
20 #ifndef __WINT_TYPE__
21 #define __WINT_TYPE__ unsigned int
22 #endif
24 typedef __WINT_TYPE__ wint_t;
26 #endif /* _WINT_T */
28 typedef int wctype_t;
30 typedef struct {
31 void* converter;
32 char charset[64];
33 unsigned int count;
34 char data[1024 + 8]; /* 1024 bytes for data, 8 for alignment space */
35 } mbstate_t;
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().
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
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,
67 mbstate_t *mbState);
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,
72 mbstate_t *mbState);
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,
88 va_list arg);
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);
98 #ifdef _GNU_SOURCE
99 extern wchar_t *wcschrnul(const wchar_t *wcs, wchar_t wc);
100 #endif
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,
112 size_t maxLength);
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,
115 size_t length);
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,
123 mbstate_t *mbState);
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,
133 int base);
134 extern unsigned long long wcstoull(const wchar_t *wcs, wchar_t **endPtr,
135 int base);
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);
145 #ifdef _GNU_SOURCE
146 extern wchar_t *wmempcpy(wchar_t *dest, const wchar_t *src, size_t n);
147 #endif
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, ...);
153 #ifdef __cplusplus
155 #endif
157 #endif /* _WCHAR_H */