summaryrefslogtreecommitdiff
path: root/src/stdlib/mblen.c
blob: 57f6479030fdd32a2028053bf0ab8898bd8045ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdlib.h>
#include "_stdlib.h"

/** count bytes in multibyte character **/

int mblen(const char * s, size_t n)
{
	SIGNAL_SAFE(0);
	ASSERT_CTYPE(s);

	/* FIXME: forward dependency on AMD1 */
	#if 0
	mbstate_t ps = 0;
	return mbrlen(s, n, &ps);
	#else
	(void)s; (void)n;
	return 0;
	#endif
}

/***
counts the number of bytes in the multibyte character
starting at ARGUMENT(s), if the next ARGUMENT(n) or fewer bytes contain a full multibyte
character.

If ARGUMENT(s) is CONSTANT(NULL), THIS() tests whether multibyte encodings carry
state dependency.
***/

/*
LC_CTYPE
RETURN(0, If ARGUMENT(s) is CONSTANT(NULL), multibyte encodings do not have state dependencies);
RETURN(NZ, 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 multibyte character);
STDC(1)
*/