VSF Documented
wchar.h
Go to the documentation of this file.
1#ifndef __SIMPLE_LIBC_WCHAR_H__
2#define __SIMPLE_LIBC_WCHAR_H__
3
5
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# include "./stdio.h"
8# include "./time.h"
9#else
10# include <stdio.h>
11# include <time.h>
12#endif
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#if VSF_LINUX_APPLET_USE_LIBC_WCHAR == ENABLED
22
35
41
49
54
56
59
60 // wctype.h
80# ifndef __VSF_APPLET__
82# endif
83#endif
84
85#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_LIBC_WCHAR_LIB__))\
86 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_LIBC_WCHAR == ENABLED
87
88#ifndef VSF_LINUX_APPLET_LIBC_WCHAR_VPLT
89# if VSF_LINUX_USE_APPLET == ENABLED
90# define VSF_LINUX_APPLET_LIBC_WCHAR_VPLT \
91 ((vsf_linux_libc_wchar_vplt_t *)(VSF_LINUX_APPLET_VPLT->libc_wchar_vplt))
92# else
93# define VSF_LINUX_APPLET_LIBC_WCHAR_VPLT \
94 ((vsf_linux_libc_wchar_vplt_t *)vsf_vplt((void *)0))
95# endif
96#endif
97
98#define VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(__NAME) \
99 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_LIBC_WCHAR_VPLT, __NAME)
100#define VSF_LINUX_APPLET_LIBC_WCHAR_IMP(...) \
101 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_LIBC_WCHAR_VPLT, __VA_ARGS__)
102
103VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcslen, size_t, const wchar_t *str) {
105 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcslen)(str);
106}
107VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscat, wchar_t *, wchar_t *dest, const wchar_t *src) {
109 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscat)(dest, src);
110}
111VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncat, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
113 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncat)(dest, src, n);
114}
115VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcschr, _CONST_RETURN wchar_t *, const wchar_t *str, wchar_t c) {
117 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcschr)(str, c);
118}
119VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsrchr, _CONST_RETURN wchar_t *, const wchar_t *str, wchar_t c) {
121 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsrchr)(str, c);
122}
123VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscmp, int, const wchar_t *str1, const wchar_t *str2) {
125 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscmp)(str1, str2);
126}
127VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncmp, int, const wchar_t *str1, const wchar_t *str2, size_t n) {
129 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncmp)(str1, str2, n);
130}
131VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscoll, int, const wchar_t *str1, const wchar_t *str2) {
133 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscoll)(str1, str2);
134}
135VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscpy, wchar_t *, wchar_t *dest, const wchar_t *src) {
137 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscpy)(dest, src);
138}
139VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncpy, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
141 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncpy)(dest, src, n);
142}
143VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsstr, _CONST_RETURN wchar_t *, const wchar_t *str1, const wchar_t *str2) {
145 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsstr)(str1, str2);
146}
147VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstok, wchar_t *, wchar_t *str, const wchar_t *delim) {
149 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstok)(str, delim);
150}
151
152VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemset, wchar_t *, wchar_t *dest, wchar_t c, size_t n) {
154 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemset)(dest, c, n);
155}
156VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemchr, wchar_t *, const wchar_t *str, wchar_t c, size_t n) {
158 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemchr)(str, c, n);
159}
160VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemcmp, int, const wchar_t *str1, const wchar_t *str2, size_t n) {
162 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemcmp)(str1, str2, n);
163}
164VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemcpy, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
166 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemcpy)(dest, src, n);
167}
168VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemmove, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
170 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemmove)(dest, src, n);
171}
172
173VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstol, long, const wchar_t *str, wchar_t **ptr, int base) {
175 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstol)(str, ptr, base);
176}
177VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstof, float, const wchar_t *str, wchar_t **ptr) {
179 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstof)(str, ptr);
180}
181VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstod, double, const wchar_t *str, wchar_t **ptr) {
183 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstod)(str, ptr);
184}
185VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstold, long double, const wchar_t *str, wchar_t **ptr) {
187 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstold)(str, ptr);
188}
189VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoll, long long, const wchar_t *str, wchar_t **ptr, int base) {
191 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoll)(str, ptr, base);
192}
193VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoull, unsigned long long, const wchar_t *str, wchar_t **ptr, int base) {
195 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoull)(str, ptr, base);
196}
197VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoul, unsigned long, const wchar_t *str, wchar_t **ptr, int base) {
199 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoul)(str, ptr, base);
200}
201
202VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcspbrk, wchar_t *, wchar_t *str, const wchar_t *charset) {
204 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcspbrk)(str, charset);
205}
206VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsspn, size_t, const wchar_t *str, const wchar_t *charset) {
208 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsspn)(str, charset);
209}
210VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscspn, size_t, const wchar_t *str, const wchar_t *charset) {
212 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscspn)(str, charset);
213}
214VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsxfrm, size_t, wchar_t *dest, const wchar_t *src, size_t n) {
216 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsxfrm)(dest, src, n);
217}
218
219VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsftime, size_t, wchar_t *dest, size_t n, const wchar_t *format, const struct tm *timeptr) {
221 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsftime)(dest, n, format, timeptr);
222}
223
224VSF_LINUX_APPLET_LIBC_WCHAR_IMP(vswprintf, int, wchar_t *str, size_t n, const wchar_t *format, va_list ap) {
226 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(vswprintf)(str, n, format, ap);
227}
228VSF_APPLET_VPLT_FUNC_DECORATOR(swprintf) int swprintf(wchar_t *str, size_t n, const wchar_t *format, ...) {
229 int real_size;
230 va_list ap;
231 va_start(ap, format);
232 real_size = vswprintf(str, len, format, ap);
233 va_end(ap);
234 return real_size;
235}
236#endif
237
238#ifndef WEOF
239# define WEOF ((wint_t)-1)
240#endif
241
242#ifdef __WIN__
243# ifdef __cplusplus
244# define _CONST_RETURN const
245# else
246# define _CONST_RETURN
247# endif
248#else
249# define _CONST_RETURN
250
251# if !__IS_COMPILER_IAR__
252// mbstate_t is defined in uchar.h in IAR
253typedef struct {
254 unsigned long wc;
255 unsigned short byte, state;
256} mbstate_t;
257# endif
258#endif
259
260#define getwc_unlocked getwc
261#define getwchar_unlocked getwchar
262#define fgetwc_unlocked fgetwc
263#define fputwc_unlocked fputwc
264#define putwc_unlocked putwc
265#define putwchar_unlocked putwchar
266#define fgetws_unlocked fgetws
267#define fputws_unlocked fputws
268
269#ifdef __WIN__
270typedef struct _Mbstatet _Mbstatet;
271typedef _Mbstatet mbstate_t;
272#endif
273
274int mbsinit(const mbstate_t *ps);
275size_t mbrlen(const char *str, size_t n, mbstate_t *ps);
276size_t mbrtowc(wchar_t *pwc, const char *str, size_t n, mbstate_t *ps);
277size_t mbsrtowcs(wchar_t *dst, const char **src, size_t n, mbstate_t *ps);
278size_t wcrtomb(char *str, wchar_t wc, mbstate_t *ps);
279size_t wcsrtombs(char *mbstr, const wchar_t **wcstr, size_t n, mbstate_t *ps);
280int wctob(wint_t wchar);
281
283
285wint_t putwchar(wchar_t c);
286wint_t putwc(wchar_t c, FILE *f);
287wint_t fputwc(wchar_t c, FILE *f);
291wchar_t * fgetws(wchar_t *str, int n, FILE *f);
292int fputws(const wchar_t *str, FILE *f);
293int fwide(FILE *f, int mode);
294
295int wprintf(const wchar_t *format, ...);
296int wscanf(const wchar_t *format, ...);
297int vwprintf(const wchar_t *format, va_list ap);
298int vwscanf(const wchar_t *format, va_list ap);
299int fwscanf(FILE *f, const wchar_t *format, ...);
300int fwprintf(FILE *f, const wchar_t *format, ...);
301int vfwprintf(FILE *f, const wchar_t *format, va_list ap);
302int vfwscanf(FILE *f, const wchar_t *format, va_list ap);
303
304int swscanf(const wchar_t *str, const wchar_t *format, ...);
305int vswscanf(const wchar_t *str, const wchar_t *format, va_list ap);
306int swprintf(wchar_t *str, size_t n, const wchar_t *format, ...);
307int vswprintf(wchar_t *str, size_t n, const wchar_t *format, va_list ap);
308
309size_t wcslen(const wchar_t *str);
310wchar_t * wcscat(wchar_t *dest, const wchar_t *src);
311wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t n);
312_CONST_RETURN wchar_t * wcschr(const wchar_t *str, wchar_t c);
313_CONST_RETURN wchar_t * wcsrchr(const wchar_t *str, wchar_t c);
314int wcscmp(const wchar_t *str1, const wchar_t *str2);
315int wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n);
316int wcscoll(const wchar_t *str1, const wchar_t *str2);
317wchar_t * wcscpy(wchar_t *dest, const wchar_t *src);
318wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n);
319_CONST_RETURN wchar_t * wcsstr(const wchar_t *str1, const wchar_t *str2);
320wchar_t * wcstok(wchar_t *str, const wchar_t *delim);
321
322wchar_t * wmemset(wchar_t *dest, wchar_t c, size_t n);
323wchar_t * wmemchr(const wchar_t *str, wchar_t c, size_t n);
324int wmemcmp(const wchar_t *str1, const wchar_t *str2, size_t n);
325wchar_t * wmemcpy(wchar_t *dest, const wchar_t *src, size_t n);
326wchar_t * wmemmove(wchar_t *dest, const wchar_t *src, size_t n);
327
328long wcstol(const wchar_t *str, wchar_t **ptr, int base);
329float wcstof(const wchar_t *str, wchar_t **ptr);
330double wcstod(const wchar_t *str, wchar_t **ptr);
331long double wcstold(const wchar_t *str, wchar_t **ptr);
332long long wcstoll(const wchar_t *str, wchar_t **ptr, int base);
333unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base);
334unsigned long wcstoul(const wchar_t *str, wchar_t **ptr, int base);
335
336wchar_t * wcspbrk(wchar_t *str, const wchar_t *charset);
337size_t wcsspn(const wchar_t *str, const wchar_t *charset);
338size_t wcscspn(const wchar_t *str, const wchar_t *charset);
339size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n);
340
341size_t wcsftime(wchar_t *dest, size_t n, const wchar_t *format, const struct tm *timeptr);
342
343#ifdef __cplusplus
344}
345#endif
346
347#endif
unsigned short wint_t
Definition stddef.h:49
Definition stdio.h:145
Definition wchar.h:253
unsigned long wc
Definition wchar.h:254
unsigned short byte
Definition wchar.h:255
Definition time.h:53
Definition wchar.h:19
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(swprintf)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswxdigit)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(wcsftime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswalnum)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswdigit)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswspace)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(vswprintf)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswblank)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswgraph)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(towlower)
vsf_vplt_info_t info
Definition wchar.h:20
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(towupper)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswlower)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(towctrans)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswpunct)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(wmemmove)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswupper)
VSF_APPLET_VPLT_ENTRY_MOD_DEF(libc_wchar)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(wcstoull)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswprint)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswctype)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswcntrl)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(iswalpha)
Definition vsf_cfg.h:95
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165
#define VSF_APPLET_VPLT_FUNC_DECORATOR(__NAME)
Definition vsf_linux_applet_lib.c:1
uint8_t state
Definition vsf_msg_tree.h:247
SDL_PixelFormat format
Definition vsf_sdl2_pixelformat.c:32
_CONST_RETURN wchar_t * wcsstr(const wchar_t *str1, const wchar_t *str2)
size_t wcsftime(wchar_t *dest, size_t n, const wchar_t *format, const struct tm *timeptr)
long long wcstoll(const wchar_t *str, wchar_t **ptr, int base)
__VSF_VPLT_DECORATOR__ vsf_linux_libc_wchar_vplt_t vsf_linux_libc_wchar_vplt
Definition vsf_linux_glibc.c:367
int swprintf(wchar_t *str, size_t n, const wchar_t *format,...)
Definition simple_swprintf.c:738
struct vsf_linux_libc_wchar_vplt_t vsf_linux_libc_wchar_vplt_t
wint_t fgetwc(FILE *f)
unsigned long wcstoul(const wchar_t *str, wchar_t **ptr, int base)
wint_t getwc(FILE *f)
size_t wcrtomb(char *str, wchar_t wc, mbstate_t *ps)
wint_t ungetwc(wint_t c, FILE *f)
int vfwscanf(FILE *f, const wchar_t *format, va_list ap)
int wscanf(const wchar_t *format,...)
wint_t btowc(int c)
size_t wcscspn(const wchar_t *str, const wchar_t *charset)
wchar_t * wmemmove(wchar_t *dest, const wchar_t *src, size_t n)
Definition vsf_linux_glibc.c:353
int wctob(wint_t wchar)
wchar_t * wcscat(wchar_t *dest, const wchar_t *src)
size_t mbrlen(const char *str, size_t n, mbstate_t *ps)
long double wcstold(const wchar_t *str, wchar_t **ptr)
size_t wcsrtombs(char *mbstr, const wchar_t **wcstr, size_t n, mbstate_t *ps)
long wcstol(const wchar_t *str, wchar_t **ptr, int base)
int fputws(const wchar_t *str, FILE *f)
int wcscoll(const wchar_t *str1, const wchar_t *str2)
int wmemcmp(const wchar_t *str1, const wchar_t *str2, size_t n)
Definition vsf_linux_glibc.c:333
int wcscmp(const wchar_t *str1, const wchar_t *str2)
size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n)
size_t mbrtowc(wchar_t *pwc, const char *str, size_t n, mbstate_t *ps)
wchar_t * wcscpy(wchar_t *dest, const wchar_t *src)
size_t mbsrtowcs(wchar_t *dst, const char **src, size_t n, mbstate_t *ps)
wchar_t * wcspbrk(wchar_t *str, const wchar_t *charset)
#define _CONST_RETURN
Definition wchar.h:249
int fwide(FILE *f, int mode)
wchar_t * wcstok(wchar_t *str, const wchar_t *delim)
int wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n)
wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t n)
wchar_t * fgetws(wchar_t *str, int n, FILE *f)
wchar_t * wmemchr(const wchar_t *str, wchar_t c, size_t n)
Definition vsf_linux_glibc.c:322
wchar_t * wmemcpy(wchar_t *dest, const wchar_t *src, size_t n)
Definition vsf_linux_glibc.c:344
int fwprintf(FILE *f, const wchar_t *format,...)
float wcstof(const wchar_t *str, wchar_t **ptr)
wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n)
int vswprintf(wchar_t *str, size_t n, const wchar_t *format, va_list ap)
Definition simple_swprintf.c:155
int vwprintf(const wchar_t *format, va_list ap)
int vfwprintf(FILE *f, const wchar_t *format, va_list ap)
int vwscanf(const wchar_t *format, va_list ap)
int fwscanf(FILE *f, const wchar_t *format,...)
int mbsinit(const mbstate_t *ps)
unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base)
wint_t putwc(wchar_t c, FILE *f)
wchar_t * wmemset(wchar_t *dest, wchar_t c, size_t n)
Definition vsf_linux_glibc.c:313
_CONST_RETURN wchar_t * wcschr(const wchar_t *str, wchar_t c)
int vswscanf(const wchar_t *str, const wchar_t *format, va_list ap)
double wcstod(const wchar_t *str, wchar_t **ptr)
wint_t getwchar()
size_t wcslen(const wchar_t *str)
wint_t fputwc(wchar_t c, FILE *f)
_CONST_RETURN wchar_t * wcsrchr(const wchar_t *str, wchar_t c)
size_t wcsspn(const wchar_t *str, const wchar_t *charset)
int wprintf(const wchar_t *format,...)
wint_t putwchar(wchar_t c)
int swscanf(const wchar_t *str, const wchar_t *format,...)
Generated from commit: vsfteam/vsf@2a137b0