brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.0 KiB · a932dd2 Raw
208 lines · c
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10/*11    wchar.h synopsis12 13Macros:14 15    NULL16    WCHAR_MAX17    WCHAR_MIN18    WEOF19 20Types:21 22    mbstate_t23    size_t24    tm25    wint_t26 27int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);28int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);29int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);30int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);31int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);32int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);  // C9933int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);34int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg);  // C9935int vwprintf(const wchar_t* restrict format, va_list arg);36int vwscanf(const wchar_t* restrict format, va_list arg);  // C9937int wprintf(const wchar_t* restrict format, ...);38int wscanf(const wchar_t* restrict format, ...);39wint_t fgetwc(FILE* stream);40wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);41wint_t fputwc(wchar_t c, FILE* stream);42int fputws(const wchar_t* restrict s, FILE* restrict stream);43int fwide(FILE* stream, int mode);44wint_t getwc(FILE* stream);45wint_t getwchar();46wint_t putwc(wchar_t c, FILE* stream);47wint_t putwchar(wchar_t c);48wint_t ungetwc(wint_t c, FILE* stream);49double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);50float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr);         // C9951long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr);  // C9952long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);53long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C9954unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);55unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C9956wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);57wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);58wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);59wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);60int wcscmp(const wchar_t* s1, const wchar_t* s2);61int wcscoll(const wchar_t* s1, const wchar_t* s2);62int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);63size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);64const wchar_t* wcschr(const wchar_t* s, wchar_t c);65      wchar_t* wcschr(      wchar_t* s, wchar_t c);66size_t wcscspn(const wchar_t* s1, const wchar_t* s2);67size_t wcslen(const wchar_t* s);68const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);69      wchar_t* wcspbrk(      wchar_t* s1, const wchar_t* s2);70const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);71      wchar_t* wcsrchr(      wchar_t* s, wchar_t c);72size_t wcsspn(const wchar_t* s1, const wchar_t* s2);73const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);74      wchar_t* wcsstr(      wchar_t* s1, const wchar_t* s2);75wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);76const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);77      wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);78int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);79wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);80wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);81wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);82size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,83                const tm* restrict timeptr);84wint_t btowc(int c);85int wctob(wint_t c);86int mbsinit(const mbstate_t* ps);87size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);88size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);89size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);90size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,91                 mbstate_t* restrict ps);92size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,93                 mbstate_t* restrict ps);94 95*/96 97#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)98#  include <__cxx03/wchar.h>99#else100#  include <__config>101 102#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)103#    pragma GCC system_header104#  endif105 106// We define this here to support older versions of glibc <wchar.h> that do107// not define this for clang.108#  if defined(__cplusplus) && !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)109#    define __CORRECT_ISO_CPP_WCHAR_H_PROTO110#  endif111 112// The inclusion of the system's <wchar.h> is intentionally done once outside of any include113// guards because some code expects to be able to include the underlying system header multiple114// times to get different definitions based on the macros that are set before inclusion.115#  if __has_include_next(<wchar.h>)116#    include_next <wchar.h>117#  endif118 119#  ifndef _LIBCPP_WCHAR_H120#    define _LIBCPP_WCHAR_H121 122#    include <__mbstate_t.h> // provide mbstate_t123#    include <stddef.h>      // provide size_t124 125// Determine whether we have const-correct overloads for wcschr and friends.126#    if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)127#      define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1128#    elif defined(__GLIBC_PREREQ)129#      if __GLIBC_PREREQ(2, 10)130#        define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1131#      endif132#    elif defined(_LIBCPP_MSVCRT)133#      if defined(_CRT_CONST_CORRECT_OVERLOADS)134#        define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1135#      endif136#    endif137 138#    if _LIBCPP_HAS_WIDE_CHARACTERS139#      if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)140extern "C++" {141inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {142  return (wchar_t*)wcschr(__s, __c);143}144inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {145  return __libcpp_wcschr(__s, __c);146}147inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcschr(wchar_t* __s, wchar_t __c) {148  return __libcpp_wcschr(__s, __c);149}150 151inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {152  return (wchar_t*)wcspbrk(__s1, __s2);153}154inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*155wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {156  return __libcpp_wcspbrk(__s1, __s2);157}158inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) {159  return __libcpp_wcspbrk(__s1, __s2);160}161 162inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {163  return (wchar_t*)wcsrchr(__s, __c);164}165inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {166  return __libcpp_wcsrchr(__s, __c);167}168inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsrchr(wchar_t* __s, wchar_t __c) {169  return __libcpp_wcsrchr(__s, __c);170}171 172inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {173  return (wchar_t*)wcsstr(__s1, __s2);174}175inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*176wcsstr(const wchar_t* __s1, const wchar_t* __s2) {177  return __libcpp_wcsstr(__s1, __s2);178}179inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) {180  return __libcpp_wcsstr(__s1, __s2);181}182 183inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {184  return (wchar_t*)wmemchr(__s, __c, __n);185}186inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*187wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {188  return __libcpp_wmemchr(__s, __c, __n);189}190inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wmemchr(wchar_t* __s, wchar_t __c, size_t __n) {191  return __libcpp_wmemchr(__s, __c, __n);192}193}194#      endif195 196#      if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))197extern "C" {198size_t mbsnrtowcs(199    wchar_t* __restrict __dst, const char** __restrict __src, size_t __nmc, size_t __len, mbstate_t* __restrict __ps);200size_t wcsnrtombs(201    char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps);202} // extern "C"203#      endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)204#    endif   // _LIBCPP_HAS_WIDE_CHARACTERS205#  endif     // _LIBCPP_WCHAR_H206 207#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)208