aboutsummaryrefslogtreecommitdiff
path: root/sys/libutf/runetype-14.0.0.c
blob: 6f4469d92a28f6adb58f430404f178f9ca608aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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;
}