blob: 04818b9530ed456dd426efb3646b014d09463542 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28#ifndef _WCHAR_H_
29#define _WCHAR_H_
30
31#include <sys/cdefs.h>
32#include <stdio.h>
33
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034#include <stdarg.h>
Elliott Hughes0cc0d252012-10-01 15:12:40 -070035#include <stddef.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080036#include <time.h>
37#include <malloc.h>
38
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039__BEGIN_DECLS
40
Sergey Melnikova437bff2012-11-21 19:42:19 +040041typedef __WINT_TYPE__ wint_t;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080042typedef struct { int dummy; } mbstate_t;
43
44typedef enum {
45 WC_TYPE_INVALID = 0,
46 WC_TYPE_ALNUM,
47 WC_TYPE_ALPHA,
48 WC_TYPE_BLANK,
49 WC_TYPE_CNTRL,
50 WC_TYPE_DIGIT,
51 WC_TYPE_GRAPH,
52 WC_TYPE_LOWER,
53 WC_TYPE_PRINT,
54 WC_TYPE_PUNCT,
55 WC_TYPE_SPACE,
56 WC_TYPE_UPPER,
57 WC_TYPE_XDIGIT,
58 WC_TYPE_MAX
59} wctype_t;
60
Elliott Hughes7c895062013-06-13 16:02:53 -070061#ifndef WCHAR_MAX
David 'Digit' Turner3527fd62010-06-14 17:18:35 -070062#define WCHAR_MAX INT_MAX
63#define WCHAR_MIN INT_MIN
Elliott Hughes7c895062013-06-13 16:02:53 -070064#endif
65
David 'Digit' Turner50ace4f2010-06-16 16:36:41 -070066#define WEOF ((wint_t)(-1))
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080067
68extern wint_t btowc(int);
69extern int fwprintf(FILE *, const wchar_t *, ...);
70extern int fwscanf(FILE *, const wchar_t *, ...);
71extern int iswalnum(wint_t);
72extern int iswalpha(wint_t);
Elliott Hughes40b05792014-04-15 12:04:05 -070073extern int iswblank(wint_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080074extern int iswcntrl(wint_t);
75extern int iswdigit(wint_t);
76extern int iswgraph(wint_t);
77extern int iswlower(wint_t);
78extern int iswprint(wint_t);
79extern int iswpunct(wint_t);
80extern int iswspace(wint_t);
81extern int iswupper(wint_t);
82extern int iswxdigit(wint_t);
83extern int iswctype(wint_t, wctype_t);
84extern wint_t fgetwc(FILE *);
85extern wchar_t *fgetws(wchar_t *, int, FILE *);
86extern wint_t fputwc(wchar_t, FILE *);
87extern int fputws(const wchar_t *, FILE *);
88extern int fwide(FILE *, int);
89extern wint_t getwc(FILE *);
90extern wint_t getwchar(void);
91extern int mbsinit(const mbstate_t *);
92extern size_t mbrlen(const char *, size_t, mbstate_t *);
93extern size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
94extern size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
Dan Bornstein03c643b2009-11-10 12:15:33 -080095extern size_t mbstowcs(wchar_t *, const char *, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080096extern wint_t putwc(wchar_t, FILE *);
97extern wint_t putwchar(wchar_t);
98extern int swprintf(wchar_t *, size_t, const wchar_t *, ...);
99extern int swscanf(const wchar_t *, const wchar_t *, ...);
100extern wint_t towlower(wint_t);
101extern wint_t towupper(wint_t);
102extern wint_t ungetwc(wint_t, FILE *);
103extern int vfwprintf(FILE *, const wchar_t *, va_list);
104extern int vwprintf(const wchar_t *, va_list);
105extern int vswprintf(wchar_t *, size_t, const wchar_t *, va_list);
106extern size_t wcrtomb(char *, wchar_t, mbstate_t *);
tedbo16e02c22010-11-29 13:15:07 -0800107extern int wcscasecmp(const wchar_t *, const wchar_t *);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800108extern wchar_t *wcscat(wchar_t *, const wchar_t *);
109extern wchar_t *wcschr(const wchar_t *, wchar_t);
110extern int wcscmp(const wchar_t *, const wchar_t *);
111extern int wcscoll(const wchar_t *, const wchar_t *);
112extern wchar_t *wcscpy(wchar_t *, const wchar_t *);
113extern size_t wcscspn(const wchar_t *, const wchar_t *);
114extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
115extern size_t wcslen(const wchar_t *);
tedbo16e02c22010-11-29 13:15:07 -0800116extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800117extern wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t);
118extern int wcsncmp(const wchar_t *, const wchar_t *, size_t);
119extern wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
120extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
121extern wchar_t *wcsrchr(const wchar_t *, wchar_t);
122extern size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
123extern size_t wcsspn(const wchar_t *, const wchar_t *);
124extern wchar_t *wcsstr(const wchar_t *, const wchar_t *);
125extern double wcstod(const wchar_t *, wchar_t **);
126extern wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **);
127extern long int wcstol(const wchar_t *, wchar_t **, int);
Dan Bornstein03c643b2009-11-10 12:15:33 -0800128extern size_t wcstombs(char *, const wchar_t *, size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800129extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int);
130extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
131extern int wcswidth(const wchar_t *, size_t);
132extern size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
133extern int wctob(wint_t);
134extern wctype_t wctype(const char *);
135extern int wcwidth(wchar_t);
136extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
137extern int wmemcmp(const wchar_t *, const wchar_t *, size_t);
138extern wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t);
139extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
140extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
141extern int wprintf(const wchar_t *, ...);
142extern int wscanf(const wchar_t *, ...);
143
Elliott Hughes53e43292014-02-24 18:00:43 -0800144extern size_t wcslcat(wchar_t*, const wchar_t*, size_t);
145extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
146
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800147typedef void *wctrans_t;
Elliott Hughes77e944f2014-04-04 17:34:51 -0700148extern wint_t towctrans(wint_t, wctrans_t);
149extern wctrans_t wctrans(const char*);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800150
Elliott Hughes77e944f2014-04-04 17:34:51 -0700151#if __POSIX_VISIBLE >= 200809
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800152wchar_t* wcsdup(const wchar_t*);
153size_t wcsnlen(const wchar_t*, size_t);
154#endif
155
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800156__END_DECLS
157
158#endif /* _WCHAR_H_ */