libwchar2 0.0.10
wchar2.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 2018 PS
5  GitHub: https://github.com/ClnViewer/LibWchar2
6 
7  Permission is hereby granted, free of charge, to any person obtaining a copy
8  of this software and associated documentation files (the "Software"), to deal
9  in the Software without restriction, including without limitation the rights
10  to use, copy, modify, merge, publish, distribute, sub license, and/or sell
11  copies of the Software, and to permit persons to whom the Software is
12  furnished to do so, subject to the following conditions:
13 
14  The above copyright notice and this permission notice shall be included in all
15  copies or substantial portions of the Software.
16 
17  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  SOFTWARE.
24  */
25 
26 
52 /*
53  Missing curent, TODO ?:
54  wcscoll Locale-specific wide-character string compare
55  wcscpy Copy wide-character string
56  wcscspn Count wide characters not in string
57  wcsxfrm Locale-specific wide-character string transformation
58  */
59 
60 #ifndef WCHAR2_LIBC_H
61 #define WCHAR2_LIBC_H
62 
63 #if defined(WCHAR2EXT_MSVC_H)
64 # error "Only one header include, wchar2.h or wchar2ext.h"
65 #endif
66 
67 #include <wctype.h>
68 #include <wchar.h>
69 
70 #if !defined(__SIZEOF_WCHAR_T__)
71 # error "'__SIZEOF_WCHAR_T__' NOT defined, system not supported"
72 #endif
73 
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'"
76 #endif
77 
78 #if ( \
79  defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || \
80  defined(_WIN64) || defined(__WIN64__) || \
81  defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__))
82 
83 # error "NOT include <wchar2.h>, for WINxx platform! use <wchar2ext.h> and libwchar2ext.* instead"
84 #endif
85 
86 #if !defined(UINTMAX_MAX)
87 typedef unsigned long long int uintmax_t;
88 #endif
89 #if !defined(INTMAX_MAX)
90 typedef long long int intmax_t;
91 #endif
92 
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
119 # else
120 # define restrict
121 # endif
122 # endif
123 #endif
124 
127 #ifdef __cplusplus
128 extern "C" {
129 #endif
130 
132 typedef struct
133 {
134  wchar_t *str;
135  size_t sz;
137 } string_ws;
138 
140 typedef struct _wdirent
141 {
142  unsigned int d_ino;
143  long int d_off;
144  unsigned short d_reclen;
145  unsigned char d_type;
146 # if defined(_DIRENT_HAVE_D_NAMLEN)
147  unsigned char d_namlen;
148 # endif
149  wchar_t d_name[256];
150 } wdirent_t;
151 
153 typedef void WDIR_t;
154 
156 typedef enum
157 {
158  ISERR = -1,
159  ISUNK = 0,
160  ISFIL = 1,
161  ISLNK = 2,
162  ISDIR = 3,
163  ISCHR = 4,
164  ISBLK = 5,
165  ISSOCK = 6,
166  ISFIFO = 7,
167  ISWHT = 8,
168  DIRNODIR = 9,
169  DIRNOROOT = 10,
171 } access_e;
172 
181 typedef void (*wdir_cb)(unsigned int, access_e, long long, string_ws*, void*);
182 
190 typedef void (*split_cb)(wchar_t*, size_t, long, void*);
191 
195 const char * wchar2version(void);
196 
202 wchar_t _towupper(wchar_t);
203 
209 wchar_t _towlower(wchar_t);
210 
216 wchar_t _towctrans(wchar_t, wctrans_t);
217 
223 wctype_t _wctype(const char*);
224 
230 wctrans_t _wctrans(const char*);
231 
237 int _wcwidth(wchar_t);
238 
244 int _wcswidth(const wchar_t*, size_t);
245 
251 int _iswctype(wchar_t, wctype_t);
252 
258 int _iswxdigit(wchar_t);
259 
265 int _iswupper(wchar_t);
266 
272 int _iswspace(wchar_t);
273 
279 int _iswpunct(wchar_t);
280 
286 int _iswprint(wchar_t);
287 
293 int _iswlower(wchar_t);
294 
300 int _iswgraph(wchar_t);
301 
307 int _iswdigit(wchar_t);
308 
314 int _iswcntrl(wchar_t);
315 
321 int _iswblank(wchar_t);
322 
328 int _iswalpha(wchar_t);
329 
335 int _iswalnum(wchar_t);
336 
346 double _wcstod(const wchar_t*, wchar_t**);
347 
353 float _wcstof(const wchar_t*, wchar_t**);
354 
360 long double _wcstold(const wchar_t*, wchar_t**);
361 
367 long int _wcstol(const wchar_t*, wchar_t**, int);
368 
374 long long int _wcstoll(const wchar_t*, wchar_t**, int);
375 
381 unsigned long int _wcstoul(const wchar_t*, wchar_t**, int);
382 
388 unsigned long long int _wcstoull(const wchar_t*, wchar_t**, int);
389 
395 intmax_t _wcstoimax(const wchar_t*, wchar_t**, int);
396 
402 uintmax_t _wcstoumax(const wchar_t*, wchar_t**, int);
403 
404 
414 size_t _wcstombs(char *restrict, const wchar_t *restrict, size_t);
415 
421 size_t _wcstombs_s(char *restrict, const wchar_t *restrict, size_t);
422 
428 size_t _wcsrtombs(char *restrict, const wchar_t **restrict, size_t, mbstate_t *restrict);
429 
435 size_t _wcrtomb(char *restrict, wchar_t, mbstate_t *restrict);
436 
442 size_t _mbstowcs(wchar_t *restrict, const char *restrict, size_t);
443 
449 size_t _mbsrtowcs(wchar_t *restrict, const char **restrict, size_t, mbstate_t *restrict);
450 
456 size_t _wcsnrtombs(char *restrict, const wchar_t **restrict, size_t, size_t, mbstate_t *restrict);
457 
463 size_t _mbsnrtowcs(wchar_t *restrict, const char **restrict, size_t, size_t, mbstate_t *restrict);
464 
470 size_t _mbrtowc(wchar_t *restrict, const char *restrict src, size_t, mbstate_t *restrict);
471 
477 size_t _mbrlen(const char *restrict, size_t, mbstate_t *restrict);
478 
484 int _mblen(const char*, size_t);
485 
491 int _mbsinit(const mbstate_t*);
492 
498 int _mbtowc(wchar_t *restrict, const char *restrict, size_t);
499 
505 int _wctomb(char*, wchar_t);
506 
512 int _wctob(wchar_t);
513 
519 wchar_t _btowc(int);
520 
533 void wcprint(wchar_t*);
534 
542 int wcstocscmp(const char*, wchar_t*, size_t); // ASCII range only
543 
563 wchar_t * wcsregexp(wchar_t *restrict, wchar_t *restrict, int*);
564 
573 size_t u8stowcs(wchar_t*, const char*);
574 
583 size_t wcstou8s(char*, const wchar_t*);
584 
591 int u8sverify(const char*);
592 
598 wchar_t * _wcpcpy(wchar_t*, const wchar_t*);
599 
605 wchar_t * _wcpncpy(wchar_t*, const wchar_t*, size_t);
606 
612 wchar_t * _wcscat(wchar_t*, const wchar_t*);
613 
619 wchar_t * _wcsncat(wchar_t*, const wchar_t*, size_t);
620 
626 wchar_t * _wcsncpy(wchar_t*, const wchar_t*, size_t);
627 
633 wchar_t * _wcspbrk(const wchar_t*, const wchar_t*);
634 
640 wchar_t * _wcschr(const wchar_t*, wchar_t);
641 
647 wchar_t * _wcsrchr(const wchar_t*, wchar_t);
648 
654 wchar_t * _wcsstr(const wchar_t*, const wchar_t*);
655 
661 wchar_t * _wcstok(wchar_t*, const wchar_t*, wchar_t**);
662 
668 wchar_t * _wmemchr(const wchar_t*, wchar_t, size_t);
669 
675 wchar_t * _wmemcpy(wchar_t*, const wchar_t*, size_t);
676 
682 wchar_t * _wmemmove(wchar_t*, const wchar_t*, size_t);
683 
689 wchar_t * _wmemset(wchar_t*, wchar_t, size_t);
690 
692 size_t _wcslcat(wchar_t*, const wchar_t*, size_t);
694 size_t _wcslcpy(wchar_t*, const wchar_t*, size_t);
695 
701 size_t _wcslen(const wchar_t*);
702 
708 size_t _wcsnlen(const wchar_t*, size_t);
709 
717 size_t _wcsspn(const wchar_t*, const wchar_t*);
718 
724 int _wcscasecmp(const wchar_t*, const wchar_t*);
725 
731 int _wcsncasecmp(const wchar_t*, const wchar_t*, size_t);
732 
738 int _wcscmp(const wchar_t*, const wchar_t*);
746 int _wcsncmp(const wchar_t*, const wchar_t*, size_t);
747 
753 int _wmemcmp(const wchar_t*, const wchar_t*, size_t);
754 
756 int _vfprintf(FILE *restrict, const char *restrict, va_list)
757 __attribute__((__nonnull__, __format__(__printf__, 2, 0)));
758 
760 int _vsnprintf(char *restrict, size_t, const char *restrict, va_list)
761 __attribute__((__format__(__printf__, 3, 0)));
762 
764 int _fprintf(FILE *restrict, const char *restrict, ...)
765 __attribute__((__nonnull__, __format__(__printf__, 2, 0)));
766 
768 int _printf(const char *restrict fmt, ...)
769 __attribute__((__nonnull__, __format__(__printf__, 1, 0)));
770 
772 int _snprintf(char *restrict, size_t, const char *restrict, ...)
773 __attribute__((__format__(__printf__, 3, 0)));
774 
780 int _vfwprintf(FILE *restrict, const wchar_t *restrict, va_list)
781 /* __attribute__((__nonnull__, __format__(__wprintf__, 2, 0))) */ ;
782 
788 int _vswprintf(wchar_t *restrict, size_t, const wchar_t *restrict, va_list)
789 /* __attribute__((__format__(__wprintf__, 3, 0))) */ ;
790 
796 int _fwprintf(FILE *restrict, const wchar_t *restrict, ...)
797 /* __attribute__((__nonnull__, __format__(__wprintf__, 2, 0))) */ ;
798 
804 int _swprintf(wchar_t *restrict, size_t, const wchar_t *restrict, ...)
805 /* __attribute__((__format__(__wprintf__, 3, 0))) */ ;
806 
817 int _wprintf(const wchar_t *restrict fmt, ...)
818 /* __attribute__((__format__(__wprintf__, 1, 0))) */ ;
819 
830 int _fputws(const wchar_t *restrict, FILE *restrict);
831 
842 wchar_t _fputwc(wchar_t, FILE *restrict);
843 
874 size_t _wcsftime(wchar_t *restrict, size_t sz, const wchar_t *restrict, const void *restrict);
875 
905 wchar_t * _wcsptime(const wchar_t*, const wchar_t*, void*);
906 
928 FILE * _wfopen(const wchar_t*, const wchar_t*)
929 __attribute__((warn_unused_result));
930 
943 FILE * _wfopen_s(const wchar_t*, size_t, const wchar_t*)
944 __attribute__((warn_unused_result));
945 
956 FILE * _wfopen_ws(const string_ws*, const wchar_t*)
957 __attribute__((warn_unused_result));
958 
969 FILE * _wfopen_selector(int, const void*, size_t, const void*)
970 __attribute__((warn_unused_result));
971 
984 FILE * u8wfopen(const wchar_t*, const wchar_t*)
985 __attribute__((warn_unused_result));
986 
1013 int _wstat(const wchar_t*, void*);
1014 
1027 int _wstat_s(const wchar_t*, size_t, void*);
1028 
1039 int _wstat_ws(const string_ws*, void*);
1040 
1051 int _wstat_selector(int, const void*, size_t, const void*);
1052 
1064 int u8wstat(const wchar_t*, void*);
1065 
1095 int _wrename(const wchar_t*, const wchar_t*);
1096 
1109 int _wrename_s(const wchar_t*, size_t, const wchar_t*, size_t);
1110 
1121 int _wrename_ws(const string_ws*, const string_ws*);
1122 
1133 int _wrename_selector(int, const void*, size_t, const void*, size_t);
1134 
1147 int u8wrename(const wchar_t*, const wchar_t*);
1148 
1171 int _wremove(const wchar_t*);
1172 
1185 int _wremove_s(const wchar_t*, size_t);
1186 
1197 int _wremove_ws(const string_ws*);
1198 
1209 int _wremove_selector(int, const void*, size_t);
1210 
1223 int u8wremove(const wchar_t*);
1224 
1247 int _wmkdir(const wchar_t*, mode_t);
1248 
1261 int _wmkdir_s(const wchar_t*, size_t, mode_t);
1262 
1273 int _wmkdir_ws(const string_ws*, mode_t);
1274 
1285 int _wmkdir_selector(int, const void*, size_t, mode_t);
1286 
1301 int u8wmkdir(const wchar_t*, mode_t);
1302 
1303 
1324 access_e _waccess(const wchar_t*, int);
1326 access_e _waccess_s(const wchar_t*, size_t, int);
1328 access_e _waccess_ws(const string_ws*, int);
1330 access_e _waccess_selector(int, const void*, size_t, int);
1335 access_e u8waccess(const wchar_t*, int);
1336 
1343 wchar_t * _wbasename(const wchar_t*);
1345 wchar_t * _wbasename_ws(const string_ws*);
1347 void * _wbasename_selector(int, const void*);
1348 
1355 wchar_t * _wbaseext(const wchar_t*);
1357 wchar_t * _wbaseext_ws(const string_ws*);
1359 void * _wbaseext_selector(int, const void*);
1360 
1368 wchar_t * _wbasedir(const wchar_t*, int)
1369 __attribute__((warn_unused_result));
1371 wchar_t * _wbasedir_ws(const string_ws*, int)
1372 __attribute__((warn_unused_result));
1374 void * _wbasedir_selector(int, const void*, int)
1375 __attribute__((warn_unused_result));
1376 
1384 wchar_t * _wpathnormalize(const wchar_t*, size_t)
1385 __attribute__((warn_unused_result));
1387 wchar_t * _wpathnormalize_ws(const string_ws*)
1388 __attribute__((warn_unused_result));
1389 
1394 char * u8wpathnormalize(const wchar_t*)
1395 __attribute__((warn_unused_result));
1396 
1397 
1398 /*
1399  * \~English
1400  * \section wchar2wstring API use structure string_ws
1401  *
1402  * \~Russian
1403  * \section wchar2wstring API - Работа со структорой string_ws
1404  *
1405  */
1406 
1419 void wstring_free(string_ws *restrict);
1420 
1422 size_t wstring_alloc(string_ws *restrict, size_t);
1423 
1428 char * wstring_wstocs_alloc(const wchar_t *restrict)
1429 __attribute__((warn_unused_result));
1430 
1435 char * wstring_swstocs_alloc(const string_ws *restrict)
1436 __attribute__((warn_unused_result));
1437 
1442 wchar_t * wstring_cstows_alloc(const char *restrict)
1443 __attribute__((warn_unused_result));
1444 
1449 size_t wstring_cstows_ws_alloc(string_ws *restrict, const char *restrict);
1450 
1468 size_t wstring_format(string_ws*, const wchar_t *restrict, ...);
1469 
1484 size_t wstring_append(string_ws*, const wchar_t *restrict, size_t);
1485 
1501 size_t wstring_appends_(string_ws*, ...);
1502 
1506 #define wstring_appends(A,...) wstring_appends_(A,__VA_ARGS__,NULL)
1507 
1519 size_t wstring_append_cvt(string_ws*, const char *restrict, size_t);
1520 
1533 size_t wstring_cstows(wchar_t [], size_t, const char *restrict, size_t);
1534 
1543 size_t wstring_wstocs(char [], size_t, const wchar_t *restrict, size_t);
1544 
1550 size_t wstring_wstocs_ws(char [], size_t, const string_ws *restrict);
1551 
1571 wchar_t * wstring_timeformat(const wchar_t *restrict, size_t, const wchar_t *restrict, const wchar_t *restrict)
1572 __attribute__((warn_unused_result));
1573 
1578 wchar_t * wstring_timeformat_ws(const string_ws *restrict, const wchar_t *restrict, const wchar_t *restrict)
1579 __attribute__((warn_unused_result));
1580 
1585 long wstring_split_cb(const string_ws*, wchar_t, split_cb, void*);
1586 
1587 
1599 int wstring_isempty(const wchar_t *restrict s, int);
1600 
1604 string_ws wstring_trunc(const wchar_t *ws, int);
1605 
1609 size_t wstring_trunc_alloc(string_ws *restrict, const wchar_t*, int);
1610 
1644 int _wclosedir(WDIR_t*);
1645 
1672 WDIR_t *_wopendir(const wchar_t*);
1673 
1701 
1731 
1766 int _wreaddir_cb(wchar_t*, long, wdir_cb, void*);
1767 
1780 #define wreaddir_cb_opt(opt,val) ((opt) | (1L << (val)))
1781 
1804 void _wrewinddir(WDIR_t*);
1805 
1832 void _wseekdir(WDIR_t*, long int);
1833 
1856 long int _wtelldir(WDIR_t*);
1857 
1873 int wmkstemp(wchar_t *);
1874 
1875 
1879 /* declaration from stdlib.h */
1880 #pragma GCC diagnostic push
1881 #pragma GCC diagnostic ignored "-Wredundant-decls"
1882 void free(void*);
1883 #pragma GCC diagnostic pop
1884 
1888 static inline void __attribute__((always_inline)) __wsfree(void *v)
1889 {
1890  if (v)
1891  {
1892  void *x = *(void**)v;
1893  if (x)
1894  {
1895  free(x);
1896  // cppcheck-suppress unreadVariable
1897  x = ((void*)0);
1898  }
1899  }
1900 }
1901 
1902 #ifdef __cplusplus
1903 }
1904 #endif
1905 
1910 #if defined(__clang__)
1911 # pragma clang diagnostic ignored "-Wlanguage-extension-token"
1912 #endif
1913 
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
1926 
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(...)
1931 
1932 # define _wfopen_macro(...) \
1933  __WEV(EV_FOPEN_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1934 
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(...)
1939 
1940 # define _wmkdir_macro(...) \
1941  __WEV(EV_MKDIR_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1942 
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(...)
1946 
1947 # define _wremove_macro(...) \
1948  __WEV(EV_REMOVE_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1949 
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(...)
1955 
1956 # define _wrename_macro(...) \
1957  __WEV(EV_RENAME_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1958 
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(...)
1963 
1964 # define _wstat_macro(...) \
1965  __WEV(EV_STAT_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1966 
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(...)
1971 
1972 # define _waccess_macro(...) \
1973  __WEV(EV_ACCESS_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1974 
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(...)
1978 
1979 # define _wbasename_macro(...) \
1980  __WEV(EV_BNAME_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1981 
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(...)
1985 
1986 # define _wbaseext_macro(...) \
1987  __WEV(EV_BEXT_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1988 
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(...)
1993 
1994 # define _wbasedir_macro(...) \
1995  __WEV(EV_BDIR_ARG_, __WEVFA(__VA_ARGS__))(__VA_ARGS__)
1996 
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; \
2012  } \
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'; \
2016  }
2017 
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; \
2030  } \
2031  __WEV(A,__LINE__)[(C)] = '\0'
2032 
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; \
2046  } \
2047  __WEV(A,__LINE__)[__WEV(sz,__LINE__)] = '\0'
2048 
2056 #if defined(vsnprintf)
2057 # undef vsnprintf
2058 #endif
2059 
2060 #if defined(snprintf)
2061 # undef snprintf
2062 #endif
2063 
2064 #if defined(vsnprintf)
2065 # undef vsnprintf
2066 #endif
2067 
2068 #if defined(snprintf)
2069 # undef snprintf
2070 #endif
2071 
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
2082 # else
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)
2093 # endif
2094 #endif
2095 
2098 #define wmkdir _wmkdir_macro
2099 #define wmkdir_w _wmkdir
2100 #define wmkdir_s _wmkdir_s
2101 #define wmkdir_ws _wmkdir_ws
2102 
2103 #define wremove _wremove_macro
2104 #define wremove_w _wremove
2105 #define wremove_s _wremove_s
2106 #define wremove_ws _wremove_ws
2107 
2108 #define wrename _wrename_macro
2109 #define wrename_w _wrename
2110 #define wrename_s _wrename_s
2111 #define wrename_ws _wrename_ws
2112 
2113 #define wstat _wstat_macro
2114 #define wstat_w _wstat
2115 #define wstat_s _wstat_s
2116 #define wstat_ws _wstat_ws
2117 
2118 #define wfopen _wfopen_macro
2119 #define wfopen_w _wfopen
2120 #define wfopen_s _wfopen_s
2121 #define wfopen_ws _wfopen_ws
2122 
2123 #define waccess _waccess_macro
2124 #define waccess_w _waccess
2125 #define waccess_s _waccess_s
2126 #define waccess_ws _waccess_ws
2127 
2128 #define wbasename _wbasename_macro
2129 #define wbasename_w _wbasename
2130 #define wbasename_ws _wbasename_ws
2131 
2132 #define wbaseext _wbaseext_macro
2133 #define wbaseext_w _wbaseext
2134 #define wbaseext_ws _wbaseext_ws
2135 
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
2141 
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
2155 
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
2169 
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
2178 
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
2186 
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
2200 
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
2210 
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
2253 
2256 #endif
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 &#39;stdout&#39;.
int _iswctype(wchar_t, wctype_t)
Extensible wide-character test, wide-character classification.