2015-02-11 20:32:09 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include "../utf.h"
|
|
|
|
|
2020-04-07 08:25:22 +00:00
|
|
|
size_t
|
2015-02-11 20:32:09 +00:00
|
|
|
utftorunestr(const char *str, Rune *r)
|
|
|
|
{
|
2020-04-15 16:46:39 +00:00
|
|
|
size_t i;
|
|
|
|
int n;
|
2015-02-11 20:32:09 +00:00
|
|
|
|
2020-04-07 08:25:22 +00:00
|
|
|
for (i = 0; (n = chartorune(&r[i], str)) && r[i]; i++)
|
2015-02-11 20:32:09 +00:00
|
|
|
str += n;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
2020-04-15 16:46:39 +00:00
|
|
|
|
|
|
|
size_t
|
|
|
|
utfntorunestr(const char *str, size_t len, Rune *r)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
int n;
|
|
|
|
const char *end = str + len;
|
|
|
|
|
|
|
|
for (i = 0; (n = charntorune(&r[i], str, end - str)); i++)
|
|
|
|
str += n;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|