14 cvttorunes(char *p, int n, Rune *r, int *nb, int *nr, int *nulls)
21 * Always guaranteed that n bytes may be interpreted
22 * without worrying about partial runes. This may mean
23 * reading up to UTFmax-1 more bytes than n; the caller
24 * knows this. If n is a firm limit, the caller should
34 w = chartorune(s, (char*)q);
49 fprint(2, "rio: %s: %r\n", s);
52 threadexitsall("error");
56 erealloc(void *p, uint n)
60 error("realloc failed");
71 error("malloc failed");
81 p = malloc(strlen(s)+1);
83 error("strdup failed");
92 * Hard to get absolutely right. Use what we know about ASCII
93 * and assume anything above the Latin control characters is
94 * potentially an alphanumeric.
98 if(0x7F<=c && c<=0xA0)
100 if(utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", c))
106 strrune(Rune *s, Rune c)
139 runetobyte(Rune *r, int n, int *ip)
144 s = emalloc(n*UTFmax+1);
145 m = snprint(s, n*UTFmax+1, "%.*S", n, r);