diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-02-08 18:42:39 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-02-08 18:42:39 -0500 |
commit | 7ef8a7379f7f7d09e71ccae2a0b688c3cd80423f (patch) | |
tree | 092ab0aed1769117fd7b28b8592f6f96b0e0d5af /src/stdlib/mbtowc.c | |
parent | 6acf19370e8adff79cd83b257d3f04aeaf2a59dd (diff) |
merge sources into single tree
Diffstat (limited to 'src/stdlib/mbtowc.c')
-rw-r--r-- | src/stdlib/mbtowc.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/stdlib/mbtowc.c b/src/stdlib/mbtowc.c new file mode 100644 index 00000000..3704acd4 --- /dev/null +++ b/src/stdlib/mbtowc.c @@ -0,0 +1,37 @@ +#include <stdlib.h> + +/** convert a multibyte character to a wide character **/ + +int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n) +{ + /* FIXME: forward dependency on AMD1 */ + #if 0 + static mbstate_t ps = 0; + return mbrtowc(pwc, s, n, &ps); + #else + (void)pwc; (void)s; (void)n; + return 0; + #endif +} + +/*** +converts the multibyte character, of no more than ARGUMENT(n) bytes, at +ARGUMENT(s) to a wide character, which is stored at the address pointed to by +ARGUMENT(pwc). + +If ARGUMENT(s) is CONSTANT(NULL), THIS() tests whether multibyte encodings carry +state dependency. + +If ARGUMENT(pwc) is CONSTANT(NULL), THIS() counts the number of bytes in the +multibyte character at ARGUMENT(s). +***/ + +/* +LC_CTYPE +RETURN(0, If ARGUMENT(s) is CONSTANT(NULL), multibyte encodings do not have state dependencies) +RETURN(NONZERO, If ARGUMENT(s) is CONSTANT(NULL), multibyte encodings do have state dependencies) +RETURN(-1, The ARGUMENT(n) bytes at ARGUMENT(s) do not form a valid mutlibyte character) +RETURN(0, ARGUMENT(s) points to a null character) +RETURN(TYPE(int), the number of bytes in the converted multibyte character) +STDC(1) +*/ |