blob: d2d022a708acaef8816183481b9f52a9d620b8e5 [file] [log] [blame]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07001/*
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#include <stddef.h>
34#include <stdarg.h>
35#include <time.h>
36#include <malloc.h>
37
38/* IMPORTANT: Any code that relies on wide character support is essentially
39 * non-portable and/or broken. the only reason this header exist
40 * is because I'm really a nice guy. However, I'm not nice enough
41 * to provide you with a real implementation. instead wchar_t == char
42 * and all wc functions are stubs to their "normal" equivalent...
43 */
44
45__BEGIN_DECLS
46
The Android Open Source Project4e468ed2008-12-17 18:03:48 -080047#ifndef __cplusplus
48/* wchar_t is a builtin keyword of g++ */
49typedef unsigned char wchar_t;
50#endif
51
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070052typedef int wint_t;
53typedef struct { int dummy; } mbstate_t;
54
55typedef enum {
56 WC_TYPE_INVALID = 0,
57 WC_TYPE_ALNUM,
58 WC_TYPE_ALPHA,
59 WC_TYPE_BLANK,
60 WC_TYPE_CNTRL,
61 WC_TYPE_DIGIT,
62 WC_TYPE_GRAPH,
63 WC_TYPE_LOWER,
64 WC_TYPE_PRINT,
65 WC_TYPE_PUNCT,
66 WC_TYPE_SPACE,
67 WC_TYPE_UPPER,
68 WC_TYPE_XDIGIT,
69 WC_TYPE_MAX
70} wctype_t;
71
72#define WCHAR_MAX 255
73#define WCHAR_MIN 0
74#define WEOF (-1)
75
76extern wint_t btowc(int);
77extern int fwprintf(FILE *, const wchar_t *, ...);
78extern int fwscanf(FILE *, const wchar_t *, ...);
79extern int iswalnum(wint_t);
80extern int iswalpha(wint_t);
81extern int iswcntrl(wint_t);
82extern int iswdigit(wint_t);
83extern int iswgraph(wint_t);
84extern int iswlower(wint_t);
85extern int iswprint(wint_t);
86extern int iswpunct(wint_t);
87extern int iswspace(wint_t);
88extern int iswupper(wint_t);
89extern int iswxdigit(wint_t);
90extern int iswctype(wint_t, wctype_t);
91extern wint_t fgetwc(FILE *);
92extern wchar_t *fgetws(wchar_t *, int, FILE *);
93extern wint_t fputwc(wchar_t, FILE *);
94extern int fputws(const wchar_t *, FILE *);
95extern int fwide(FILE *, int);
96extern wint_t getwc(FILE *);
97extern wint_t getwchar(void);
98extern int mbsinit(const mbstate_t *);
99extern size_t mbrlen(const char *, size_t, mbstate_t *);
100extern size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
101extern size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
102extern wint_t putwc(wchar_t, FILE *);
103extern wint_t putwchar(wchar_t);
104extern int swprintf(wchar_t *, size_t, const wchar_t *, ...);
105extern int swscanf(const wchar_t *, const wchar_t *, ...);
106extern wint_t towlower(wint_t);
107extern wint_t towupper(wint_t);
108extern wint_t ungetwc(wint_t, FILE *);
109extern int vfwprintf(FILE *, const wchar_t *, va_list);
110extern int vwprintf(const wchar_t *, va_list);
111extern int vswprintf(wchar_t *, size_t, const wchar_t *, va_list);
112extern size_t wcrtomb(char *, wchar_t, mbstate_t *);
113extern wchar_t *wcscat(wchar_t *, const wchar_t *);
114extern wchar_t *wcschr(const wchar_t *, wchar_t);
115extern int wcscmp(const wchar_t *, const wchar_t *);
116extern int wcscoll(const wchar_t *, const wchar_t *);
117extern wchar_t *wcscpy(wchar_t *, const wchar_t *);
118extern size_t wcscspn(const wchar_t *, const wchar_t *);
119extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
120extern size_t wcslen(const wchar_t *);
121extern wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t);
122extern int wcsncmp(const wchar_t *, const wchar_t *, size_t);
123extern wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
124extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
125extern wchar_t *wcsrchr(const wchar_t *, wchar_t);
126extern size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
127extern size_t wcsspn(const wchar_t *, const wchar_t *);
128extern wchar_t *wcsstr(const wchar_t *, const wchar_t *);
129extern double wcstod(const wchar_t *, wchar_t **);
130extern wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **);
131extern long int wcstol(const wchar_t *, wchar_t **, int);
132extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int);
133extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
134extern int wcswidth(const wchar_t *, size_t);
135extern size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
136extern int wctob(wint_t);
137extern wctype_t wctype(const char *);
138extern int wcwidth(wchar_t);
139extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
140extern int wmemcmp(const wchar_t *, const wchar_t *, size_t);
141extern wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t);
142extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
143extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
144extern int wprintf(const wchar_t *, ...);
145extern int wscanf(const wchar_t *, ...);
146
147__END_DECLS
148
149#endif /* _WCHAR_H_ */