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
21
34
40
48
53
55
58
59 // wctype.h
79# ifndef __VSF_APPLET__
81# endif
82#endif
83
84#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_LIBC_WCHAR_LIB__))\
85 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_LIBC_WCHAR == ENABLED
86
87#ifndef VSF_LINUX_APPLET_LIBC_WCHAR_VPLT
88# if VSF_LINUX_USE_APPLET == ENABLED
89# define VSF_LINUX_APPLET_LIBC_WCHAR_VPLT \
90 ((vsf_linux_libc_wchar_vplt_t *)(VSF_LINUX_APPLET_VPLT->libc_wchar_vplt))
91# else
92# define VSF_LINUX_APPLET_LIBC_WCHAR_VPLT \
93 ((vsf_linux_libc_wchar_vplt_t *)vsf_vplt((void *)0))
94# endif
95#endif
96
97#define VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(__NAME) \
98 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_LIBC_WCHAR_VPLT, __NAME)
99#define VSF_LINUX_APPLET_LIBC_WCHAR_IMP(...) \
100 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_LIBC_WCHAR_VPLT, __VA_ARGS__)
101
102VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcslen, size_t, const wchar_t *str) {
104 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcslen)(str);
105}
106VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscat, wchar_t *, wchar_t *dest, const wchar_t *src) {
108 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscat)(dest, src);
109}
110VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncat, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
112 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncat)(dest, src, n);
113}
114VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcschr, _CONST_RETURN wchar_t *, const wchar_t *str, wchar_t c) {
116 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcschr)(str, c);
117}
118VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsrchr, _CONST_RETURN wchar_t *, const wchar_t *str, wchar_t c) {
120 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsrchr)(str, c);
121}
122VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscmp, int, const wchar_t *str1, const wchar_t *str2) {
124 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscmp)(str1, str2);
125}
126VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncmp, int, const wchar_t *str1, const wchar_t *str2, size_t n) {
128 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncmp)(str1, str2, n);
129}
130VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscoll, int, const wchar_t *str1, const wchar_t *str2) {
132 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscoll)(str1, str2);
133}
134VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscpy, wchar_t *, wchar_t *dest, const wchar_t *src) {
136 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscpy)(dest, src);
137}
138VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsncpy, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
140 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsncpy)(dest, src, n);
141}
142VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsstr, _CONST_RETURN wchar_t *, const wchar_t *str1, const wchar_t *str2) {
144 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsstr)(str1, str2);
145}
146VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstok, wchar_t *, wchar_t *str, const wchar_t *delim) {
148 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstok)(str, delim);
149}
150
151VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemset, wchar_t *, wchar_t *dest, wchar_t c, size_t n) {
153 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemset)(dest, c, n);
154}
155VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemchr, wchar_t *, const wchar_t *str, wchar_t c, size_t n) {
157 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemchr)(str, c, n);
158}
159VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemcmp, int, const wchar_t *str1, const wchar_t *str2, size_t n) {
161 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemcmp)(str1, str2, n);
162}
163VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemcpy, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
165 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemcpy)(dest, src, n);
166}
167VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wmemmove, wchar_t *, wchar_t *dest, const wchar_t *src, size_t n) {
169 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wmemmove)(dest, src, n);
170}
171
172VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstol, long, const wchar_t *str, wchar_t **ptr, int base) {
174 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstol)(str, ptr, base);
175}
176VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstof, float, const wchar_t *str, wchar_t **ptr) {
178 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstof)(str, ptr);
179}
180VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstod, double, const wchar_t *str, wchar_t **ptr) {
182 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstod)(str, ptr);
183}
184VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstold, long double, const wchar_t *str, wchar_t **ptr) {
186 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstold)(str, ptr);
187}
188VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoll, long long, const wchar_t *str, wchar_t **ptr, int base) {
190 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoll)(str, ptr, base);
191}
192VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoull, unsigned long long, const wchar_t *str, wchar_t **ptr, int base) {
194 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoull)(str, ptr, base);
195}
196VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcstoul, unsigned long, const wchar_t *str, wchar_t **ptr, int base) {
198 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcstoul)(str, ptr, base);
199}
200
201VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcspbrk, wchar_t *, wchar_t *str, const wchar_t *charset) {
203 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcspbrk)(str, charset);
204}
205VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsspn, size_t, const wchar_t *str, const wchar_t *charset) {
207 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsspn)(str, charset);
208}
209VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcscspn, size_t, const wchar_t *str, const wchar_t *charset) {
211 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcscspn)(str, charset);
212}
213VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsxfrm, size_t, wchar_t *dest, const wchar_t *src, size_t n) {
215 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsxfrm)(dest, src, n);
216}
217
218VSF_LINUX_APPLET_LIBC_WCHAR_IMP(wcsftime, size_t, wchar_t *dest, size_t n, const wchar_t *format, const struct tm *timeptr) {
220 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(wcsftime)(dest, n, format, timeptr);
221}
222
223VSF_LINUX_APPLET_LIBC_WCHAR_IMP(vswprintf, int, wchar_t *str, size_t n, const wchar_t *format, va_list ap) {
225 return VSF_LINUX_APPLET_LIBC_WCHAR_ENTRY(vswprintf)(str, n, format, ap);
226}
227VSF_APPLET_VPLT_FUNC_DECORATOR(swprintf) int swprintf(wchar_t *str, size_t n, const wchar_t *format, ...) {
228 int real_size;
229 va_list ap;
230 va_start(ap, format);
231 real_size = vswprintf(str, len, format, ap);
232 va_end(ap);
233 return real_size;
234}
235#endif
236
237#ifndef WEOF
238# define WEOF ((wint_t)-1)
239#endif
240
241#ifdef __WIN__
242# ifdef __cplusplus
243# define _CONST_RETURN const
244# else
245# define _CONST_RETURN
246# endif
247#else
248# define _CONST_RETURN
249
250# if !__IS_COMPILER_IAR__
251// mbstate_t is defined in uchar.h in IAR
252typedef struct {
253 unsigned long wc;
254 unsigned short byte, state;
255} mbstate_t;
256# endif
257#endif
258
259#define getwc_unlocked getwc
260#define getwchar_unlocked getwchar
261#define fgetwc_unlocked fgetwc
262#define fputwc_unlocked fputwc
263#define putwc_unlocked putwc
264#define putwchar_unlocked putwchar
265#define fgetws_unlocked fgetws
266#define fputws_unlocked fputws
267
268#ifdef __WIN__
269typedef struct _Mbstatet _Mbstatet;
270typedef _Mbstatet mbstate_t;
271#endif
272
273int mbsinit(const mbstate_t *ps);
274size_t mbrlen(const char *str, size_t n, mbstate_t *ps);
275size_t mbrtowc(wchar_t *pwc, const char *str, size_t n, mbstate_t *ps);
276size_t mbsrtowcs(wchar_t *dst, const char **src, size_t n, mbstate_t *ps);
277size_t wcrtomb(char *str, wchar_t wc, mbstate_t *ps);
278size_t wcsrtombs(char *mbstr, const wchar_t **wcstr, size_t n, mbstate_t *ps);
279int wctob(wint_t wchar);
280
282
284wint_t putwchar(wchar_t c);
285wint_t putwc(wchar_t c, FILE *f);
286wint_t fputwc(wchar_t c, FILE *f);
290wchar_t * fgetws(wchar_t *str, int n, FILE *f);
291int fputws(const wchar_t *str, FILE *f);
292int fwide(FILE *f, int mode);
293
294int wprintf(const wchar_t *format, ...);
295int wscanf(const wchar_t *format, ...);
296int vwprintf(const wchar_t *format, va_list ap);
297int vwscanf(const wchar_t *format, va_list ap);
298int fwscanf(FILE *f, const wchar_t *format, ...);
299int fwprintf(FILE *f, const wchar_t *format, ...);
300int vfwprintf(FILE *f, const wchar_t *format, va_list ap);
301int vfwscanf(FILE *f, const wchar_t *format, va_list ap);
302
303int swscanf(const wchar_t *str, const wchar_t *format, ...);
304int vswscanf(const wchar_t *str, const wchar_t *format, va_list ap);
305int swprintf(wchar_t *str, size_t n, const wchar_t *format, ...);
306int vswprintf(wchar_t *str, size_t n, const wchar_t *format, va_list ap);
307
308size_t wcslen(const wchar_t *str);
309wchar_t * wcscat(wchar_t *dest, const wchar_t *src);
310wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t n);
311_CONST_RETURN wchar_t * wcschr(const wchar_t *str, wchar_t c);
312_CONST_RETURN wchar_t * wcsrchr(const wchar_t *str, wchar_t c);
313int wcscmp(const wchar_t *str1, const wchar_t *str2);
314int wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n);
315int wcscoll(const wchar_t *str1, const wchar_t *str2);
316wchar_t * wcscpy(wchar_t *dest, const wchar_t *src);
317wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n);
318_CONST_RETURN wchar_t * wcsstr(const wchar_t *str1, const wchar_t *str2);
319wchar_t * wcstok(wchar_t *str, const wchar_t *delim);
320
321wchar_t * wmemset(wchar_t *dest, wchar_t c, size_t n);
322wchar_t * wmemchr(const wchar_t *str, wchar_t c, size_t n);
323int wmemcmp(const wchar_t *str1, const wchar_t *str2, size_t n);
324wchar_t * wmemcpy(wchar_t *dest, const wchar_t *src, size_t n);
325wchar_t * wmemmove(wchar_t *dest, const wchar_t *src, size_t n);
326
327long wcstol(const wchar_t *str, wchar_t **ptr, int base);
328float wcstof(const wchar_t *str, wchar_t **ptr);
329double wcstod(const wchar_t *str, wchar_t **ptr);
330long double wcstold(const wchar_t *str, wchar_t **ptr);
331long long wcstoll(const wchar_t *str, wchar_t **ptr, int base);
332unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base);
333unsigned long wcstoul(const wchar_t *str, wchar_t **ptr, int base);
334
335wchar_t * wcspbrk(wchar_t *str, const wchar_t *charset);
336size_t wcsspn(const wchar_t *str, const wchar_t *charset);
337size_t wcscspn(const wchar_t *str, const wchar_t *charset);
338size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n);
339
340size_t wcsftime(wchar_t *dest, size_t n, const wchar_t *format, const struct tm *timeptr);
341
342#ifdef __cplusplus
343}
344#endif
345
346#endif
unsigned short wint_t
Definition stddef.h:49
Definition stdio.h:145
Definition wchar.h:252
unsigned long wc
Definition wchar.h:253
unsigned short byte
Definition wchar.h:254
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_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:261
int swprintf(wchar_t *str, size_t n, const wchar_t *format,...)
Definition simple_swprintf.c:731
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)
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)
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:248
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)
wchar_t * wmemcpy(wchar_t *dest, const wchar_t *src, size_t n)
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)
_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@2b286be