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");
61 setrealloctag(p, getcallerpc(&p));
72 error("malloc failed");
73 setmalloctag(p, getcallerpc(&n));
83 p = malloc(strlen(s)+1);
85 error("strdup failed");
86 setmalloctag(p, getcallerpc(&s));
95 * Hard to get absolutely right. Use what we know about ASCII
96 * and assume anything above the Latin control characters is
97 * potentially an alphanumeric.
101 if(0x7F<=c && c<=0xA0)
103 if(utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", c))
109 strrune(Rune *s, Rune c)
142 runetobyte(Rune *r, int n, int *ip)
147 s = emalloc(n*UTFmax+1);
148 m = snprint(s, n*UTFmax+1, "%.*S", n, r);