63 #if defined(WCHAR2EXT_MSVC_H) 64 # error "Only one header include, wchar2.h or wchar2ext.h" 70 #if !defined(__SIZEOF_WCHAR_T__) 71 # error "'__SIZEOF_WCHAR_T__' NOT defined, system not supported" 74 #if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) 75 # error "size of 'wchar_t' != '2'; Use gcc key: '-fshort-wchar', or clang key: '-fwchar-type=short' '-fno-signed-wchar'" 79 defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || \ 80 defined(_WIN64) || defined(__WIN64__) || \ 81 defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)) 83 # error "NOT include <wchar2.h>, for WINxx platform! use <wchar2ext.h> and libwchar2ext.* instead" 86 #if !defined(UINTMAX_MAX) 87 typedef unsigned long long int uintmax_t;
89 #if !defined(INTMAX_MAX) 90 typedef long long int intmax_t;
94 #define USED_WCHAR2LIB 1 96 #define __WS(x) __WS_(x) 97 #define __WSTR wchar_t 98 #define __WSTRFREE __attribute__((cleanup(__wsfree))) __WSTR 99 #define __WSTR_FMT "ls" 100 #define __WCHR_FMT "lc" 101 #define __WCSZ(x) ((x->sz + 1) * sizeof(wchar_t)) 105 #define __WS_(x) L##x 106 #define __WEV_(A,B) A ## B 107 #define __WEV(A,B) __WEV_(A,B) 108 #define __WEVFA_(_11, _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N 109 #define __WEVFA(...) __WEVFA_(__VA_ARGS__, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 110 #define wsizeof(x) (unsigned long)(sizeof(x) / sizeof(wchar_t)) 112 #if ((!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) && \ 113 !defined(__STDC_C99) && !defined(__C99_RESTRICT)) 114 # if !defined(restrict) 115 # if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) 116 # define restrict __restrict 117 # elif defined(__SUNPRO_C) 118 # define restrict _Restrict 146 # if defined(_DIRENT_HAVE_D_NAMLEN) 147 unsigned char d_namlen;
190 typedef void (*
split_cb)(
wchar_t*, size_t, long,
void*);
346 double _wcstod(
const wchar_t*,
wchar_t**);
353 float _wcstof(
const wchar_t*,
wchar_t**);
360 long double _wcstold(
const wchar_t*,
wchar_t**);
367 long int _wcstol(
const wchar_t*,
wchar_t**,
int);
374 long long int _wcstoll(
const wchar_t*,
wchar_t**,
int);
381 unsigned long int _wcstoul(
const wchar_t*,
wchar_t**,
int);
388 unsigned long long int _wcstoull(
const wchar_t*,
wchar_t**,
int);
395 intmax_t
_wcstoimax(
const wchar_t*,
wchar_t**,
int);
402 uintmax_t
_wcstoumax(
const wchar_t*,
wchar_t**,
int);
414 size_t _wcstombs(
char *restrict,
const wchar_t *restrict,
size_t);
421 size_t _wcstombs_s(
char *restrict,
const wchar_t *restrict,
size_t);
428 size_t _wcsrtombs(
char *restrict,
const wchar_t **restrict,
size_t, mbstate_t *restrict);
435 size_t _wcrtomb(
char *restrict,
wchar_t, mbstate_t *restrict);
442 size_t _mbstowcs(
wchar_t *restrict,
const char *restrict,
size_t);
449 size_t _mbsrtowcs(
wchar_t *restrict,
const char **restrict,
size_t, mbstate_t *restrict);
456 size_t _wcsnrtombs(
char *restrict,
const wchar_t **restrict,
size_t,
size_t, mbstate_t *restrict);
463 size_t _mbsnrtowcs(
wchar_t *restrict,
const char **restrict,
size_t,
size_t, mbstate_t *restrict);
470 size_t _mbrtowc(
wchar_t *restrict,
const char *restrict src,
size_t, mbstate_t *restrict);
477 size_t _mbrlen(
const char *restrict,
size_t, mbstate_t *restrict);
484 int _mblen(
const char*,
size_t);
498 int _mbtowc(
wchar_t *restrict,
const char *restrict,
size_t);
542 int wcstocscmp(
const char*,
wchar_t*,
size_t);
563 wchar_t *
wcsregexp(
wchar_t *restrict,
wchar_t *restrict,
int*);
573 size_t u8stowcs(
wchar_t*,
const char*);
583 size_t wcstou8s(
char*,
const wchar_t*);
598 wchar_t *
_wcpcpy(
wchar_t*,
const wchar_t*);
605 wchar_t *
_wcpncpy(
wchar_t*,
const wchar_t*,
size_t);
612 wchar_t *
_wcscat(
wchar_t*,
const wchar_t*);
619 wchar_t *
_wcsncat(
wchar_t*,
const wchar_t*,
size_t);
626 wchar_t *
_wcsncpy(
wchar_t*,
const wchar_t*,
size_t);
633 wchar_t *
_wcspbrk(
const wchar_t*,
const wchar_t*);
640 wchar_t *
_wcschr(
const wchar_t*,
wchar_t);
647 wchar_t *
_wcsrchr(
const wchar_t*,
wchar_t);
654 wchar_t *
_wcsstr(
const wchar_t*,
const wchar_t*);
661 wchar_t *
_wcstok(
wchar_t*,
const wchar_t*,
wchar_t**);
668 wchar_t *
_wmemchr(
const wchar_t*,
wchar_t,
size_t);
675 wchar_t *
_wmemcpy(
wchar_t*,
const wchar_t*,
size_t);
682 wchar_t *
_wmemmove(
wchar_t*,
const wchar_t*,
size_t);
689 wchar_t *
_wmemset(
wchar_t*,
wchar_t,
size_t);
692 size_t _wcslcat(
wchar_t*,
const wchar_t*,
size_t);
694 size_t _wcslcpy(
wchar_t*,
const wchar_t*,
size_t);
701 size_t _wcslen(
const wchar_t*);
708 size_t _wcsnlen(
const wchar_t*,
size_t);
717 size_t _wcsspn(
const wchar_t*,
const wchar_t*);
731 int _wcsncasecmp(
const wchar_t*,
const wchar_t*,
size_t);
738 int _wcscmp(
const wchar_t*,
const wchar_t*);
746 int _wcsncmp(
const wchar_t*,
const wchar_t*,
size_t);
753 int _wmemcmp(
const wchar_t*,
const wchar_t*,
size_t);
756 int _vfprintf(FILE *restrict,
const char *restrict, va_list)
757 __attribute__((__nonnull__, __format__(__printf__, 2, 0)));
760 int _vsnprintf(
char *restrict,
size_t,
const char *restrict, va_list)
761 __attribute__((__format__(__printf__, 3, 0)));
764 int _fprintf(FILE *restrict,
const char *restrict, ...)
765 __attribute__((__nonnull__, __format__(__printf__, 2, 0)));
768 int _printf(const
char *restrict fmt, ...)
769 __attribute__((__nonnull__, __format__(__printf__, 1, 0)));
772 int _snprintf(
char *restrict,
size_t, const
char *restrict, ...)
773 __attribute__((__format__(__printf__, 3, 0)));
780 int _vfwprintf(FILE *restrict, const
wchar_t *restrict, va_list)
788 int _vswprintf(
wchar_t *restrict,
size_t, const
wchar_t *restrict, va_list)
796 int _fwprintf(FILE *restrict, const
wchar_t *restrict, ...)
804 int _swprintf(
wchar_t *restrict,
size_t, const
wchar_t *restrict, ...)
817 int _wprintf(const
wchar_t *restrict fmt, ...)
830 int _fputws(const
wchar_t *restrict, FILE *restrict);
842 wchar_t _fputwc(
wchar_t, FILE *restrict);
874 size_t _wcsftime(
wchar_t *restrict,
size_t sz, const
wchar_t *restrict, const
void *restrict);
905 wchar_t *
_wcsptime(const
wchar_t*, const
wchar_t*,
void*);
928 FILE *
_wfopen(const
wchar_t*, const
wchar_t*)
929 __attribute__((warn_unused_result));
943 FILE *
_wfopen_s(const
wchar_t*,
size_t, const
wchar_t*)
944 __attribute__((warn_unused_result));
957 __attribute__((warn_unused_result));
970 __attribute__((warn_unused_result));
984 FILE *
u8wfopen(const
wchar_t*, const
wchar_t*)
985 __attribute__((warn_unused_result));
1013 int _wstat(const
wchar_t*,
void*);
1027 int _wstat_s(const
wchar_t*,
size_t,
void*);
1064 int u8wstat(const
wchar_t*,
void*);
1095 int _wrename(const
wchar_t*, const
wchar_t*);
1109 int _wrename_s(const
wchar_t*,
size_t, const
wchar_t*,
size_t);
1147 int u8wrename(const
wchar_t*, const
wchar_t*);
1247 int _wmkdir(const
wchar_t*, mode_t);
1261 int _wmkdir_s(const
wchar_t*,
size_t, mode_t);
1301 int u8wmkdir(const
wchar_t*, mode_t);
1368 wchar_t *
_wbasedir(const
wchar_t*,
int)
1369 __attribute__((warn_unused_result));
1372 __attribute__((warn_unused_result));
1375 __attribute__((warn_unused_result));
1385 __attribute__((warn_unused_result));
1388 __attribute__((warn_unused_result));
1395 __attribute__((warn_unused_result));
1429 __attribute__((warn_unused_result));
1436 __attribute__((warn_unused_result));
1443 __attribute__((warn_unused_result));
1506 #define wstring_appends(A,...) wstring_appends_(A,__VA_ARGS__,NULL) 1533 size_t wstring_cstows(
wchar_t [],
size_t,
const char *restrict,
size_t);
1543 size_t wstring_wstocs(
char [],
size_t,
const wchar_t *restrict,
size_t);
1571 wchar_t *
wstring_timeformat(
const wchar_t *restrict,
size_t,
const wchar_t *restrict,
const wchar_t *restrict)
1572 __attribute__((warn_unused_result));
1579 __attribute__((warn_unused_result));
1780 #define wreaddir_cb_opt(opt,val) ((opt) | (1L << (val))) 1880 #pragma GCC diagnostic push 1881 #pragma GCC diagnostic ignored "-Wredundant-decls" 1883 #pragma GCC diagnostic pop 1888 static inline void __attribute__((always_inline)) __wsfree(
void *v)
1892 void *x = *(
void**)v;
1910 #if defined(__clang__) 1911 # pragma clang diagnostic ignored "-Wlanguage-extension-token" 1915 #define __wchar_type_id(A) \ 1916 __builtin_types_compatible_p(typeof(A), wchar_t*) * 1 \ 1917 + __builtin_types_compatible_p(typeof(A), const wchar_t*) * 1 \ 1918 + __builtin_types_compatible_p(typeof(A), wchar_t[]) * 1 \ 1919 + __builtin_types_compatible_p(typeof(A), const wchar_t[]) * 1 \ 1920 + __builtin_types_compatible_p(typeof(A), string_ws*) * 2 \ 1921 + __builtin_types_compatible_p(typeof(A), const string_ws*) * 2 \ 1922 + __builtin_types_compatible_p(typeof(A), char*) * 3 \ 1923 + __builtin_types_compatible_p(typeof(A), const char*) * 3 \ 1924 + __builtin_types_compatible_p(typeof(A), char[]) * 3 \ 1925 + __builtin_types_compatible_p(typeof(A), const char[]) * 3 1927 # define EV_FOPEN_ARG_3(_1,_2,_3) _wfopen_selector(4,_1,_3,_2) 1928 # define EV_FOPEN_ARG_2(_1,_2) _wfopen_selector(__wchar_type_id(_1),_1,0,_2) 1929 # define EV_FOPEN_ARG_1(_1) _wfopen_selector(__wchar_type_id(_1),_1,0,(const char*)&"r") 1930 # define EV_FOPEN_ARG_0(...) 1932 # define _wfopen_macro(...) \ 1933 __WEV(EV_FOPEN_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1935 # define EV_MKDIR_ARG_3(_1,_2,_3) _wmkdir_selector(4,_1,_3,_2) 1936 # define EV_MKDIR_ARG_2(_1,_2) _wmkdir_selector(__wchar_type_id(_1),_1,0,_2) 1937 # define EV_MKDIR_ARG_1(_1) _wmkdir_selector(__wchar_type_id(_1),_1,0,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) 1938 # define EV_MKDIR_ARG_0(...) 1940 # define _wmkdir_macro(...) \ 1941 __WEV(EV_MKDIR_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1943 # define EV_REMOVE_ARG_2(_1,_2) _wremove_selector(__wchar_type_id(_1),_1,_2) 1944 # define EV_REMOVE_ARG_1(_1) _wremove_selector(__wchar_type_id(_1),_1,0) 1945 # define EV_REMOVE_ARG_0(...) 1947 # define _wremove_macro(...) \ 1948 __WEV(EV_REMOVE_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1950 # define EV_RENAME_ARG_4(_1,_2,_3,_4) _wrename_selector(4,_1,_2,_3,_4) 1951 # define EV_RENAME_ARG_3(_1,_2,_3) _wrename_selector(__wchar_type_id(_1),_1,0,_2,0) 1952 # define EV_RENAME_ARG_2(_1,_2) _wrename_selector(__wchar_type_id(_1),_1,0,_2,0) 1953 # define EV_RENAME_ARG_1(_1) 1954 # define EV_RENAME_ARG_0(...) 1956 # define _wrename_macro(...) \ 1957 __WEV(EV_RENAME_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1959 # define EV_STAT_ARG_3(_1,_2,_3) _wstat_selector(4,_1,_3,_2) 1960 # define EV_STAT_ARG_2(_1,_2) _wstat_selector(__wchar_type_id(_1),_1,0,_2) 1961 # define EV_STAT_ARG_1(_1) _wstat_selector(__wchar_type_id(_1),_1,0,NULL) 1962 # define EV_STAT_ARG_0(...) 1964 # define _wstat_macro(...) \ 1965 __WEV(EV_STAT_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1967 # define EV_ACCESS_ARG_3(_1,_2,_3) _waccess_selector(4,_1,_3,_2) 1968 # define EV_ACCESS_ARG_2(_1,_2) _waccess_selector(__wchar_type_id(_1),_1,_2,0) 1969 # define EV_ACCESS_ARG_1(_1) _waccess_selector(__wchar_type_id(_1),_1,0,0) 1970 # define EV_ACCESS_ARG_0(...) 1972 # define _waccess_macro(...) \ 1973 __WEV(EV_ACCESS_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1975 # define EV_BNAME_ARG_2(_1,_2) _wbasename_selector(_1,_2) 1976 # define EV_BNAME_ARG_1(_1) _wbasename_selector(__wchar_type_id(_1),_1) 1977 # define EV_BNAME_ARG_0(...) 1979 # define _wbasename_macro(...) \ 1980 __WEV(EV_BNAME_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1982 # define EV_BEXT_ARG_2(_1,_2) _wbaseext_selector(_1,_2) 1983 # define EV_BEXT_ARG_1(_1) _wbaseext_selector(__wchar_type_id(_1),_1) 1984 # define EV_BEXT_ARG_0(...) 1986 # define _wbaseext_macro(...) \ 1987 __WEV(EV_BEXT_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 1989 # define EV_BDIR_ARG_3(_1,_2,_3) _wbasedir_selector(_1,_2,_3) 1990 # define EV_BDIR_ARG_2(_1,_2) _wbasedir_selector(__wchar_type_id(_1),_1,_2) 1991 # define EV_BDIR_ARG_1(_1) _wbasedir_selector(__wchar_type_id(_1),_1, 0) 1992 # define EV_BDIR_ARG_0(...) 1994 # define _wbasedir_macro(...) \ 1995 __WEV(EV_BDIR_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__) 2008 #define wstocscvt(A,B,D) \ 2009 size_t __WEV(sz,__LINE__); errno = 0; \ 2010 if (!(__WEV(sz,__LINE__) = _wcsrtombs(NULL, &(const wchar_t*){B}, 0, 0))) { \ 2011 errno = EILSEQ; return D; \ 2013 char __WEV(A,__LINE__)[(__WEV(sz,__LINE__) + 1)], * A = (char*)&__WEV(A,__LINE__); \ 2014 if ((__WEV(sz,__LINE__) = _wcsrtombs(__WEV(A,__LINE__), &(const wchar_t*){B}, (__WEV(sz,__LINE__) + 1), 0))) { \ 2015 __WEV(A,__LINE__)[(__WEV(sz,__LINE__))] = '\0'; \ 2026 #define wstocsncvt(A,B,C,D) \ 2027 char __WEV(A,__LINE__)[(C + 1 * sizeof(wchar_t))], * A = (char*)&__WEV(A,__LINE__); errno = 0; \ 2028 if (!((C) = _wcsrtombs(__WEV(A,__LINE__), &(const wchar_t*){B}, (C * 2 + 1), 0))) { \ 2029 errno = EILSEQ; return D; \ 2031 __WEV(A,__LINE__)[(C)] = '\0' 2041 #define wstrtocscvt(A,B,D) \ 2042 size_t __WEV(sz,__LINE__); errno = 0; \ 2043 char __WEV(A,__LINE__)[(B->sz + 1 * sizeof(wchar_t))], * A = (char*)&__WEV(A,__LINE__); \ 2044 if (!(__WEV(sz,__LINE__) = _wcsrtombs(__WEV(A,__LINE__), &(const wchar_t*){B->str}, (B->sz * 2 + 1), 0))) { \ 2045 errno = EILSEQ; return D; \ 2047 __WEV(A,__LINE__)[__WEV(sz,__LINE__)] = '\0' 2056 #if defined(vsnprintf) 2060 #if defined(snprintf) 2064 #if defined(vsnprintf) 2068 #if defined(snprintf) 2072 #if defined(WS_FS_REDEFINE) 2073 # define fputc _fputwc 2074 # define fputs _fputws 2075 # if defined(WS_FS_UTF8) 2076 # define mkdir u8wmkdir 2077 # define remove u8wremove 2078 # define rename u8wrename 2079 # define stat u8wstat 2080 # define fopen u8wfopen 2081 # define access u8waccess 2083 # define mkdir _wmkdir_macro 2084 # define remove _wremove_macro 2085 # define rename _wrename_macro 2086 # define stat _wstat_macro 2087 # define access _waccess_macro 2088 # define fopen _wfopen_macro 2089 # define access _waccess_macro 2090 # define basename(A) (__WSTR *) _wbasename_macro(A) 2091 # define dirname(A) (__WSTR *) _wbasedir_macro(A) 2092 # define baseext(A) (__WSTR *) _wbaseext_macro(A) 2098 #define wmkdir _wmkdir_macro 2099 #define wmkdir_w _wmkdir 2100 #define wmkdir_s _wmkdir_s 2101 #define wmkdir_ws _wmkdir_ws 2103 #define wremove _wremove_macro 2104 #define wremove_w _wremove 2105 #define wremove_s _wremove_s 2106 #define wremove_ws _wremove_ws 2108 #define wrename _wrename_macro 2109 #define wrename_w _wrename 2110 #define wrename_s _wrename_s 2111 #define wrename_ws _wrename_ws 2113 #define wstat _wstat_macro 2114 #define wstat_w _wstat 2115 #define wstat_s _wstat_s 2116 #define wstat_ws _wstat_ws 2118 #define wfopen _wfopen_macro 2119 #define wfopen_w _wfopen 2120 #define wfopen_s _wfopen_s 2121 #define wfopen_ws _wfopen_ws 2123 #define waccess _waccess_macro 2124 #define waccess_w _waccess 2125 #define waccess_s _waccess_s 2126 #define waccess_ws _waccess_ws 2128 #define wbasename _wbasename_macro 2129 #define wbasename_w _wbasename 2130 #define wbasename_ws _wbasename_ws 2132 #define wbaseext _wbaseext_macro 2133 #define wbaseext_w _wbaseext 2134 #define wbaseext_ws _wbaseext_ws 2136 #define wbasedir _wbasedir_macro 2137 #define wbasedir_w _wbasedir 2138 #define wbasedir_ws _wbasedir_ws 2139 #define wpathnormalize _wpathnormalize 2140 #define wpathnormalize_ws _wpathnormalize_ws 2142 #define fputwc _fputwc 2143 #define fputws _fputws 2144 #define vfprintf _vfprintf 2145 #define vsnprintf _vsnprintf 2146 #define fprintf _fprintf 2147 #define snprintf _snprintf 2148 #define vfwprintf _vfwprintf 2149 #define vswprintf _vswprintf 2150 #define fwprintf _fwprintf 2151 #define swprintf _swprintf 2152 #define wprintf _wprintf 2153 #define fprintf _fprintf 2154 #define printf _printf 2157 #define _wcprint wcprint 2158 #define _wcsregexp wcsregexp 2159 #define _wcstocscmp wcstocscmp 2160 #define _u8stowcs u8stowcs 2161 #define _wcstou8s wcstou8s 2162 #define _u8wfopen u8wfopen 2163 #define _u8wmkdir u8wmkdir 2164 #define _u8waccess u8waccess 2165 #define _u8wremove u8wremove 2166 #define _u8wrename u8wrename 2167 #define _u8wstat u8wstat 2168 #define _u8sverify u8sverify 2170 #define wclosedir _wclosedir 2171 #define wopendir _wopendir 2172 #define wreaddir _wreaddir 2173 #define wreaddir_r _wreaddir_r 2174 #define wreaddir_cb _wreaddir_cb 2175 #define wrewinddir _wrewinddir 2176 #define wseekdir _wseekdir 2177 #define wtelldir _wtelldir 2179 #define towupper _towupper 2180 #define towlower _towlower 2181 #define towctrans _towctrans 2182 #define wctype _wctype 2183 #define wctrans _wctrans 2184 #define wcwidth _wcwidth 2185 #define wcswidth _wcswidth 2187 #define iswctype _iswctype 2188 #define iswxdigit _iswxdigit 2189 #define iswupper _iswupper 2190 #define iswspace _iswspace 2191 #define iswpunct _iswpunct 2192 #define iswprint _iswprint 2193 #define iswlower _iswlower 2194 #define iswgraph _iswgraph 2195 #define iswdigit _iswdigit 2196 #define iswcntrl _iswcntrl 2197 #define iswblank _iswblank 2198 #define iswalpha _iswalpha 2199 #define iswalnum _iswalnum 2201 #define wcstod _wcstod 2202 #define wcstof _wcstof 2203 #define wcstold _wcstold 2204 #define wcstol _wcstol 2205 #define wcstoll _wcstoll 2206 #define wcstoul _wcstoul 2207 #define wcstoull _wcstoull 2208 #define wcstoimax _wcstoimax 2209 #define wcstoumax _wcstoumax 2211 #define wcstombs _wcstombs 2212 #define wcstombs_s _wcstombs_s 2213 #define wcsrtombs _wcsrtombs 2214 #define wcrtomb _wcrtomb 2215 #define mbstowcs _mbstowcs 2216 #define mbsrtowcs _mbsrtowcs 2217 #define wcsnrtombs _wcsnrtombs 2218 #define mbsnrtowcs _mbsnrtowcs 2219 #define mbrtowc _mbrtowc 2220 #define mbrlen _mbrlen 2221 #define mblen _mblen 2222 #define mbsinit _mbsinit 2223 #define mbtowc _mbtowc 2224 #define wctomb _wctomb 2225 #define wctob _wctob 2226 #define btowc _btowc 2227 #define wcpcpy _wcpcpy 2228 #define wcpncpy _wcpncpy 2229 #define wcscat _wcscat 2230 #define wcsncat _wcsncat 2231 #define wcsncpy _wcsncpy 2232 #define wcspbrk _wcspbrk 2233 #define wcschr _wcschr 2234 #define wcsrchr _wcsrchr 2235 #define wcsstr _wcsstr 2236 #define wcstok _wcstok 2237 #define wcscmp _wcscmp 2238 #define wcsftime _wcsftime 2239 #define wcsptime _wcsptime 2240 #define wmemchr _wmemchr 2241 #define wmemcpy _wmemcpy 2242 #define wmemmove _wmemmove 2243 #define wmemset _wmemset 2244 #define wcslcat _wcslcat 2245 #define wcslcpy _wcslcpy 2246 #define wcslen _wcslen 2247 #define wcsnlen _wcsnlen 2248 #define wcsspn _wcsspn 2249 #define wcscasecmp _wcscasecmp 2250 #define wcsncasecmp _wcsncasecmp 2251 #define wcsncmp _wcsncmp 2252 #define wmemcmp _wmemcmp size_t sz
size wide string
Definition: wchar2.h:135
long int _wcstol(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to long int number.
size_t _wcslcpy(wchar_t *, const wchar_t *, size_t)
Copy wide-character string to specified length.
int _iswpunct(wchar_t)
Test for punctuation or symbolic wide character.
unsigned short d_reclen
Length of this record.
Definition: wchar2.h:144
void * _wbasedir_selector(int, const void *, int)
Automatic type selector for wbasedir* functions.
int _wmkdir(const wchar_t *, mode_t)
Creates a directory or a chain of directories specified in the path.
wchar_t * _wcpcpy(wchar_t *, const wchar_t *)
Copy a wide-character string returning a pointer to its end.
is a character device
Definition: wchar2.h:163
size_t _wcsftime(wchar_t *restrict, size_t sz, const wchar_t *restrict, const void *restrict)
Convert date and time to a formatted wide-character string.
size_t _mbrtowc(wchar_t *restrict, const char *restrict src, size_t, mbstate_t *restrict)
Converts a narrow multibyte character to a wide character.
char * wstring_swstocs_alloc(const string_ws *restrict)
Converting string, string_ws input, char allocate output.
int wcstocscmp(const char *, wchar_t *, size_t)
compare char* <-> wchar_t* This function quick compare only ASCII range, NOT all Unicode symbols supp...
long wstring_split_cb(const string_ws *, wchar_t, split_cb, void *)
Split string_ws string, from wchar_t characters and call split_cb to result data. ...
wctrans_t _wctrans(const char *)
Compute wide-character translation type.
options for read derrictory - no print dir
Definition: wchar2.h:168
int _wstat(const wchar_t *, void *)
Functions wstat*() fill the structure with data about the file pointed to by struct stat...
int _iswlower(wchar_t)
Test for lowercase wide character.
int _iswupper(wchar_t)
Test for uppercase wide character.
access_e
enumeration for return waccess function
Definition: wchar2.h:156
int _wremove_ws(const string_ws *)
The same as _wremove, the input parameter filename is passed in the string_ws structure.
int _wctob(wchar_t)
Convert wide character to single byte.
access_e u8waccess(const wchar_t *, int)
Check permissions for a file or directory, convert file name from wide characters to UTF-8...
is a UNIX domain socket
Definition: wchar2.h:165
int _wcsncasecmp(const wchar_t *, const wchar_t *, size_t)
Case-insensitive wide character string compare with size.
wctype_t _wctype(const char *)
Compute wide-character test type.
int _fputws(const wchar_t *restrict, FILE *restrict)
Write a wide character string to a file or stream.
size_t wstring_trunc_alloc(string_ws *restrict, const wchar_t *, int)
Truncation string, wchar_t input, return pointer to struct string_ws and length.
size_t wstring_append_cvt(string_ws *, const char *restrict, size_t)
Append string: source type char*, length input, struct string_ws output.
void(* wdir_cb)(unsigned int, access_e, long long, string_ws *, void *)
CallBack for _wreaddir_cb.
Definition: wchar2.h:181
int _wrename_s(const wchar_t *, size_t, const wchar_t *, size_t)
The same as _wrename, the size_t parameter must contain the length of the variable of the file name...
size_t _wcstombs_s(char *restrict, const wchar_t *restrict, size_t)
Minimal wide string to multibyte string converter + double size out buffer.
int _wcsncmp(const wchar_t *, const wchar_t *, size_t)
Wide-character string compare.
char * u8wpathnormalize(const wchar_t *)
Normalize slash from path, convert file name from wide characters to UTF-8.
access_e _waccess_selector(int, const void *, size_t, int)
Automatic type selector for wmkdir* functions.
wchar_t _towlower(wchar_t)
Translate wide characters to lowercase.
wchar_t * _wcsncat(wchar_t *, const wchar_t *, size_t)
Concatenate wide-character strings with size.
size_t _wcstombs(char *restrict, const wchar_t *restrict, size_t)
Minimal wide string to multibyte string converter.
size_t wcstou8s(char *, const wchar_t *)
Convert wchar_t* to utf-8 char*
wchar_t _fputwc(wchar_t, FILE *restrict)
Write a wide character to a file or stream.
int u8wremove(const wchar_t *)
Delete (remove) file or directory, after converting the file name from wide characters to UTF-8...
int _mbsinit(const mbstate_t *)
Check if initial conversion state.
size_t _wcsspn(const wchar_t *, const wchar_t *)
Find initial match in wide-character string.
is a Directory
Definition: wchar2.h:162
FILE * u8wfopen(const wchar_t *, const wchar_t *)
Open file stream, after converting the file name from wide characters to UTF-8.
int wmkstemp(wchar_t *)
Create a unique file name based on template, actually creates the file and returns its file descripto...
int _wrename_selector(int, const void *, size_t, const void *, size_t)
Automatic type selector for wrename* functions.
int _wstat_selector(int, const void *, size_t, const void *)
Automatic type selector for wstat* functions.
Base wide string structure.
Definition: wchar2.h:132
is a named pipe
Definition: wchar2.h:166
is a Unknown
Definition: wchar2.h:159
WDIR_t * _wopendir(const wchar_t *)
Opens a directory stream and returns a pointer to the stream. The stream is set to the first entry in...
float _wcstof(const wchar_t *, wchar_t **)
Convert wide character ASCII string to float number.
size_t wstring_format(string_ws *, const wchar_t *restrict,...)
Append string, format vargs support input, struct string_ws output.
int _snprintf(char *restrict, size_t, const char *restrict,...)
Format variable arguments list.
FILE * _wfopen(const wchar_t *, const wchar_t *)
Open the stream for the file, takes as the first parameter the file name and the second parameter the...
void(* split_cb)(wchar_t *, size_t, long, void *)
CallBack for wstring_split_cb.
Definition: wchar2.h:190
wchar_t * _wcsstr(const wchar_t *, const wchar_t *)
Find wide-character string segment.
size_t wstring_wstocs_ws(char [], size_t, const string_ws *restrict)
Converting string, structure string_ws input, char array output, to allocate buffer write...
wchar_t * _wpathnormalize(const wchar_t *, size_t)
Normalize slash from path, wide char input, int is string size, default 0.
int _wmkdir_selector(int, const void *, size_t, mode_t)
Automatic type selector for wmkdir* functions.
int _wrename_ws(const string_ws *, const string_ws *)
The same as _wrename, the input parameter filename is passed in the string_ws structure.
int _swprintf(wchar_t *restrict, size_t, const wchar_t *restrict,...)
Write formatted wide character output.
int _wreaddir_cb(wchar_t *, long, wdir_cb, void *)
Reads the directory stream callBack.
Error check.
Definition: wchar2.h:158
int _wrename(const wchar_t *, const wchar_t *)
The wrename() function changes the file name to a new one.
int _wreaddir_r(WDIR_t *, wdirent_t *, wdirent_t **)
Reads the directory stream extended.
int _vsnprintf(char *restrict, size_t, const char *restrict, va_list)
Write formatted data from variable argument list to sized buffer.
size_t wstring_cstows(wchar_t [], size_t, const char *restrict, size_t)
Converting string, char input, wchar_t array output, to allocate buffer write.
unsigned long int _wcstoul(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to unsigned long int number.
double _wcstod(const wchar_t *, wchar_t **)
Convert wide character ASCII string to double number.
wchar_t * _wcspbrk(const wchar_t *, const wchar_t *)
Find wide characters in string.
void wstring_free(string_ws *restrict)
Memory free string, empty and clear struct string_ws.
int _iswgraph(wchar_t)
Test for graphic wide character.
int _vfwprintf(FILE *restrict, const wchar_t *restrict, va_list)
Write to stream wide character format variable argument list.
wchar_t * wcsregexp(wchar_t *restrict, wchar_t *restrict, int *)
wcsregexp - Matches a regular expression
size_t _wcsnrtombs(char *restrict, const wchar_t **restrict, size_t, size_t, mbstate_t *restrict)
Convert a wide-character string to a character string.
long int _wtelldir(WDIR_t *)
Returns the current position of the directory stream.
int _mbtowc(wchar_t *restrict, const char *restrict, size_t)
Minimal multibyte to wide char converter.
wchar_t * str
wide string pointer
Definition: wchar2.h:134
wchar_t * _wpathnormalize_ws(const string_ws *)
Normalize slash from path, struct string_ws input.
options for read derrictory - get files size
Definition: wchar2.h:170
wchar_t * wstring_timeformat_ws(const string_ws *restrict, const wchar_t *restrict, const wchar_t *restrict)
Converting time format string to string, string_ws input.
wchar_t * _wcsrchr(const wchar_t *, wchar_t)
Reverse search for wide character in string.
size_t _mbrlen(const char *restrict, size_t, mbstate_t *restrict)
Get length of multibyte character.
wchar_t * _wbasename(const wchar_t *)
Parse path file name, wide char input.
int _wcswidth(const wchar_t *, size_t)
Number of column positions of a wide-character string.
int _iswdigit(wchar_t)
Test for decimal digit wide character.
wchar_t * wstring_timeformat(const wchar_t *restrict, size_t, const wchar_t *restrict, const wchar_t *restrict)
Converting time format string to string, wchar_t and size_t input.
size_t u8stowcs(wchar_t *, const char *)
Covert utf-8 char* to wchar_t*
string_ws wstring_trunc(const wchar_t *ws, int)
Truncation string, wchar_t input, struct string_ws return.
size_t wstring_alloc(string_ws *restrict, size_t)
Memory allocation string, struct string_ws->str output.
size_t wstring_cstows_ws_alloc(string_ws *restrict, const char *restrict)
Converting string, string_ws input, length output.
is a block device
Definition: wchar2.h:164
wchar_t * _wcsptime(const wchar_t *, const wchar_t *, void *)
Convert a wide-character string representation of time to a time tm structure.
access_e _waccess_s(const wchar_t *, size_t, int)
Check permissions for a file or directory, wide char input with size.
wchar_t _towctrans(wchar_t, wctrans_t)
Extensible wide-character translation.
uintmax_t _wcstoumax(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to uintmax_t integer.
size_t _wcsnlen(const wchar_t *, size_t)
Wide-character string length with maximum limit.
unsigned char d_type
Type of file.
Definition: wchar2.h:145
is a Symbolic link
Definition: wchar2.h:161
long int d_off
Offset.
Definition: wchar2.h:143
int _wstat_ws(const string_ws *, void *)
The same as _wstat, the input parameter filename is passed in the string_ws structure.
int _wremove(const wchar_t *)
The wremove*() function deletes a name from the file system.
int _iswxdigit(wchar_t)
Test for hexadecimal digit wide character.
long long int _wcstoll(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to long long int number.
size_t wstring_append(string_ws *, const wchar_t *restrict, size_t)
Append string: wchar_t*, length input, struct string_ws output.
FILE * _wfopen_s(const wchar_t *, size_t, const wchar_t *)
The same as _wfopen, the size_t parameter must contain the length of the variable of the file name...
int _fwprintf(FILE *restrict, const wchar_t *restrict,...)
Write to stream wide character format variable arguments.
FILE * _wfopen_ws(const string_ws *, const wchar_t *)
The same as _wfopen, the input parameter filename is passed in the string_ws structure.
int _iswblank(wchar_t)
Test for whitespace wide character.
size_t _mbsnrtowcs(wchar_t *restrict, const char **restrict, size_t, size_t, mbstate_t *restrict)
Convert a character string to a wide-character string.
char * wstring_wstocs_alloc(const wchar_t *restrict)
Converting string, wchar_t input, char allocate output.
intmax_t _wcstoimax(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to intmax_t integer.
wdirent_t * _wreaddir(WDIR_t *)
Reads the directory stream.
int _wmkdir_s(const wchar_t *, size_t, mode_t)
The same as _wmkdir, the size_t parameter must contain the length of the variable of the file name...
int u8wrename(const wchar_t *, const wchar_t *)
Rename file, after converting the file name from wide characters to UTF-8.
size_t wstring_appends_(string_ws *,...)
Append strings, only wchar_t* strings args inputs, struct string_ws output.
int _vfprintf(FILE *restrict, const char *restrict, va_list)
Write to stream char format variable argument list.
size_t _mbstowcs(wchar_t *restrict, const char *restrict, size_t)
Minimal multibyte string to wide string converter.
void WDIR_t
Main structure directory traversing, reference to void
Definition: wchar2.h:153
unsigned int d_ino
Inode number.
Definition: wchar2.h:142
wchar_t * _wcsncpy(wchar_t *, const wchar_t *, size_t)
Counted copy wide-character string.
int _vswprintf(wchar_t *restrict, size_t, const wchar_t *restrict, va_list)
Write formatted data from variable argument list to sized buffer.
wchar_t * _wbaseext_ws(const string_ws *)
Parse path extension, struct string_ws input.
int _wcwidth(wchar_t)
Number of column positions of a wide-character code.
int _wcscmp(const wchar_t *, const wchar_t *)
Wide-character string compare.
int wstring_isempty(const wchar_t *restrict s, int)
Check wchar_t input string is empty, bool return.
int _wstat_s(const wchar_t *, size_t, void *)
The same as _wstat, the size_t parameter must contain the length of the variable of the file name...
int u8wstat(const wchar_t *, void *)
Get file statistics by first converting the file name from wide characters to UTF-8.
int _iswspace(wchar_t)
Test for whitespace wide character.
int _wctomb(char *, wchar_t)
Minimal wide char to multibyte converter.
wchar_t * _wbasedir(const wchar_t *, int)
Parse path directory + normalize slash from path, wide char input.
long double _wcstold(const wchar_t *, wchar_t **)
Convert wide character ASCII string to long double number.
int _wcscasecmp(const wchar_t *, const wchar_t *)
Case-insensitive wide character string compare.
wchar_t * _wcpncpy(wchar_t *, const wchar_t *, size_t)
Copy part of a wide-character string returning a pointer to its end.
void * _wbaseext_selector(int, const void *)
Automatic type selector for wbaseext* functions.
int _printf(const char *restrict fmt,...)
Write to stdout char format variable arguments.
the contains constructs that facilitate directory traversing
Definition: wchar2.h:140
is a whiteout" from BSD
Definition: wchar2.h:167
wchar_t d_name[256]
Null-terminated filename.
Definition: wchar2.h:149
wchar_t * wstring_cstows_alloc(const char *restrict)
Converting string, char input, wchar_t allocate output.
is a Regular file
Definition: wchar2.h:160
int _wremove_s(const wchar_t *, size_t)
The same as _wremove, the size_t parameter must contain the length of the variable of the file name...
size_t wstring_wstocs(char [], size_t, const wchar_t *restrict, size_t)
Converting string, wchar_t input, char array output, to allocate buffer write.
void wcprint(wchar_t *)
wchar_t* print This function to test variably only! Instead use _vfprintf, _vfwprintf, _fprintf, _fwprintf
unsigned long long int _wcstoull(const wchar_t *, wchar_t **, int)
Convert wide character ASCII string to unsigned long long int number.
int _wmkdir_ws(const string_ws *, mode_t)
The same as _wmkdir, the input parameter filename is passed in the string_ws structure.
size_t _wcrtomb(char *restrict, wchar_t, mbstate_t *restrict)
Convert wide character to multibyte sequence.
wchar_t * _wbaseext(const wchar_t *)
Parse path extension, wide char input.
void * _wbasename_selector(int, const void *)
Automatic type selector for wbasename* functions.
wchar_t * _wcstok(wchar_t *, const wchar_t *, wchar_t **)
Tokenize wide-character string.
int u8sverify(const char *)
Verify char* to utf-8 valid string.
size_t _wcslcat(wchar_t *, const wchar_t *, size_t)
Concatenate wide-character strings to specified length.
int _fprintf(FILE *restrict, const char *restrict,...)
Write to stream char format variable arguments.
access_e _waccess_ws(const string_ws *, int)
Check permissions for a file or directory, struct string_ws input.
size_t _mbsrtowcs(wchar_t *restrict, const char **restrict, size_t, mbstate_t *restrict)
Convert a character string to a wide-character string.
wchar_t * _wmemchr(const wchar_t *, wchar_t, size_t)
Find wide character in memory.
int _iswalnum(wchar_t)
Test for alphanumeric wide character, alphabetic wide character predicate.
wchar_t * _wcschr(const wchar_t *, wchar_t)
Search for wide character in string.
void _wrewinddir(WDIR_t *)
Sets the beginning in the directory stream.
int _iswalpha(wchar_t)
Test for whitespace wide character, alphabetic wide character predicate.
access_e _waccess(const wchar_t *, int)
Check permissions for a file or directory, wide char input.
int _iswprint(wchar_t)
Test for printing wide character.
size_t _wcslen(const wchar_t *)
Wide-character string length.
const char * wchar2version(void)
Library current version.
int _wremove_selector(int, const void *, size_t)
Automatic type selector for wremove* functions.
int _wclosedir(WDIR_t *)
Closes the directory stream.
int _mblen(const char *, size_t)
Determines the size, in bytes, of the multibyte character whose first byte is pointed.
wchar_t * _wcscat(wchar_t *, const wchar_t *)
Concatenate wide-character strings.
struct _wdirent wdirent_t
the contains constructs that facilitate directory traversing
size_t _wcsrtombs(char *restrict, const wchar_t **restrict, size_t, mbstate_t *restrict)
Convert a wide-character string to a character string.
wchar_t _towupper(wchar_t)
Translate wide characters to uppercase.
FILE * _wfopen_selector(int, const void *, size_t, const void *)
Automatic type selector for wfopen* functions.
wchar_t _btowc(int)
Convert single byte character to wide character.
options for read derrictory - no print root parent `.
Definition: wchar2.h:169
int _iswcntrl(wchar_t)
Test for control wide character.
int _wmemcmp(const wchar_t *, const wchar_t *, size_t)
Compare wide characters in memory.
int u8wmkdir(const wchar_t *, mode_t)
Creates a directory or a chain of directories specified in the path, after converting the file name f...
wchar_t * _wmemcpy(wchar_t *, const wchar_t *, size_t)
Copy wide characters in memory.
wchar_t * _wmemmove(wchar_t *, const wchar_t *, size_t)
Copy wide characters in memory with overlapping areas.
wchar_t * _wmemset(wchar_t *, wchar_t, size_t)
Set wide characters in memory.
void _wseekdir(WDIR_t *, long int)
Sets the position in the directory stream.
wchar_t * _wbasedir_ws(const string_ws *, int)
Parse path directory + normalize slash from path, struct string_ws input.
wchar_t * _wbasename_ws(const string_ws *)
Parse path file name, struct string_ws input.
int _wprintf(const wchar_t *restrict fmt,...)
Write a formatted wide character string to 'stdout'.
int _iswctype(wchar_t, wctype_t)
Extensible wide-character test, wide-character classification.