1 // AUTOGENERATED FROM index-windows-1255.txt, ORIGINAL COMMENT FOLLOWS:
2 //
3 // Any copyright is dedicated to the Public Domain.
4 // https://creativecommons.org/publicdomain/zero/1.0/
5 //
6 // For details on index index-windows-1255.txt see the Encoding Standard
7 // https://encoding.spec.whatwg.org/
8 //
9 // Identifier: 3b3ec872752f43c348a39b3fd2040202ccd95b935e56b2f92bb9e03e220ca02a
10 // Date: 2014-12-19
11 
12 static FORWARD_TABLE: &'static [u16] = &[
13     8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 138, 8249, 140,
14     141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482,
15     154, 8250, 156, 157, 158, 159, 160, 161, 162, 163, 8362, 165, 166, 167,
16     168, 169, 215, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
17     183, 184, 185, 247, 187, 188, 189, 190, 191, 1456, 1457, 1458, 1459, 1460,
18     1461, 1462, 1463, 1464, 1465, 65535, 1467, 1468, 1469, 1470, 1471, 1472,
19     1473, 1474, 1475, 1520, 1521, 1522, 1523, 1524, 65535, 65535, 65535, 65535,
20     65535, 65535, 65535, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496,
21     1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508,
22     1509, 1510, 1511, 1512, 1513, 1514, 65535, 65535, 8206, 8207, 65535,
23 ];
24 
25 /// Returns the index code point for pointer `code` in this index.
26 #[inline]
forward(code: u8) -> u1627 pub fn forward(code: u8) -> u16 {
28     FORWARD_TABLE[(code - 0x80) as usize]
29 }
30 
31 static BACKWARD_TABLE_LOWER: &'static [u8] = &[
32     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
33     0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 140, 141, 142,
34     143, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 154, 0, 156, 157, 158, 159, 160, 161,
35     162, 163, 0, 165, 166, 167, 168, 169, 0, 171, 172, 173, 174, 175, 176, 177,
36     178, 179, 180, 181, 182, 183, 184, 185, 0, 187, 188, 189, 190, 191, 0, 0,
37     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 0, 0,
38     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39     0, 0, 0, 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40     0, 0, 0, 0, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41     0, 0, 0, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42     0, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 193,
43     194, 195, 196, 197, 198, 199, 200, 201, 0, 203, 204, 205, 206, 207, 208,
44     209, 210, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 225, 226, 227, 228,
45     229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
46     244, 245, 246, 247, 248, 249, 250, 0, 0, 0, 0, 0, 212, 213, 214, 215, 216,
47     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48     253, 254, 0, 0, 0, 150, 151, 0, 0, 0, 145, 146, 130, 0, 147, 148, 132, 0,
49     134, 135, 149, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0,
50     0, 0, 0, 139, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0,
51     128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0,
52     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53     0, 0, 0,
54 ];
55 
56 static BACKWARD_TABLE_UPPER: &'static [u16] = &[
57     0, 0, 0, 0, 32, 64, 96, 128, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58     192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224,
59     256, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
67     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 320, 352, 0, 0, 0, 384, 0, 0, 0, 416,
68 ];
69 
70 /// Returns the index pointer for code point `code` in this index.
71 #[inline]
backward(code: u32) -> u872 pub fn backward(code: u32) -> u8 {
73     let offset = (code >> 5) as usize;
74     let offset = if offset < 266 {BACKWARD_TABLE_UPPER[offset] as usize} else {0};
75     BACKWARD_TABLE_LOWER[offset + ((code & 31) as usize)]
76 }
77 
78 #[cfg(test)]
79 single_byte_tests!(
80     mod = windows_1255
81 );
82