3 const char *restrict s,
5 mbstate_t *restrict ps);
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
16 #include <_PDCLIB_encoding.h>
17 #include <_PDCLIB_locale.h>
20 wchar_t *restrict pwc,
21 const char *restrict s,
23 mbstate_t *restrict ps,
34 if(ps->_PendState == _PendPrefix) {
35 res = _PDCLIB_mbrtocwc_l(pwc, &ps->_PendChar, 1, ps, l);
38 // Converted the NUL character
39 ps->_PendState = _PendClear;
43 // Successful conversion
48 // Illegal sequence. mbrtocwc has already set errno.
52 assert(!"Codec had buffered two characters");
57 // Incomplete character, continue
63 res = _PDCLIB_mbrtocwc_l(pwc, s, n, ps, l);
66 // Converted entirely from internal state
68 ps->_PendState = _PendPrefix;
76 wchar_t *restrict pwc,
77 const char *restrict s,
79 mbstate_t *restrict ps
83 return mbrtowc_l(pwc, s, n, ps ? ps : &st, _PDCLIB_threadlocale());
89 #include <_PDCLIB_test.h>
93 TESTCASE( NO_TESTDRIVER );