2015-02-11 15:32:09 -05:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include "../utf.h"
|
|
|
|
|
2020-04-07 04:25:22 -04:00
|
|
|
size_t
|
2015-02-11 15:32:09 -05:00
|
|
|
utftorunestr(const char *str, Rune *r)
|
|
|
|
{
|
2020-04-15 12:46:39 -04:00
|
|
|
size_t i;
|
|
|
|
int n;
|
2015-02-11 15:32:09 -05:00
|
|
|
|
2020-04-07 04:25:22 -04:00
|
|
|
for (i = 0; (n = chartorune(&r[i], str)) && r[i]; i++)
|
2015-02-11 15:32:09 -05:00
|
|
|
str += n;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
2020-04-15 12:46:39 -04: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;
|
|
|
|
}
|