Home | History | Annotate | Download | only in current
      1 /*
      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 
     34 #include <stdarg.h>
     35 #include <stddef.h>
     36 #include <time.h>
     37 #include <xlocale.h>
     38 
     39 #include <bits/mbstate_t.h>
     40 #include <bits/wchar_limits.h>
     41 #include <bits/wctype.h>
     42 
     43 __BEGIN_DECLS
     44 
     45 enum {
     46     WC_TYPE_INVALID = 0,
     47     WC_TYPE_ALNUM,
     48     WC_TYPE_ALPHA,
     49     WC_TYPE_BLANK,
     50     WC_TYPE_CNTRL,
     51     WC_TYPE_DIGIT,
     52     WC_TYPE_GRAPH,
     53     WC_TYPE_LOWER,
     54     WC_TYPE_PRINT,
     55     WC_TYPE_PUNCT,
     56     WC_TYPE_SPACE,
     57     WC_TYPE_UPPER,
     58     WC_TYPE_XDIGIT,
     59     WC_TYPE_MAX
     60 };
     61 
     62 wint_t            btowc(int);
     63 int               fwprintf(FILE *, const wchar_t *, ...);
     64 int               fwscanf(FILE *, const wchar_t *, ...);
     65 wint_t            fgetwc(FILE *);
     66 wchar_t          *fgetws(wchar_t *, int, FILE *);
     67 wint_t            fputwc(wchar_t, FILE *);
     68 int               fputws(const wchar_t *, FILE *);
     69 int               fwide(FILE *, int);
     70 wint_t            getwc(FILE *);
     71 wint_t            getwchar(void);
     72 int               mbsinit(const mbstate_t *);
     73 size_t            mbrlen(const char *, size_t, mbstate_t *);
     74 size_t            mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
     75 size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
     76 size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*) __INTRODUCED_IN(21);
     77 wint_t            putwc(wchar_t, FILE *);
     78 wint_t            putwchar(wchar_t);
     79 int               swprintf(wchar_t *, size_t, const wchar_t *, ...);
     80 int               swscanf(const wchar_t *, const wchar_t *, ...);
     81 wint_t            ungetwc(wint_t, FILE *);
     82 int vfwprintf(FILE*, const wchar_t*, va_list);
     83 int vfwscanf(FILE*, const wchar_t*, va_list) __INTRODUCED_IN(21);
     84 int vswprintf(wchar_t*, size_t, const wchar_t*, va_list);
     85 int vswscanf(const wchar_t*, const wchar_t*, va_list) __INTRODUCED_IN(21);
     86 int vwprintf(const wchar_t*, va_list);
     87 int vwscanf(const wchar_t*, va_list) __INTRODUCED_IN(21);
     88 wchar_t* wcpcpy (wchar_t*, const wchar_t *);
     89 wchar_t* wcpncpy (wchar_t*, const wchar_t *, size_t);
     90 size_t            wcrtomb(char *, wchar_t, mbstate_t *);
     91 int               wcscasecmp(const wchar_t *, const wchar_t *);
     92 int wcscasecmp_l(const wchar_t*, const wchar_t*, locale_t) __INTRODUCED_IN(23);
     93 wchar_t          *wcscat(wchar_t *, const wchar_t *);
     94 wchar_t          *wcschr(const wchar_t *, wchar_t);
     95 int               wcscmp(const wchar_t *, const wchar_t *);
     96 int               wcscoll(const wchar_t *, const wchar_t *);
     97 wchar_t          *wcscpy(wchar_t *, const wchar_t *);
     98 size_t            wcscspn(const wchar_t *, const wchar_t *);
     99 size_t            wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
    100 size_t            wcslen(const wchar_t *);
    101 int               wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
    102 int wcsncasecmp_l(const wchar_t*, const wchar_t*, size_t, locale_t) __INTRODUCED_IN(23);
    103 wchar_t          *wcsncat(wchar_t *, const wchar_t *, size_t);
    104 int               wcsncmp(const wchar_t *, const wchar_t *, size_t);
    105 wchar_t          *wcsncpy(wchar_t *, const wchar_t *, size_t);
    106 size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*) __INTRODUCED_IN(21);
    107 wchar_t          *wcspbrk(const wchar_t *, const wchar_t *);
    108 wchar_t          *wcsrchr(const wchar_t *, wchar_t);
    109 size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
    110 size_t            wcsspn(const wchar_t *, const wchar_t *);
    111 wchar_t          *wcsstr(const wchar_t *, const wchar_t *);
    112 double wcstod(const wchar_t*, wchar_t**);
    113 float wcstof(const wchar_t*, wchar_t**) __INTRODUCED_IN(21);
    114 wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
    115 long wcstol(const wchar_t*, wchar_t**, int);
    116 long long wcstoll(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
    117 long double wcstold(const wchar_t*, wchar_t**) __INTRODUCED_IN(21);
    118 unsigned long wcstoul(const wchar_t*, wchar_t**, int);
    119 unsigned long long wcstoull(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
    120 int               wcswidth(const wchar_t *, size_t);
    121 size_t            wcsxfrm(wchar_t *, const wchar_t *, size_t);
    122 int               wctob(wint_t);
    123 int               wcwidth(wchar_t);
    124 wchar_t          *wmemchr(const wchar_t *, wchar_t, size_t);
    125 int               wmemcmp(const wchar_t *, const wchar_t *, size_t);
    126 wchar_t          *wmemcpy(wchar_t *, const wchar_t *, size_t);
    127 #if defined(__USE_GNU)
    128 wchar_t* wmempcpy(wchar_t*, const wchar_t*, size_t) __INTRODUCED_IN(23);
    129 #endif
    130 wchar_t          *wmemmove(wchar_t *, const wchar_t *, size_t);
    131 wchar_t          *wmemset(wchar_t *, wchar_t, size_t);
    132 int               wprintf(const wchar_t *, ...);
    133 int               wscanf(const wchar_t *, ...);
    134 
    135 #if __ANDROID_API__ >= __ANDROID_API_L__
    136 long long wcstoll_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
    137 unsigned long long wcstoull_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
    138 long double wcstold_l(const wchar_t*, wchar_t**, locale_t) __INTRODUCED_IN(21);
    139 
    140 int wcscoll_l(const wchar_t* _Nonnull, const wchar_t* _Nonnull, locale_t) __attribute_pure__
    141     __INTRODUCED_IN(21);
    142 size_t wcsxfrm_l(wchar_t*, const wchar_t* _Nonnull, size_t, locale_t) __INTRODUCED_IN(21);
    143 #else
    144 // Implemented as static inlines before 21.
    145 #endif
    146 
    147 size_t wcslcat(wchar_t*, const wchar_t*, size_t);
    148 size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
    149 
    150 FILE* open_wmemstream(wchar_t**, size_t*) __INTRODUCED_IN(23);
    151 wchar_t* wcsdup(const wchar_t*);
    152 size_t wcsnlen(const wchar_t*, size_t);
    153 
    154 __END_DECLS
    155 
    156 #endif /* _WCHAR_H_ */
    157