"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/libisofs/hfsplus_classes_ts_test.c" (30 Jan 2021, 14364 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_ts_test.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2 cc -g -o demo/classes libisofs/hfsplus_classes_ts_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 /* Based on Unicode 3.2.0.  */
   15 
   16 static uint16_t page03[256] = {
   17   [0x00] = 0x230,
   18   [0x01] = 0x230,
   19   [0x02] = 0x230,
   20   [0x03] = 0x230,
   21   [0x04] = 0x230,
   22   [0x05] = 0x230,
   23   [0x06] = 0x230,
   24   [0x07] = 0x230,
   25   [0x08] = 0x230,
   26   [0x09] = 0x230,
   27   [0x0a] = 0x230,
   28   [0x0b] = 0x230,
   29   [0x0c] = 0x230,
   30   [0x0d] = 0x230,
   31   [0x0e] = 0x230,
   32   [0x0f] = 0x230,
   33   [0x10] = 0x230,
   34   [0x11] = 0x230,
   35   [0x12] = 0x230,
   36   [0x13] = 0x230,
   37   [0x14] = 0x230,
   38   [0x15] = 0x232,
   39   [0x16] = 0x220,
   40   [0x17] = 0x220,
   41   [0x18] = 0x220,
   42   [0x19] = 0x220,
   43   [0x1a] = 0x232,
   44   [0x1b] = 0x216,
   45   [0x1c] = 0x220,
   46   [0x1d] = 0x220,
   47   [0x1e] = 0x220,
   48   [0x1f] = 0x220,
   49   [0x20] = 0x220,
   50   [0x21] = 0x202,
   51   [0x22] = 0x202,
   52   [0x23] = 0x220,
   53   [0x24] = 0x220,
   54   [0x25] = 0x220,
   55   [0x26] = 0x220,
   56   [0x27] = 0x202,
   57   [0x28] = 0x202,
   58   [0x29] = 0x220,
   59   [0x2a] = 0x220,
   60   [0x2b] = 0x220,
   61   [0x2c] = 0x220,
   62   [0x2d] = 0x220,
   63   [0x2e] = 0x220,
   64   [0x2f] = 0x220,
   65   [0x30] = 0x220,
   66   [0x31] = 0x220,
   67   [0x32] = 0x220,
   68   [0x33] = 0x220,
   69   [0x34] = 0x1,
   70   [0x35] = 0x1,
   71   [0x36] = 0x1,
   72   [0x37] = 0x1,
   73   [0x38] = 0x1,
   74   [0x39] = 0x220,
   75   [0x3a] = 0x220,
   76   [0x3b] = 0x220,
   77   [0x3c] = 0x220,
   78   [0x3d] = 0x230,
   79   [0x3e] = 0x230,
   80   [0x3f] = 0x230,
   81   [0x40] = 0x230,
   82   [0x41] = 0x230,
   83   [0x42] = 0x230,
   84   [0x43] = 0x230,
   85   [0x44] = 0x230,
   86   [0x45] = 0x240,
   87   [0x46] = 0x230,
   88   [0x47] = 0x220,
   89   [0x48] = 0x220,
   90   [0x49] = 0x220,
   91   [0x4a] = 0x230,
   92   [0x4b] = 0x230,
   93   [0x4c] = 0x230,
   94   [0x4d] = 0x220,
   95   [0x4e] = 0x220,
   96   [0x60] = 0x234,
   97   [0x61] = 0x234,
   98   [0x62] = 0x233,
   99   [0x63] = 0x230,
  100   [0x64] = 0x230,
  101   [0x65] = 0x230,
  102   [0x66] = 0x230,
  103   [0x67] = 0x230,
  104   [0x68] = 0x230,
  105   [0x69] = 0x230,
  106   [0x6a] = 0x230,
  107   [0x6b] = 0x230,
  108   [0x6c] = 0x230,
  109   [0x6d] = 0x230,
  110   [0x6e] = 0x230,
  111   [0x6f] = 0x230,
  112 };
  113 
  114 static uint16_t page04[256] = {
  115   [0x83] = 0x230,
  116   [0x84] = 0x230,
  117   [0x85] = 0x230,
  118   [0x86] = 0x230,
  119 };
  120 
  121 static uint16_t page05[256] = {
  122   [0x91] = 0x220,
  123   [0x92] = 0x230,
  124   [0x93] = 0x230,
  125   [0x94] = 0x230,
  126   [0x95] = 0x230,
  127   [0x96] = 0x220,
  128   [0x97] = 0x230,
  129   [0x98] = 0x230,
  130   [0x99] = 0x230,
  131   [0x9a] = 0x222,
  132   [0x9b] = 0x220,
  133   [0x9c] = 0x230,
  134   [0x9d] = 0x230,
  135   [0x9e] = 0x230,
  136   [0x9f] = 0x230,
  137   [0xa0] = 0x230,
  138   [0xa1] = 0x230,
  139   [0xa3] = 0x220,
  140   [0xa4] = 0x220,
  141   [0xa5] = 0x220,
  142   [0xa6] = 0x220,
  143   [0xa7] = 0x220,
  144   [0xa8] = 0x230,
  145   [0xa9] = 0x230,
  146   [0xaa] = 0x220,
  147   [0xab] = 0x230,
  148   [0xac] = 0x230,
  149   [0xad] = 0x222,
  150   [0xae] = 0x228,
  151   [0xaf] = 0x230,
  152   [0xb0] = 0x10,
  153   [0xb1] = 0x11,
  154   [0xb2] = 0x12,
  155   [0xb3] = 0x13,
  156   [0xb4] = 0x14,
  157   [0xb5] = 0x15,
  158   [0xb6] = 0x16,
  159   [0xb7] = 0x17,
  160   [0xb8] = 0x18,
  161   [0xb9] = 0x19,
  162   [0xbb] = 0x20,
  163   [0xbc] = 0x21,
  164   [0xbd] = 0x22,
  165   [0xbf] = 0x23,
  166   [0xc1] = 0x24,
  167   [0xc2] = 0x25,
  168   [0xc4] = 0x230,
  169 };
  170 
  171 static uint16_t page06[256] = {
  172   [0x4b] = 0x27,
  173   [0x4c] = 0x28,
  174   [0x4d] = 0x29,
  175   [0x4e] = 0x30,
  176   [0x4f] = 0x31,
  177   [0x50] = 0x32,
  178   [0x51] = 0x33,
  179   [0x52] = 0x34,
  180   [0x53] = 0x230,
  181   [0x54] = 0x230,
  182   [0x55] = 0x220,
  183   [0x70] = 0x35,
  184   [0xd6] = 0x230,
  185   [0xd7] = 0x230,
  186   [0xd8] = 0x230,
  187   [0xd9] = 0x230,
  188   [0xda] = 0x230,
  189   [0xdb] = 0x230,
  190   [0xdc] = 0x230,
  191   [0xdf] = 0x230,
  192   [0xe0] = 0x230,
  193   [0xe1] = 0x230,
  194   [0xe2] = 0x230,
  195   [0xe3] = 0x220,
  196   [0xe4] = 0x230,
  197   [0xe7] = 0x230,
  198   [0xe8] = 0x230,
  199   [0xea] = 0x220,
  200   [0xeb] = 0x230,
  201   [0xec] = 0x230,
  202   [0xed] = 0x220,
  203 };
  204 
  205 static uint16_t page07[256] = {
  206   [0x11] = 0x36,
  207   [0x30] = 0x230,
  208   [0x31] = 0x220,
  209   [0x32] = 0x230,
  210   [0x33] = 0x230,
  211   [0x34] = 0x220,
  212   [0x35] = 0x230,
  213   [0x36] = 0x230,
  214   [0x37] = 0x220,
  215   [0x38] = 0x220,
  216   [0x39] = 0x220,
  217   [0x3a] = 0x230,
  218   [0x3b] = 0x220,
  219   [0x3c] = 0x220,
  220   [0x3d] = 0x230,
  221   [0x3e] = 0x220,
  222   [0x3f] = 0x230,
  223   [0x40] = 0x230,
  224   [0x41] = 0x230,
  225   [0x42] = 0x220,
  226   [0x43] = 0x230,
  227   [0x44] = 0x220,
  228   [0x45] = 0x230,
  229   [0x46] = 0x220,
  230   [0x47] = 0x230,
  231   [0x48] = 0x220,
  232   [0x49] = 0x230,
  233   [0x4a] = 0x230,
  234 };
  235 
  236 static uint16_t page09[256] = {
  237   [0x3c] = 0x7,
  238   [0x4d] = 0x9,
  239   [0x51] = 0x230,
  240   [0x52] = 0x220,
  241   [0x53] = 0x230,
  242   [0x54] = 0x230,
  243   [0xbc] = 0x7,
  244   [0xcd] = 0x9,
  245 };
  246 
  247 static uint16_t page0a[256] = {
  248   [0x3c] = 0x7,
  249   [0x4d] = 0x9,
  250   [0xbc] = 0x7,
  251   [0xcd] = 0x9,
  252 };
  253 
  254 static uint16_t page0b[256] = {
  255   [0x3c] = 0x7,
  256   [0x4d] = 0x9,
  257   [0xcd] = 0x9,
  258 };
  259 
  260 static uint16_t page0c[256] = {
  261   [0x4d] = 0x9,
  262   [0x55] = 0x84,
  263   [0x56] = 0x91,
  264   [0xcd] = 0x9,
  265 };
  266 
  267 static uint16_t page0d[256] = {
  268   [0x4d] = 0x9,
  269   [0xca] = 0x9,
  270 };
  271 
  272 static uint16_t page0e[256] = {
  273   [0x38] = 0x103,
  274   [0x39] = 0x103,
  275   [0x3a] = 0x9,
  276   [0x48] = 0x107,
  277   [0x49] = 0x107,
  278   [0x4a] = 0x107,
  279   [0x4b] = 0x107,
  280   [0xb8] = 0x118,
  281   [0xb9] = 0x118,
  282   [0xc8] = 0x122,
  283   [0xc9] = 0x122,
  284   [0xca] = 0x122,
  285   [0xcb] = 0x122,
  286 };
  287 
  288 static uint16_t page0f[256] = {
  289   [0x18] = 0x220,
  290   [0x19] = 0x220,
  291   [0x35] = 0x220,
  292   [0x37] = 0x220,
  293   [0x39] = 0x216,
  294   [0x71] = 0x129,
  295   [0x72] = 0x130,
  296   [0x74] = 0x132,
  297   [0x7a] = 0x130,
  298   [0x7b] = 0x130,
  299   [0x7c] = 0x130,
  300   [0x7d] = 0x130,
  301   [0x80] = 0x130,
  302   [0x82] = 0x230,
  303   [0x83] = 0x230,
  304   [0x84] = 0x9,
  305   [0x86] = 0x230,
  306   [0x87] = 0x230,
  307   [0xc6] = 0x220,
  308 };
  309 
  310 static uint16_t page10[256] = {
  311   [0x37] = 0x7,
  312   [0x39] = 0x9,
  313 };
  314 
  315 static uint16_t page17[256] = {
  316   [0x14] = 0x9,
  317   [0x34] = 0x9,
  318   [0xd2] = 0x9,
  319 };
  320 
  321 static uint16_t page18[256] = {
  322   [0xa9] = 0x228,
  323 };
  324 
  325 static uint16_t page20[256] = {
  326   [0xd0] = 0x230,
  327   [0xd1] = 0x230,
  328   [0xd2] = 0x1,
  329   [0xd3] = 0x1,
  330   [0xd4] = 0x230,
  331   [0xd5] = 0x230,
  332   [0xd6] = 0x230,
  333   [0xd7] = 0x230,
  334   [0xd8] = 0x1,
  335   [0xd9] = 0x1,
  336   [0xda] = 0x1,
  337   [0xdb] = 0x230,
  338   [0xdc] = 0x230,
  339   [0xe1] = 0x230,
  340   [0xe5] = 0x1,
  341   [0xe6] = 0x1,
  342   [0xe7] = 0x230,
  343   [0xe8] = 0x220,
  344   [0xe9] = 0x230,
  345   [0xea] = 0x1,
  346 };
  347 
  348 static uint16_t page30[256] = {
  349   [0x2a] = 0x218,
  350   [0x2b] = 0x228,
  351   [0x2c] = 0x232,
  352   [0x2d] = 0x222,
  353   [0x2e] = 0x224,
  354   [0x2f] = 0x224,
  355   [0x99] = 0x8,
  356   [0x9a] = 0x8,
  357 };
  358 
  359 static uint16_t pagefb[256] = {
  360   [0x1e] = 0x26,
  361 };
  362 
  363 static uint16_t pagefe[256] = {
  364   [0x20] = 0x230,
  365   [0x21] = 0x230,
  366   [0x22] = 0x230,
  367   [0x23] = 0x230,
  368 };
  369 
  370 const uint16_t *hfsplus_class_pages_old[256] = {
  371   [0x03] = page03,
  372   [0x04] = page04,
  373   [0x05] = page05,
  374   [0x06] = page06,
  375   [0x07] = page07,
  376   [0x09] = page09,
  377   [0x0a] = page0a,
  378   [0x0b] = page0b,
  379   [0x0c] = page0c,
  380   [0x0d] = page0d,
  381   [0x0e] = page0e,
  382   [0x0f] = page0f,
  383   [0x10] = page10,
  384   [0x17] = page17,
  385   [0x18] = page18,
  386   [0x20] = page20,
  387   [0x30] = page30,
  388   [0xfb] = pagefb,
  389   [0xfe] = pagefe,
  390 };
  391 
  392 
  393 /* ====================================== ts ============================= */
  394 
  395 /* This encodes a matrix of page and character, with 16-bit words as elements.
  396    Initially the matrix is filled with zeros.
  397    1: The first element is the page number.
  398       If it is equal or lower than the previous one, then the matrix is done.
  399    2: The next element is the character number
  400       If it is  equal or lower than the previous one, the page is done. Goto 1.
  401    3: The next element is the byte value. Goto 2.
  402 */
  403 /* Based on Unicode 3.2.0.  */
  404 
  405 static uint16_t class_page_data[] = {
  406 
  407   /* page 03 */
  408   0x03,
  409   0x00, 0x230,
  410   0x01, 0x230,
  411   0x02, 0x230,
  412   0x03, 0x230,
  413   0x04, 0x230,
  414   0x05, 0x230,
  415   0x06, 0x230,
  416   0x07, 0x230,
  417   0x08, 0x230,
  418   0x09, 0x230,
  419   0x0a, 0x230,
  420   0x0b, 0x230,
  421   0x0c, 0x230,
  422   0x0d, 0x230,
  423   0x0e, 0x230,
  424   0x0f, 0x230,
  425   0x10, 0x230,
  426   0x11, 0x230,
  427   0x12, 0x230,
  428   0x13, 0x230,
  429   0x14, 0x230,
  430   0x15, 0x232,
  431   0x16, 0x220,
  432   0x17, 0x220,
  433   0x18, 0x220,
  434   0x19, 0x220,
  435   0x1a, 0x232,
  436   0x1b, 0x216,
  437   0x1c, 0x220,
  438   0x1d, 0x220,
  439   0x1e, 0x220,
  440   0x1f, 0x220,
  441   0x20, 0x220,
  442   0x21, 0x202,
  443   0x22, 0x202,
  444   0x23, 0x220,
  445   0x24, 0x220,
  446   0x25, 0x220,
  447   0x26, 0x220,
  448   0x27, 0x202,
  449   0x28, 0x202,
  450   0x29, 0x220,
  451   0x2a, 0x220,
  452   0x2b, 0x220,
  453   0x2c, 0x220,
  454   0x2d, 0x220,
  455   0x2e, 0x220,
  456   0x2f, 0x220,
  457   0x30, 0x220,
  458   0x31, 0x220,
  459   0x32, 0x220,
  460   0x33, 0x220,
  461   0x34, 0x1,
  462   0x35, 0x1,
  463   0x36, 0x1,
  464   0x37, 0x1,
  465   0x38, 0x1,
  466   0x39, 0x220,
  467   0x3a, 0x220,
  468   0x3b, 0x220,
  469   0x3c, 0x220,
  470   0x3d, 0x230,
  471   0x3e, 0x230,
  472   0x3f, 0x230,
  473   0x40, 0x230,
  474   0x41, 0x230,
  475   0x42, 0x230,
  476   0x43, 0x230,
  477   0x44, 0x230,
  478   0x45, 0x240,
  479   0x46, 0x230,
  480   0x47, 0x220,
  481   0x48, 0x220,
  482   0x49, 0x220,
  483   0x4a, 0x230,
  484   0x4b, 0x230,
  485   0x4c, 0x230,
  486   0x4d, 0x220,
  487   0x4e, 0x220,
  488   0x60, 0x234,
  489   0x61, 0x234,
  490   0x62, 0x233,
  491   0x63, 0x230,
  492   0x64, 0x230,
  493   0x65, 0x230,
  494   0x66, 0x230,
  495   0x67, 0x230,
  496   0x68, 0x230,
  497   0x69, 0x230,
  498   0x6a, 0x230,
  499   0x6b, 0x230,
  500   0x6c, 0x230,
  501   0x6d, 0x230,
  502   0x6e, 0x230,
  503   0x6f, 0x230,
  504   0x00,
  505 
  506   /* page04 */
  507   0x04,
  508   0x83, 0x230,
  509   0x84, 0x230,
  510   0x85, 0x230,
  511   0x86, 0x230,
  512   0x00,
  513 
  514   /* page05 */
  515   0x05,
  516   0x91, 0x220,
  517   0x92, 0x230,
  518   0x93, 0x230,
  519   0x94, 0x230,
  520   0x95, 0x230,
  521   0x96, 0x220,
  522   0x97, 0x230,
  523   0x98, 0x230,
  524   0x99, 0x230,
  525   0x9a, 0x222,
  526   0x9b, 0x220,
  527   0x9c, 0x230,
  528   0x9d, 0x230,
  529   0x9e, 0x230,
  530   0x9f, 0x230,
  531   0xa0, 0x230,
  532   0xa1, 0x230,
  533   0xa3, 0x220,
  534   0xa4, 0x220,
  535   0xa5, 0x220,
  536   0xa6, 0x220,
  537   0xa7, 0x220,
  538   0xa8, 0x230,
  539   0xa9, 0x230,
  540   0xaa, 0x220,
  541   0xab, 0x230,
  542   0xac, 0x230,
  543   0xad, 0x222,
  544   0xae, 0x228,
  545   0xaf, 0x230,
  546   0xb0, 0x10,
  547   0xb1, 0x11,
  548   0xb2, 0x12,
  549   0xb3, 0x13,
  550   0xb4, 0x14,
  551   0xb5, 0x15,
  552   0xb6, 0x16,
  553   0xb7, 0x17,
  554   0xb8, 0x18,
  555   0xb9, 0x19,
  556   0xbb, 0x20,
  557   0xbc, 0x21,
  558   0xbd, 0x22,
  559   0xbf, 0x23,
  560   0xc1, 0x24,
  561   0xc2, 0x25,
  562   0xc4, 0x230,
  563   0x00,
  564 
  565   /* page06 */
  566   0x06,
  567   0x4b, 0x27,
  568   0x4c, 0x28,
  569   0x4d, 0x29,
  570   0x4e, 0x30,
  571   0x4f, 0x31,
  572   0x50, 0x32,
  573   0x51, 0x33,
  574   0x52, 0x34,
  575   0x53, 0x230,
  576   0x54, 0x230,
  577   0x55, 0x220,
  578   0x70, 0x35,
  579   0xd6, 0x230,
  580   0xd7, 0x230,
  581   0xd8, 0x230,
  582   0xd9, 0x230,
  583   0xda, 0x230,
  584   0xdb, 0x230,
  585   0xdc, 0x230,
  586   0xdf, 0x230,
  587   0xe0, 0x230,
  588   0xe1, 0x230,
  589   0xe2, 0x230,
  590   0xe3, 0x220,
  591   0xe4, 0x230,
  592   0xe7, 0x230,
  593   0xe8, 0x230,
  594   0xea, 0x220,
  595   0xeb, 0x230,
  596   0xec, 0x230,
  597   0xed, 0x220,
  598   0x00,
  599 
  600   /* page07 */
  601   0x07,
  602   0x11, 0x36,
  603   0x30, 0x230,
  604   0x31, 0x220,
  605   0x32, 0x230,
  606   0x33, 0x230,
  607   0x34, 0x220,
  608   0x35, 0x230,
  609   0x36, 0x230,
  610   0x37, 0x220,
  611   0x38, 0x220,
  612   0x39, 0x220,
  613   0x3a, 0x230,
  614   0x3b, 0x220,
  615   0x3c, 0x220,
  616   0x3d, 0x230,
  617   0x3e, 0x220,
  618   0x3f, 0x230,
  619   0x40, 0x230,
  620   0x41, 0x230,
  621   0x42, 0x220,
  622   0x43, 0x230,
  623   0x44, 0x220,
  624   0x45, 0x230,
  625   0x46, 0x220,
  626   0x47, 0x230,
  627   0x48, 0x220,
  628   0x49, 0x230,
  629   0x4a, 0x230,
  630   0x00,
  631 
  632   /* page09 */
  633   0x09,
  634   0x3c, 0x7,
  635   0x4d, 0x9,
  636   0x51, 0x230,
  637   0x52, 0x220,
  638   0x53, 0x230,
  639   0x54, 0x230,
  640   0xbc, 0x7,
  641   0xcd, 0x9,
  642   0x00,
  643 
  644   /* page0a */
  645   0x0a,
  646   0x3c, 0x7,
  647   0x4d, 0x9,
  648   0xbc, 0x7,
  649   0xcd, 0x9,
  650   0x00,
  651 
  652   /* page0b */
  653   0x0b,
  654   0x3c, 0x7,
  655   0x4d, 0x9,
  656   0xcd, 0x9,
  657   0x00,
  658 
  659   /* page0c */
  660   0x0c,
  661   0x4d, 0x9,
  662   0x55, 0x84,
  663   0x56, 0x91,
  664   0xcd, 0x9,
  665   0x00,
  666 
  667   /* page0d */
  668   0x0d,
  669   0x4d, 0x9,
  670   0xca, 0x9,
  671   0x00,
  672 
  673   /* page0e */
  674   0x0e,
  675   0x38, 0x103,
  676   0x39, 0x103,
  677   0x3a, 0x9,
  678   0x48, 0x107,
  679   0x49, 0x107,
  680   0x4a, 0x107,
  681   0x4b, 0x107,
  682   0xb8, 0x118,
  683   0xb9, 0x118,
  684   0xc8, 0x122,
  685   0xc9, 0x122,
  686   0xca, 0x122,
  687   0xcb, 0x122,
  688   0x00,
  689 
  690   /* page0f */
  691   0x0f,
  692   0x18, 0x220,
  693   0x19, 0x220,
  694   0x35, 0x220,
  695   0x37, 0x220,
  696   0x39, 0x216,
  697   0x71, 0x129,
  698   0x72, 0x130,
  699   0x74, 0x132,
  700   0x7a, 0x130,
  701   0x7b, 0x130,
  702   0x7c, 0x130,
  703   0x7d, 0x130,
  704   0x80, 0x130,
  705   0x82, 0x230,
  706   0x83, 0x230,
  707   0x84, 0x9,
  708   0x86, 0x230,
  709   0x87, 0x230,
  710   0xc6, 0x220,
  711   0x00,
  712 
  713   /* page10 */
  714   0x10,
  715   0x37, 0x7,
  716   0x39, 0x9,
  717   0x00,
  718 
  719   /* page17 */
  720   0x17,
  721   0x14, 0x9,
  722   0x34, 0x9,
  723   0xd2, 0x9,
  724   0x00,
  725 
  726   /* page18 */
  727   0x18,
  728   0xa9, 0x228,
  729   0x00,
  730 
  731   /* page20 */
  732   0x20,
  733   0xd0, 0x230,
  734   0xd1, 0x230,
  735   0xd2, 0x1,
  736   0xd3, 0x1,
  737   0xd4, 0x230,
  738   0xd5, 0x230,
  739   0xd6, 0x230,
  740   0xd7, 0x230,
  741   0xd8, 0x1,
  742   0xd9, 0x1,
  743   0xda, 0x1,
  744   0xdb, 0x230,
  745   0xdc, 0x230,
  746   0xe1, 0x230,
  747   0xe5, 0x1,
  748   0xe6, 0x1,
  749   0xe7, 0x230,
  750   0xe8, 0x220,
  751   0xe9, 0x230,
  752   0xea, 0x1,
  753   0x00,
  754 
  755   /* page30 */
  756   0x30,
  757   0x2a, 0x218,
  758   0x2b, 0x228,
  759   0x2c, 0x232,
  760   0x2d, 0x222,
  761   0x2e, 0x224,
  762   0x2f, 0x224,
  763   0x99, 0x8,
  764   0x9a, 0x8,
  765   0x00,
  766 
  767   /* pagefb */
  768   0xfb,
  769   0x1e, 0x26,
  770   0x00,
  771 
  772   /* pagefe */
  773   0xfe,
  774   0x20, 0x230,
  775   0x21, 0x230,
  776   0x22, 0x230,
  777   0x23, 0x230,
  778 };
  779 
  780 uint16_t *hfsplus_class_pages[256];
  781 
  782 static uint16_t class_pages[19][256];
  783 
  784 void make_hfsplus_class_pages()
  785 {
  786     int page_idx = -1, char_idx, i;
  787     uint16_t *rpt, *page_pt;
  788     int page_count = 0;
  789 
  790     memset(class_pages, 0, 19 * 256);
  791     for (i = 0; i < 256; i++)
  792         hfsplus_class_pages[i] = NULL;  
  793 
  794     rpt = (uint16_t *) class_page_data;
  795     page_pt = (uint16_t *) class_pages;
  796     while (1) {
  797         if (*rpt <= page_idx)
  798     break;
  799 
  800         /* <<< only for development */
  801         page_count++;
  802         if (page_count > 19) {
  803             fprintf(stderr, "FATAL: More than 19 pages encountered\n");
  804             exit(1);
  805         }
  806 
  807         page_idx = *(rpt++);
  808         char_idx = -1;
  809         while (1) {
  810             if(*rpt <= char_idx)
  811         break;
  812             char_idx = *(rpt++);
  813             page_pt[char_idx] = *(rpt++);
  814         }
  815         rpt++;
  816         hfsplus_class_pages[page_idx] = class_pages[page_count - 1];
  817         page_pt += 256;
  818     }
  819 
  820     /* <<< only for development */
  821     rpt++;
  822     printf("Items read: %d\n", (int) (rpt - class_page_data));
  823     if (page_count != 19) {
  824         fprintf(stderr, "FATAL: Less than 19 pages encountered: %d\n",
  825                 page_count);
  826         exit(1);
  827     }
  828 }
  829 
  830 
  831 static int compare_class_pages()
  832 {
  833     int i, j;
  834 
  835     for (i = 0; i < 256; i++) {
  836         if (hfsplus_class_pages_old[i] == NULL) {
  837             if (hfsplus_class_pages[i] == NULL)
  838     continue;
  839             fprintf(stderr, "DIFF : i= %d , ts != NULL\n", i);
  840             return 0;
  841         } else if (hfsplus_class_pages[i] == NULL) {
  842             fprintf(stderr, "DIFF : i= %d , ts == NULL\n", i);
  843             return 0;
  844         }
  845         for (j = 0; j < 256; j++)
  846              if (hfsplus_class_pages_old[i][j] !=
  847                  hfsplus_class_pages[i][j]) {
  848                  fprintf(stderr, "DIFF : i= %d , j= %d : %4.4x !+ %4.4x\n",
  849                                  i, j, hfsplus_class_pages[i][j],
  850                                  hfsplus_class_pages[i][j]);
  851                      return 0;
  852                  }
  853     }
  854     return 1;
  855 }
  856 
  857 main()
  858 {
  859 
  860  make_hfsplus_class_pages();
  861 
  862  /* <<< intentional deviations */
  863  /* hfsplus_class_pages[3][1] = 0xffff; */
  864  /* hfsplus_class_pages_old[3] = NULL; */
  865 
  866  compare_class_pages();
  867 
  868  exit(0);
  869 }
  870 
  871