This source file includes following definitions.
- for_character
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <config.h>
18
19 #include <uchar.h>
20
21 #include "signature.h"
22 SIGNATURE_CHECK (c32isblank, int, (wint_t));
23
24 #include <locale.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <wchar.h>
28
29 #include "macros.h"
30
31
32 static int
33 for_character (const char *s, size_t n)
34 {
35 mbstate_t state;
36 char32_t wc;
37 size_t ret;
38
39 memset (&state, '\0', sizeof (mbstate_t));
40 wc = (char32_t) 0xBADFACE;
41 ret = mbrtoc32 (&wc, s, n, &state);
42 ASSERT (ret == n);
43
44 return c32isblank (wc);
45 }
46
47 int
48 main (int argc, char *argv[])
49 {
50 int is;
51 char buf[4];
52
53
54 if (setlocale (LC_ALL, "") == NULL)
55 return 1;
56
57
58 is = c32isblank (WEOF);
59 ASSERT (is == 0);
60
61
62
63
64
65
66
67
68
69
70 {
71 int c;
72
73 for (c = 0; c < 0x100; c++)
74 switch (c)
75 {
76 case '\t':
77 #if !(defined __FreeBSD__ || defined __NetBSD__)
78 case '\v':
79 #endif
80 case '\f':
81 case ' ': case '!': case '"': case '#': case '%':
82 case '&': case '\'': case '(': case ')': case '*':
83 case '+': case ',': case '-': case '.': case '/':
84 case '0': case '1': case '2': case '3': case '4':
85 case '5': case '6': case '7': case '8': case '9':
86 case ':': case ';': case '<': case '=': case '>':
87 case '?':
88 case 'A': case 'B': case 'C': case 'D': case 'E':
89 case 'F': case 'G': case 'H': case 'I': case 'J':
90 case 'K': case 'L': case 'M': case 'N': case 'O':
91 case 'P': case 'Q': case 'R': case 'S': case 'T':
92 case 'U': case 'V': case 'W': case 'X': case 'Y':
93 case 'Z':
94 case '[': case '\\': case ']': case '^': case '_':
95 case 'a': case 'b': case 'c': case 'd': case 'e':
96 case 'f': case 'g': case 'h': case 'i': case 'j':
97 case 'k': case 'l': case 'm': case 'n': case 'o':
98 case 'p': case 'q': case 'r': case 's': case 't':
99 case 'u': case 'v': case 'w': case 'x': case 'y':
100 case 'z': case '{': case '|': case '}': case '~':
101
102 buf[0] = (unsigned char) c;
103 is = for_character (buf, 1);
104 if (c == '\t' || c == ' ')
105 ASSERT (is != 0);
106 else
107 ASSERT (is == 0);
108 break;
109 }
110 }
111
112 if (argc > 1)
113 switch (argv[1][0])
114 {
115 case '0':
116
117 return 0;
118
119 case '1':
120
121 {
122 #if defined __GLIBC__
123
124 is = for_character ("\240", 1);
125 ASSERT (is == 0);
126 #endif
127
128 is = for_character ("\267", 1);
129 ASSERT (is == 0);
130 }
131 return 0;
132
133 case '2':
134
135 {
136
137 is = for_character ("\241\243", 2);
138 ASSERT (is == 0);
139 }
140 return 0;
141
142 case '3':
143
144 {
145 #if defined __GLIBC__
146
147 is = for_character ("\302\240", 2);
148 ASSERT (is == 0);
149 #endif
150
151 is = for_character ("\302\267", 2);
152 ASSERT (is == 0);
153 #if defined __GLIBC__
154
155 is = for_character ("\342\200\257", 3);
156 ASSERT (is == 0);
157 #endif
158
159 is = for_character ("\343\200\202", 3);
160 ASSERT (is == 0);
161
162 is = for_character ("\360\235\204\275", 4);
163 ASSERT (is == 0);
164
165 is = for_character ("\363\240\200\240", 4);
166 ASSERT (is == 0);
167 }
168 return 0;
169
170 case '4':
171
172 {
173 #if defined __GLIBC__
174
175 is = for_character ("\201\060\204\062", 4);
176 ASSERT (is == 0);
177 #endif
178
179 is = for_character ("\241\244", 2);
180 ASSERT (is == 0);
181 #if defined __GLIBC__
182
183 is = for_character ("\201\066\247\062", 4);
184 ASSERT (is == 0);
185 #endif
186
187 is = for_character ("\241\243", 2);
188 ASSERT (is == 0);
189
190 is = for_character ("\224\062\301\065", 4);
191 ASSERT (is == 0);
192
193 is = for_character ("\323\066\231\060", 4);
194 ASSERT (is == 0);
195 }
196 return 0;
197
198 }
199
200 return 1;
201 }