diff options
Diffstat (limited to 'sys/libutf/runetype-14.0.0.c')
-rw-r--r-- | sys/libutf/runetype-14.0.0.c | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/sys/libutf/runetype-14.0.0.c b/sys/libutf/runetype-14.0.0.c new file mode 100644 index 0000000..6f4469d --- /dev/null +++ b/sys/libutf/runetype-14.0.0.c @@ -0,0 +1,111 @@ +#include <u.h> +#include <libutf.h> + +static +rune* +rangesearch(rune c, rune *t, int n, int ne) +{ + rune *p; + int m; + while(n > 1) { + m = n >> 1; + p = t + m*ne; + if(c >= p[0]){ + t = p; + n = n-m; + }else + n = m; + } + if(n && c >= t[0]) + return t; + return 0; +} + +static rune isspace_range[] = { + 0x0009, 0x000d, + 0x0085, 0x0085, +}; + +int +utf8·isspace(rune c) +{ + rune *p; + + p = rangesearch(c, isspace_range, arrlen(isspace_range)/2, 2); + if(p && c >= p[0] && c <= p[1]) + return 1; + return 0; +} + +int +utf8·isdigit(rune c) +{ + rune *p; + + return 0; +} + +int +utf8·isalpha(rune c) +{ + rune *p; + + return 0; +} + +int +utf8·isupper(rune c) +{ + rune *p; + + return 0; +} + +int +utf8·islower(rune c) +{ + rune *p; + + return 0; +} + +int +utf8·istitle(rune c) +{ + rune *p; + + return 0; +} + +int +utf8·ispunct(rune c) +{ + rune *p; + + return 0; +} + +rune +utf8·toupper(rune c) +{ + rune *p; + + return c; +} + +rune +utf8·tolower(rune c) +{ + rune *p; + + return c; +} + +rune +utf8·totitle(rune c) +{ + rune *p; + + return c; +} + |