"Fossies" - the Fresh Open Source Software Archive 
Member "xorriso-1.5.4/libisofs/hfsplus_classes_test.c" (30 Jan 2021, 7822 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "hfsplus_classes_test.c" see the
Fossies "Dox" file reference documentation.
1 /*
2 cc -g -o demo/classes libisofs/hfsplus_classes_test.c
3 */
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdio.h>
7
8 #ifdef HAVE_CONFIG_H
9 #include "../config.h"
10 #endif
11
12 #include "hfsplus.h"
13
14 /* ======== Copy of original class pages : hfsplus_class_pages_old ======== */
15
16 /* Based on Unicode 3.2.0. */
17
18 static uint16_t page03[256] = {
19 [0x00] = 0x230,
20 [0x01] = 0x230,
21 [0x02] = 0x230,
22 [0x03] = 0x230,
23 [0x04] = 0x230,
24 [0x05] = 0x230,
25 [0x06] = 0x230,
26 [0x07] = 0x230,
27 [0x08] = 0x230,
28 [0x09] = 0x230,
29 [0x0a] = 0x230,
30 [0x0b] = 0x230,
31 [0x0c] = 0x230,
32 [0x0d] = 0x230,
33 [0x0e] = 0x230,
34 [0x0f] = 0x230,
35 [0x10] = 0x230,
36 [0x11] = 0x230,
37 [0x12] = 0x230,
38 [0x13] = 0x230,
39 [0x14] = 0x230,
40 [0x15] = 0x232,
41 [0x16] = 0x220,
42 [0x17] = 0x220,
43 [0x18] = 0x220,
44 [0x19] = 0x220,
45 [0x1a] = 0x232,
46 [0x1b] = 0x216,
47 [0x1c] = 0x220,
48 [0x1d] = 0x220,
49 [0x1e] = 0x220,
50 [0x1f] = 0x220,
51 [0x20] = 0x220,
52 [0x21] = 0x202,
53 [0x22] = 0x202,
54 [0x23] = 0x220,
55 [0x24] = 0x220,
56 [0x25] = 0x220,
57 [0x26] = 0x220,
58 [0x27] = 0x202,
59 [0x28] = 0x202,
60 [0x29] = 0x220,
61 [0x2a] = 0x220,
62 [0x2b] = 0x220,
63 [0x2c] = 0x220,
64 [0x2d] = 0x220,
65 [0x2e] = 0x220,
66 [0x2f] = 0x220,
67 [0x30] = 0x220,
68 [0x31] = 0x220,
69 [0x32] = 0x220,
70 [0x33] = 0x220,
71 [0x34] = 0x1,
72 [0x35] = 0x1,
73 [0x36] = 0x1,
74 [0x37] = 0x1,
75 [0x38] = 0x1,
76 [0x39] = 0x220,
77 [0x3a] = 0x220,
78 [0x3b] = 0x220,
79 [0x3c] = 0x220,
80 [0x3d] = 0x230,
81 [0x3e] = 0x230,
82 [0x3f] = 0x230,
83 [0x40] = 0x230,
84 [0x41] = 0x230,
85 [0x42] = 0x230,
86 [0x43] = 0x230,
87 [0x44] = 0x230,
88 [0x45] = 0x240,
89 [0x46] = 0x230,
90 [0x47] = 0x220,
91 [0x48] = 0x220,
92 [0x49] = 0x220,
93 [0x4a] = 0x230,
94 [0x4b] = 0x230,
95 [0x4c] = 0x230,
96 [0x4d] = 0x220,
97 [0x4e] = 0x220,
98 [0x60] = 0x234,
99 [0x61] = 0x234,
100 [0x62] = 0x233,
101 [0x63] = 0x230,
102 [0x64] = 0x230,
103 [0x65] = 0x230,
104 [0x66] = 0x230,
105 [0x67] = 0x230,
106 [0x68] = 0x230,
107 [0x69] = 0x230,
108 [0x6a] = 0x230,
109 [0x6b] = 0x230,
110 [0x6c] = 0x230,
111 [0x6d] = 0x230,
112 [0x6e] = 0x230,
113 [0x6f] = 0x230,
114 };
115
116 static uint16_t page04[256] = {
117 [0x83] = 0x230,
118 [0x84] = 0x230,
119 [0x85] = 0x230,
120 [0x86] = 0x230,
121 };
122
123 static uint16_t page05[256] = {
124 [0x91] = 0x220,
125 [0x92] = 0x230,
126 [0x93] = 0x230,
127 [0x94] = 0x230,
128 [0x95] = 0x230,
129 [0x96] = 0x220,
130 [0x97] = 0x230,
131 [0x98] = 0x230,
132 [0x99] = 0x230,
133 [0x9a] = 0x222,
134 [0x9b] = 0x220,
135 [0x9c] = 0x230,
136 [0x9d] = 0x230,
137 [0x9e] = 0x230,
138 [0x9f] = 0x230,
139 [0xa0] = 0x230,
140 [0xa1] = 0x230,
141 [0xa3] = 0x220,
142 [0xa4] = 0x220,
143 [0xa5] = 0x220,
144 [0xa6] = 0x220,
145 [0xa7] = 0x220,
146 [0xa8] = 0x230,
147 [0xa9] = 0x230,
148 [0xaa] = 0x220,
149 [0xab] = 0x230,
150 [0xac] = 0x230,
151 [0xad] = 0x222,
152 [0xae] = 0x228,
153 [0xaf] = 0x230,
154 [0xb0] = 0x10,
155 [0xb1] = 0x11,
156 [0xb2] = 0x12,
157 [0xb3] = 0x13,
158 [0xb4] = 0x14,
159 [0xb5] = 0x15,
160 [0xb6] = 0x16,
161 [0xb7] = 0x17,
162 [0xb8] = 0x18,
163 [0xb9] = 0x19,
164 [0xbb] = 0x20,
165 [0xbc] = 0x21,
166 [0xbd] = 0x22,
167 [0xbf] = 0x23,
168 [0xc1] = 0x24,
169 [0xc2] = 0x25,
170 [0xc4] = 0x230,
171 };
172
173 static uint16_t page06[256] = {
174 [0x4b] = 0x27,
175 [0x4c] = 0x28,
176 [0x4d] = 0x29,
177 [0x4e] = 0x30,
178 [0x4f] = 0x31,
179 [0x50] = 0x32,
180 [0x51] = 0x33,
181 [0x52] = 0x34,
182 [0x53] = 0x230,
183 [0x54] = 0x230,
184 [0x55] = 0x220,
185 [0x70] = 0x35,
186 [0xd6] = 0x230,
187 [0xd7] = 0x230,
188 [0xd8] = 0x230,
189 [0xd9] = 0x230,
190 [0xda] = 0x230,
191 [0xdb] = 0x230,
192 [0xdc] = 0x230,
193 [0xdf] = 0x230,
194 [0xe0] = 0x230,
195 [0xe1] = 0x230,
196 [0xe2] = 0x230,
197 [0xe3] = 0x220,
198 [0xe4] = 0x230,
199 [0xe7] = 0x230,
200 [0xe8] = 0x230,
201 [0xea] = 0x220,
202 [0xeb] = 0x230,
203 [0xec] = 0x230,
204 [0xed] = 0x220,
205 };
206
207 static uint16_t page07[256] = {
208 [0x11] = 0x36,
209 [0x30] = 0x230,
210 [0x31] = 0x220,
211 [0x32] = 0x230,
212 [0x33] = 0x230,
213 [0x34] = 0x220,
214 [0x35] = 0x230,
215 [0x36] = 0x230,
216 [0x37] = 0x220,
217 [0x38] = 0x220,
218 [0x39] = 0x220,
219 [0x3a] = 0x230,
220 [0x3b] = 0x220,
221 [0x3c] = 0x220,
222 [0x3d] = 0x230,
223 [0x3e] = 0x220,
224 [0x3f] = 0x230,
225 [0x40] = 0x230,
226 [0x41] = 0x230,
227 [0x42] = 0x220,
228 [0x43] = 0x230,
229 [0x44] = 0x220,
230 [0x45] = 0x230,
231 [0x46] = 0x220,
232 [0x47] = 0x230,
233 [0x48] = 0x220,
234 [0x49] = 0x230,
235 [0x4a] = 0x230,
236 };
237
238 static uint16_t page09[256] = {
239 [0x3c] = 0x7,
240 [0x4d] = 0x9,
241 [0x51] = 0x230,
242 [0x52] = 0x220,
243 [0x53] = 0x230,
244 [0x54] = 0x230,
245 [0xbc] = 0x7,
246 [0xcd] = 0x9,
247 };
248
249 static uint16_t page0a[256] = {
250 [0x3c] = 0x7,
251 [0x4d] = 0x9,
252 [0xbc] = 0x7,
253 [0xcd] = 0x9,
254 };
255
256 static uint16_t page0b[256] = {
257 [0x3c] = 0x7,
258 [0x4d] = 0x9,
259 [0xcd] = 0x9,
260 };
261
262 static uint16_t page0c[256] = {
263 [0x4d] = 0x9,
264 [0x55] = 0x84,
265 [0x56] = 0x91,
266 [0xcd] = 0x9,
267 };
268
269 static uint16_t page0d[256] = {
270 [0x4d] = 0x9,
271 [0xca] = 0x9,
272 };
273
274 static uint16_t page0e[256] = {
275 [0x38] = 0x103,
276 [0x39] = 0x103,
277 [0x3a] = 0x9,
278 [0x48] = 0x107,
279 [0x49] = 0x107,
280 [0x4a] = 0x107,
281 [0x4b] = 0x107,
282 [0xb8] = 0x118,
283 [0xb9] = 0x118,
284 [0xc8] = 0x122,
285 [0xc9] = 0x122,
286 [0xca] = 0x122,
287 [0xcb] = 0x122,
288 };
289
290 static uint16_t page0f[256] = {
291 [0x18] = 0x220,
292 [0x19] = 0x220,
293 [0x35] = 0x220,
294 [0x37] = 0x220,
295 [0x39] = 0x216,
296 [0x71] = 0x129,
297 [0x72] = 0x130,
298 [0x74] = 0x132,
299 [0x7a] = 0x130,
300 [0x7b] = 0x130,
301 [0x7c] = 0x130,
302 [0x7d] = 0x130,
303 [0x80] = 0x130,
304 [0x82] = 0x230,
305 [0x83] = 0x230,
306 [0x84] = 0x9,
307 [0x86] = 0x230,
308 [0x87] = 0x230,
309 [0xc6] = 0x220,
310 };
311
312 static uint16_t page10[256] = {
313 [0x37] = 0x7,
314 [0x39] = 0x9,
315 };
316
317 static uint16_t page17[256] = {
318 [0x14] = 0x9,
319 [0x34] = 0x9,
320 [0xd2] = 0x9,
321 };
322
323 static uint16_t page18[256] = {
324 [0xa9] = 0x228,
325 };
326
327 static uint16_t page20[256] = {
328 [0xd0] = 0x230,
329 [0xd1] = 0x230,
330 [0xd2] = 0x1,
331 [0xd3] = 0x1,
332 [0xd4] = 0x230,
333 [0xd5] = 0x230,
334 [0xd6] = 0x230,
335 [0xd7] = 0x230,
336 [0xd8] = 0x1,
337 [0xd9] = 0x1,
338 [0xda] = 0x1,
339 [0xdb] = 0x230,
340 [0xdc] = 0x230,
341 [0xe1] = 0x230,
342 [0xe5] = 0x1,
343 [0xe6] = 0x1,
344 [0xe7] = 0x230,
345 [0xe8] = 0x220,
346 [0xe9] = 0x230,
347 [0xea] = 0x1,
348 };
349
350 static uint16_t page30[256] = {
351 [0x2a] = 0x218,
352 [0x2b] = 0x228,
353 [0x2c] = 0x232,
354 [0x2d] = 0x222,
355 [0x2e] = 0x224,
356 [0x2f] = 0x224,
357 [0x99] = 0x8,
358 [0x9a] = 0x8,
359 };
360
361 static uint16_t pagefb[256] = {
362 [0x1e] = 0x26,
363 };
364
365 static uint16_t pagefe[256] = {
366 [0x20] = 0x230,
367 [0x21] = 0x230,
368 [0x22] = 0x230,
369 [0x23] = 0x230,
370 };
371
372 const uint16_t *hfsplus_class_pages_old[256] = {
373 [0x03] = page03,
374 [0x04] = page04,
375 [0x05] = page05,
376 [0x06] = page06,
377 [0x07] = page07,
378 [0x09] = page09,
379 [0x0a] = page0a,
380 [0x0b] = page0b,
381 [0x0c] = page0c,
382 [0x0d] = page0d,
383 [0x0e] = page0e,
384 [0x0f] = page0f,
385 [0x10] = page10,
386 [0x17] = page17,
387 [0x18] = page18,
388 [0x20] = page20,
389 [0x30] = page30,
390 [0xfb] = pagefb,
391 [0xfe] = pagefe,
392 };
393
394
395 /* ================================ Test Setup =========================== */
396
397 /* The new implementation */
398 #include "hfsplus_classes_ts.c"
399
400 static int compare_class_pages()
401 {
402 int i, j;
403
404 for (i = 0; i < 256; i++) {
405 if (hfsplus_class_pages_old[i] == NULL) {
406 if (hfsplus_class_pages[i] == NULL)
407 continue;
408 fprintf(stderr, "DIFF : i= %d , ts != NULL\n", i);
409 return 0;
410 } else if (hfsplus_class_pages[i] == NULL) {
411 fprintf(stderr, "DIFF : i= %d , ts == NULL\n", i);
412 return 0;
413 }
414 for (j = 0; j < 256; j++)
415 if (hfsplus_class_pages_old[i][j] !=
416 hfsplus_class_pages[i][j]) {
417 fprintf(stderr, "DIFF : i= %d , j= %d : %4.4x !+ %4.4x\n",
418 i, j, hfsplus_class_pages[i][j],
419 hfsplus_class_pages[i][j]);
420 return 0;
421 }
422 }
423 return 1;
424 }
425
426 main()
427 {
428
429 make_hfsplus_class_pages();
430
431 /* <<< intentional deviations */
432 /* hfsplus_class_pages[3][1] = 0xffff; */
433 /* hfsplus_class_pages_old[3] = NULL; */
434
435 compare_class_pages();
436
437 exit(0);
438 }
439
440