xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hfsplus_classes.c
Go to the documentation of this file.
1 /*
2  *
3  * Based on Unicode 3.2.0.
4  * See http://www.unicode.org/copyright.html
5  * Quote from there:
6  * "Copyright (c) 1991-2012 Unicode, Inc. All rights reserved.
7  * [...]
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of the Unicode data files and any associated documentation
10  * (the "Data Files") or Unicode software and any associated documentation
11  * (the "Software") to deal in the Data Files or Software without restriction,
12  * including without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, and/or sell copies of the Data Files or Software, and to permit
14  * persons to whom the Data Files or Software are furnished to do so, provided
15  * that (a) the above copyright notice(s) and this permission notice appear
16  * with all copies of the Data Files or Software, (b) both the above copyright
17  * notice(s) and this permission notice appear in associated documentation,
18  * and (c) there is clear notice in each modified Data File or in the Software
19  * as well as in the documentation associated with the Data File(s) or
20  * Software that the data or software has been modified."
21  *
22  *
23  * For this particular implementation:
24  *
25  * Copyright (c) 2012 Vladimir Serbinenko
26  * Copyright (c) 2012 Thomas Schmitt
27  *
28  * This file is part of the libisofs project; you can redistribute it and/or
29  * modify it under the terms of the GNU General Public License version 2
30  * or later as published by the Free Software Foundation.
31  * See COPYING file for details.
32  */
33 
34 #ifdef HAVE_CONFIG_H
35 #include "../config.h"
36 #endif
37 
38 #include <string.h>
39 
40 #include "hfsplus.h"
41 
42 
43 /* This encodes a matrix of page and character, with 16-bit words as elements.
44  Initially the matrix is filled with zeros.
45  1: The first element is the page number.
46  If it is equal or lower than the previous one, then the matrix is done.
47  2: The next element is the character number
48  If it is equal or lower than the previous one, the page is done. Goto 1.
49  3: The next element is the byte value. Goto 2.
50 */
51 
52 static uint16_t class_page_data[] = {
53 
54  /* page 03 */
55  0x03,
56  0x00, 0x230,
57  0x01, 0x230,
58  0x02, 0x230,
59  0x03, 0x230,
60  0x04, 0x230,
61  0x05, 0x230,
62  0x06, 0x230,
63  0x07, 0x230,
64  0x08, 0x230,
65  0x09, 0x230,
66  0x0a, 0x230,
67  0x0b, 0x230,
68  0x0c, 0x230,
69  0x0d, 0x230,
70  0x0e, 0x230,
71  0x0f, 0x230,
72  0x10, 0x230,
73  0x11, 0x230,
74  0x12, 0x230,
75  0x13, 0x230,
76  0x14, 0x230,
77  0x15, 0x232,
78  0x16, 0x220,
79  0x17, 0x220,
80  0x18, 0x220,
81  0x19, 0x220,
82  0x1a, 0x232,
83  0x1b, 0x216,
84  0x1c, 0x220,
85  0x1d, 0x220,
86  0x1e, 0x220,
87  0x1f, 0x220,
88  0x20, 0x220,
89  0x21, 0x202,
90  0x22, 0x202,
91  0x23, 0x220,
92  0x24, 0x220,
93  0x25, 0x220,
94  0x26, 0x220,
95  0x27, 0x202,
96  0x28, 0x202,
97  0x29, 0x220,
98  0x2a, 0x220,
99  0x2b, 0x220,
100  0x2c, 0x220,
101  0x2d, 0x220,
102  0x2e, 0x220,
103  0x2f, 0x220,
104  0x30, 0x220,
105  0x31, 0x220,
106  0x32, 0x220,
107  0x33, 0x220,
108  0x34, 0x1,
109  0x35, 0x1,
110  0x36, 0x1,
111  0x37, 0x1,
112  0x38, 0x1,
113  0x39, 0x220,
114  0x3a, 0x220,
115  0x3b, 0x220,
116  0x3c, 0x220,
117  0x3d, 0x230,
118  0x3e, 0x230,
119  0x3f, 0x230,
120  0x40, 0x230,
121  0x41, 0x230,
122  0x42, 0x230,
123  0x43, 0x230,
124  0x44, 0x230,
125  0x45, 0x240,
126  0x46, 0x230,
127  0x47, 0x220,
128  0x48, 0x220,
129  0x49, 0x220,
130  0x4a, 0x230,
131  0x4b, 0x230,
132  0x4c, 0x230,
133  0x4d, 0x220,
134  0x4e, 0x220,
135  0x60, 0x234,
136  0x61, 0x234,
137  0x62, 0x233,
138  0x63, 0x230,
139  0x64, 0x230,
140  0x65, 0x230,
141  0x66, 0x230,
142  0x67, 0x230,
143  0x68, 0x230,
144  0x69, 0x230,
145  0x6a, 0x230,
146  0x6b, 0x230,
147  0x6c, 0x230,
148  0x6d, 0x230,
149  0x6e, 0x230,
150  0x6f, 0x230,
151  0x00,
152 
153  /* page04 */
154  0x04,
155  0x83, 0x230,
156  0x84, 0x230,
157  0x85, 0x230,
158  0x86, 0x230,
159  0x00,
160 
161  /* page05 */
162  0x05,
163  0x91, 0x220,
164  0x92, 0x230,
165  0x93, 0x230,
166  0x94, 0x230,
167  0x95, 0x230,
168  0x96, 0x220,
169  0x97, 0x230,
170  0x98, 0x230,
171  0x99, 0x230,
172  0x9a, 0x222,
173  0x9b, 0x220,
174  0x9c, 0x230,
175  0x9d, 0x230,
176  0x9e, 0x230,
177  0x9f, 0x230,
178  0xa0, 0x230,
179  0xa1, 0x230,
180  0xa3, 0x220,
181  0xa4, 0x220,
182  0xa5, 0x220,
183  0xa6, 0x220,
184  0xa7, 0x220,
185  0xa8, 0x230,
186  0xa9, 0x230,
187  0xaa, 0x220,
188  0xab, 0x230,
189  0xac, 0x230,
190  0xad, 0x222,
191  0xae, 0x228,
192  0xaf, 0x230,
193  0xb0, 0x10,
194  0xb1, 0x11,
195  0xb2, 0x12,
196  0xb3, 0x13,
197  0xb4, 0x14,
198  0xb5, 0x15,
199  0xb6, 0x16,
200  0xb7, 0x17,
201  0xb8, 0x18,
202  0xb9, 0x19,
203  0xbb, 0x20,
204  0xbc, 0x21,
205  0xbd, 0x22,
206  0xbf, 0x23,
207  0xc1, 0x24,
208  0xc2, 0x25,
209  0xc4, 0x230,
210  0x00,
211 
212  /* page06 */
213  0x06,
214  0x4b, 0x27,
215  0x4c, 0x28,
216  0x4d, 0x29,
217  0x4e, 0x30,
218  0x4f, 0x31,
219  0x50, 0x32,
220  0x51, 0x33,
221  0x52, 0x34,
222  0x53, 0x230,
223  0x54, 0x230,
224  0x55, 0x220,
225  0x70, 0x35,
226  0xd6, 0x230,
227  0xd7, 0x230,
228  0xd8, 0x230,
229  0xd9, 0x230,
230  0xda, 0x230,
231  0xdb, 0x230,
232  0xdc, 0x230,
233  0xdf, 0x230,
234  0xe0, 0x230,
235  0xe1, 0x230,
236  0xe2, 0x230,
237  0xe3, 0x220,
238  0xe4, 0x230,
239  0xe7, 0x230,
240  0xe8, 0x230,
241  0xea, 0x220,
242  0xeb, 0x230,
243  0xec, 0x230,
244  0xed, 0x220,
245  0x00,
246 
247  /* page07 */
248  0x07,
249  0x11, 0x36,
250  0x30, 0x230,
251  0x31, 0x220,
252  0x32, 0x230,
253  0x33, 0x230,
254  0x34, 0x220,
255  0x35, 0x230,
256  0x36, 0x230,
257  0x37, 0x220,
258  0x38, 0x220,
259  0x39, 0x220,
260  0x3a, 0x230,
261  0x3b, 0x220,
262  0x3c, 0x220,
263  0x3d, 0x230,
264  0x3e, 0x220,
265  0x3f, 0x230,
266  0x40, 0x230,
267  0x41, 0x230,
268  0x42, 0x220,
269  0x43, 0x230,
270  0x44, 0x220,
271  0x45, 0x230,
272  0x46, 0x220,
273  0x47, 0x230,
274  0x48, 0x220,
275  0x49, 0x230,
276  0x4a, 0x230,
277  0x00,
278 
279  /* page09 */
280  0x09,
281  0x3c, 0x7,
282  0x4d, 0x9,
283  0x51, 0x230,
284  0x52, 0x220,
285  0x53, 0x230,
286  0x54, 0x230,
287  0xbc, 0x7,
288  0xcd, 0x9,
289  0x00,
290 
291  /* page0a */
292  0x0a,
293  0x3c, 0x7,
294  0x4d, 0x9,
295  0xbc, 0x7,
296  0xcd, 0x9,
297  0x00,
298 
299  /* page0b */
300  0x0b,
301  0x3c, 0x7,
302  0x4d, 0x9,
303  0xcd, 0x9,
304  0x00,
305 
306  /* page0c */
307  0x0c,
308  0x4d, 0x9,
309  0x55, 0x84,
310  0x56, 0x91,
311  0xcd, 0x9,
312  0x00,
313 
314  /* page0d */
315  0x0d,
316  0x4d, 0x9,
317  0xca, 0x9,
318  0x00,
319 
320  /* page0e */
321  0x0e,
322  0x38, 0x103,
323  0x39, 0x103,
324  0x3a, 0x9,
325  0x48, 0x107,
326  0x49, 0x107,
327  0x4a, 0x107,
328  0x4b, 0x107,
329  0xb8, 0x118,
330  0xb9, 0x118,
331  0xc8, 0x122,
332  0xc9, 0x122,
333  0xca, 0x122,
334  0xcb, 0x122,
335  0x00,
336 
337  /* page0f */
338  0x0f,
339  0x18, 0x220,
340  0x19, 0x220,
341  0x35, 0x220,
342  0x37, 0x220,
343  0x39, 0x216,
344  0x71, 0x129,
345  0x72, 0x130,
346  0x74, 0x132,
347  0x7a, 0x130,
348  0x7b, 0x130,
349  0x7c, 0x130,
350  0x7d, 0x130,
351  0x80, 0x130,
352  0x82, 0x230,
353  0x83, 0x230,
354  0x84, 0x9,
355  0x86, 0x230,
356  0x87, 0x230,
357  0xc6, 0x220,
358  0x00,
359 
360  /* page10 */
361  0x10,
362  0x37, 0x7,
363  0x39, 0x9,
364  0x00,
365 
366  /* page17 */
367  0x17,
368  0x14, 0x9,
369  0x34, 0x9,
370  0xd2, 0x9,
371  0x00,
372 
373  /* page18 */
374  0x18,
375  0xa9, 0x228,
376  0x00,
377 
378  /* page20 */
379  0x20,
380  0xd0, 0x230,
381  0xd1, 0x230,
382  0xd2, 0x1,
383  0xd3, 0x1,
384  0xd4, 0x230,
385  0xd5, 0x230,
386  0xd6, 0x230,
387  0xd7, 0x230,
388  0xd8, 0x1,
389  0xd9, 0x1,
390  0xda, 0x1,
391  0xdb, 0x230,
392  0xdc, 0x230,
393  0xe1, 0x230,
394  0xe5, 0x1,
395  0xe6, 0x1,
396  0xe7, 0x230,
397  0xe8, 0x220,
398  0xe9, 0x230,
399  0xea, 0x1,
400  0x00,
401 
402  /* page30 */
403  0x30,
404  0x2a, 0x218,
405  0x2b, 0x228,
406  0x2c, 0x232,
407  0x2d, 0x222,
408  0x2e, 0x224,
409  0x2f, 0x224,
410  0x99, 0x8,
411  0x9a, 0x8,
412  0x00,
413 
414  /* pagefb */
415  0xfb,
416  0x1e, 0x26,
417  0x00,
418 
419  /* pagefe */
420  0xfe,
421  0x20, 0x230,
422  0x21, 0x230,
423  0x22, 0x230,
424  0x23, 0x230,
425  0x00,
426 
427  /* End of list */
428  0x00
429 };
430 
431 uint16_t *hfsplus_class_pages[256];
432 
433 static uint16_t class_pages[19][256];
434 
436 {
437  int page_idx = -1, char_idx, i;
438  uint16_t *rpt, *page_pt;
439  int page_count = 0;
440 
441  memset(class_pages, 0, 19 * 256 * sizeof(uint16_t));
442  for (i = 0; i < 256; i++)
443  hfsplus_class_pages[i] = NULL;
444 
445  rpt = (uint16_t *) class_page_data;
446  page_pt = (uint16_t *) class_pages;
447  while (1) {
448  if (*rpt <= page_idx)
449  break;
450  page_count++;
451  page_idx = *(rpt++);
452  char_idx = -1;
453  while (1) {
454  if(*rpt <= char_idx)
455  break;
456  char_idx = *(rpt++);
457  page_pt[char_idx] = *(rpt++);
458  }
459  rpt++;
460  hfsplus_class_pages[page_idx] = class_pages[page_count - 1];
461  page_pt += 256;
462  }
463 }
464 
uint16_t * hfsplus_class_pages[256]
void make_hfsplus_class_pages()
static uint16_t class_pages[19][256]
static uint16_t class_page_data[]