2009-03-04 04:28:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#ifndef _WCHAR_H_
|
|
|
|
#define _WCHAR_H_
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2012-10-02 00:12:40 +02:00
|
|
|
#include <stddef.h>
|
2009-03-04 04:28:35 +01:00
|
|
|
#include <time.h>
|
2014-04-22 03:09:46 +02:00
|
|
|
|
|
|
|
#include <machine/wchar_limits.h>
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2014-04-29 16:48:34 +02:00
|
|
|
typedef __WINT_TYPE__ wint_t;
|
|
|
|
typedef struct {
|
2014-05-08 15:38:35 +02:00
|
|
|
uint8_t __seq[4];
|
|
|
|
#ifdef __LP64__
|
|
|
|
char __reserved[4];
|
2014-04-29 16:48:34 +02:00
|
|
|
#endif
|
|
|
|
} mbstate_t;
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-05-13 13:47:27 +02:00
|
|
|
enum {
|
2009-03-04 04:28:35 +01:00
|
|
|
WC_TYPE_INVALID = 0,
|
|
|
|
WC_TYPE_ALNUM,
|
|
|
|
WC_TYPE_ALPHA,
|
|
|
|
WC_TYPE_BLANK,
|
|
|
|
WC_TYPE_CNTRL,
|
|
|
|
WC_TYPE_DIGIT,
|
|
|
|
WC_TYPE_GRAPH,
|
|
|
|
WC_TYPE_LOWER,
|
|
|
|
WC_TYPE_PRINT,
|
|
|
|
WC_TYPE_PUNCT,
|
|
|
|
WC_TYPE_SPACE,
|
|
|
|
WC_TYPE_UPPER,
|
|
|
|
WC_TYPE_XDIGIT,
|
|
|
|
WC_TYPE_MAX
|
2014-05-13 13:47:27 +02:00
|
|
|
};
|
|
|
|
|
2014-05-13 14:11:27 +02:00
|
|
|
typedef long wctype_t;
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-06-17 01:36:41 +02:00
|
|
|
#define WEOF ((wint_t)(-1))
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
extern wint_t btowc(int);
|
|
|
|
extern int fwprintf(FILE *, const wchar_t *, ...);
|
|
|
|
extern int fwscanf(FILE *, const wchar_t *, ...);
|
|
|
|
extern int iswalnum(wint_t);
|
|
|
|
extern int iswalpha(wint_t);
|
2014-04-15 21:04:05 +02:00
|
|
|
extern int iswblank(wint_t);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern int iswcntrl(wint_t);
|
|
|
|
extern int iswdigit(wint_t);
|
|
|
|
extern int iswgraph(wint_t);
|
|
|
|
extern int iswlower(wint_t);
|
|
|
|
extern int iswprint(wint_t);
|
|
|
|
extern int iswpunct(wint_t);
|
|
|
|
extern int iswspace(wint_t);
|
|
|
|
extern int iswupper(wint_t);
|
|
|
|
extern int iswxdigit(wint_t);
|
|
|
|
extern int iswctype(wint_t, wctype_t);
|
|
|
|
extern wint_t fgetwc(FILE *);
|
|
|
|
extern wchar_t *fgetws(wchar_t *, int, FILE *);
|
|
|
|
extern wint_t fputwc(wchar_t, FILE *);
|
|
|
|
extern int fputws(const wchar_t *, FILE *);
|
|
|
|
extern int fwide(FILE *, int);
|
|
|
|
extern wint_t getwc(FILE *);
|
|
|
|
extern wint_t getwchar(void);
|
|
|
|
extern int mbsinit(const mbstate_t *);
|
|
|
|
extern size_t mbrlen(const char *, size_t, mbstate_t *);
|
|
|
|
extern size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
|
2014-04-29 23:46:56 +02:00
|
|
|
extern size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
|
|
|
|
extern size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*);
|
2009-11-10 21:15:33 +01:00
|
|
|
extern size_t mbstowcs(wchar_t *, const char *, size_t);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern wint_t putwc(wchar_t, FILE *);
|
|
|
|
extern wint_t putwchar(wchar_t);
|
|
|
|
extern int swprintf(wchar_t *, size_t, const wchar_t *, ...);
|
|
|
|
extern int swscanf(const wchar_t *, const wchar_t *, ...);
|
|
|
|
extern wint_t towlower(wint_t);
|
|
|
|
extern wint_t towupper(wint_t);
|
|
|
|
extern wint_t ungetwc(wint_t, FILE *);
|
2014-04-30 01:28:56 +02:00
|
|
|
extern int vfwprintf(FILE*, const wchar_t*, va_list);
|
|
|
|
extern int vfwscanf(FILE*, const wchar_t*, va_list);
|
|
|
|
extern int vswprintf(wchar_t*, size_t, const wchar_t*, va_list);
|
|
|
|
extern int vswscanf(const wchar_t*, const wchar_t*, va_list);
|
|
|
|
extern int vwprintf(const wchar_t*, va_list);
|
|
|
|
extern int vwscanf(const wchar_t*, va_list);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern size_t wcrtomb(char *, wchar_t, mbstate_t *);
|
2010-11-29 22:15:07 +01:00
|
|
|
extern int wcscasecmp(const wchar_t *, const wchar_t *);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern wchar_t *wcscat(wchar_t *, const wchar_t *);
|
|
|
|
extern wchar_t *wcschr(const wchar_t *, wchar_t);
|
|
|
|
extern int wcscmp(const wchar_t *, const wchar_t *);
|
|
|
|
extern int wcscoll(const wchar_t *, const wchar_t *);
|
|
|
|
extern wchar_t *wcscpy(wchar_t *, const wchar_t *);
|
|
|
|
extern size_t wcscspn(const wchar_t *, const wchar_t *);
|
|
|
|
extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
|
|
|
|
extern size_t wcslen(const wchar_t *);
|
2010-11-29 22:15:07 +01:00
|
|
|
extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern int wcsncmp(const wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
|
2014-04-29 23:46:56 +02:00
|
|
|
extern size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
|
|
|
|
extern wchar_t *wcsrchr(const wchar_t *, wchar_t);
|
2014-04-29 23:46:56 +02:00
|
|
|
extern size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern size_t wcsspn(const wchar_t *, const wchar_t *);
|
|
|
|
extern wchar_t *wcsstr(const wchar_t *, const wchar_t *);
|
2014-04-29 23:46:56 +02:00
|
|
|
extern double wcstod(const wchar_t*, wchar_t**);
|
|
|
|
extern float wcstof(const wchar_t*, wchar_t**);
|
|
|
|
extern wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
|
|
|
|
extern long wcstol(const wchar_t*, wchar_t**, int);
|
|
|
|
extern long long wcstoll(const wchar_t*, wchar_t**, int);
|
|
|
|
extern long double wcstold(const wchar_t*, wchar_t**);
|
|
|
|
extern unsigned long wcstoul(const wchar_t*, wchar_t**, int);
|
|
|
|
extern unsigned long long wcstoull(const wchar_t*, wchar_t**, int);
|
2009-03-04 04:28:35 +01:00
|
|
|
extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
|
|
|
|
extern int wcswidth(const wchar_t *, size_t);
|
|
|
|
extern size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern int wctob(wint_t);
|
|
|
|
extern wctype_t wctype(const char *);
|
|
|
|
extern int wcwidth(wchar_t);
|
|
|
|
extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
|
|
|
|
extern int wmemcmp(const wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
|
|
|
|
extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
|
|
|
|
extern int wprintf(const wchar_t *, ...);
|
|
|
|
extern int wscanf(const wchar_t *, ...);
|
|
|
|
|
2014-02-25 03:00:43 +01:00
|
|
|
extern size_t wcslcat(wchar_t*, const wchar_t*, size_t);
|
|
|
|
extern size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
typedef void *wctrans_t;
|
2014-04-05 02:34:51 +02:00
|
|
|
extern wint_t towctrans(wint_t, wctrans_t);
|
|
|
|
extern wctrans_t wctrans(const char*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-04-05 02:34:51 +02:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
2013-03-02 03:35:56 +01:00
|
|
|
wchar_t* wcsdup(const wchar_t*);
|
|
|
|
size_t wcsnlen(const wchar_t*, size_t);
|
|
|
|
#endif
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _WCHAR_H_ */
|