lowerrune.c (7526B)
1 /* Automatically generated by mkrunetype.awk */ 2 #include <stdlib.h> 3 4 #include "../utf.h" 5 #include "runetype.h" 6 7 static Rune lower4[][2] = { 8 { 0x0101, 0x012F }, 9 { 0x0133, 0x0137 }, 10 { 0x013A, 0x0148 }, 11 { 0x014B, 0x0177 }, 12 { 0x017A, 0x017E }, 13 { 0x0183, 0x0185 }, 14 { 0x01A1, 0x01A5 }, 15 { 0x01B4, 0x01B6 }, 16 { 0x01CE, 0x01DC }, 17 { 0x01DF, 0x01EF }, 18 { 0x01F9, 0x021F }, 19 { 0x0223, 0x0233 }, 20 { 0x0247, 0x024F }, 21 { 0x0371, 0x0373 }, 22 { 0x03D9, 0x03EF }, 23 { 0x0461, 0x0481 }, 24 { 0x048B, 0x04BF }, 25 { 0x04C2, 0x04CE }, 26 { 0x04D1, 0x052F }, 27 { 0x1E01, 0x1E95 }, 28 { 0x1EA1, 0x1EFF }, 29 { 0x2C68, 0x2C6C }, 30 { 0x2C81, 0x2CE3 }, 31 { 0x2CEC, 0x2CEE }, 32 { 0xA641, 0xA66D }, 33 { 0xA681, 0xA69B }, 34 { 0xA723, 0xA72F }, 35 { 0xA733, 0xA76F }, 36 { 0xA77A, 0xA77C }, 37 { 0xA77F, 0xA787 }, 38 { 0xA791, 0xA793 }, 39 { 0xA797, 0xA7A9 }, 40 }; 41 42 static Rune lower2[][3] = { 43 { 0x0061, 0x007A, 0x0041 }, 44 { 0x00E0, 0x00F6, 0x00C0 }, 45 { 0x00F8, 0x00FE, 0x00D8 }, 46 { 0x01AA, 0x01AB, 0x01AA }, 47 { 0x0234, 0x0239, 0x0234 }, 48 { 0x023F, 0x0240, 0x2C7E }, 49 { 0x0256, 0x0257, 0x0189 }, 50 { 0x025D, 0x025F, 0x025D }, 51 { 0x026D, 0x026E, 0x026D }, 52 { 0x0273, 0x0274, 0x0273 }, 53 { 0x0276, 0x027C, 0x0276 }, 54 { 0x027E, 0x027F, 0x027E }, 55 { 0x0281, 0x0282, 0x0281 }, 56 { 0x0284, 0x0286, 0x0284 }, 57 { 0x028A, 0x028B, 0x01B1 }, 58 { 0x028D, 0x0291, 0x028D }, 59 { 0x0295, 0x029D, 0x0295 }, 60 { 0x029F, 0x02AF, 0x029F }, 61 { 0x037B, 0x037D, 0x03FD }, 62 { 0x03AD, 0x03AF, 0x0388 }, 63 { 0x03B1, 0x03C1, 0x0391 }, 64 { 0x03C3, 0x03CB, 0x03A3 }, 65 { 0x03CD, 0x03CE, 0x038E }, 66 { 0x0430, 0x044F, 0x0410 }, 67 { 0x0450, 0x045F, 0x0400 }, 68 { 0x0561, 0x0586, 0x0531 }, 69 { 0x1D00, 0x1D2B, 0x1D00 }, 70 { 0x1D6B, 0x1D77, 0x1D6B }, 71 { 0x1D7A, 0x1D7C, 0x1D7A }, 72 { 0x1D7E, 0x1D9A, 0x1D7E }, 73 { 0x1E96, 0x1E9A, 0x1E96 }, 74 { 0x1E9C, 0x1E9D, 0x1E9C }, 75 { 0x1F00, 0x1F07, 0x1F08 }, 76 { 0x1F10, 0x1F15, 0x1F18 }, 77 { 0x1F20, 0x1F27, 0x1F28 }, 78 { 0x1F30, 0x1F37, 0x1F38 }, 79 { 0x1F40, 0x1F45, 0x1F48 }, 80 { 0x1F60, 0x1F67, 0x1F68 }, 81 { 0x1F70, 0x1F71, 0x1FBA }, 82 { 0x1F72, 0x1F75, 0x1FC8 }, 83 { 0x1F76, 0x1F77, 0x1FDA }, 84 { 0x1F78, 0x1F79, 0x1FF8 }, 85 { 0x1F7A, 0x1F7B, 0x1FEA }, 86 { 0x1F7C, 0x1F7D, 0x1FFA }, 87 { 0x1F80, 0x1F87, 0x1F88 }, 88 { 0x1F90, 0x1F97, 0x1F98 }, 89 { 0x1FA0, 0x1FA7, 0x1FA8 }, 90 { 0x1FB0, 0x1FB1, 0x1FB8 }, 91 { 0x1FB6, 0x1FB7, 0x1FB6 }, 92 { 0x1FC6, 0x1FC7, 0x1FC6 }, 93 { 0x1FD0, 0x1FD1, 0x1FD8 }, 94 { 0x1FD2, 0x1FD3, 0x1FD2 }, 95 { 0x1FD6, 0x1FD7, 0x1FD6 }, 96 { 0x1FE0, 0x1FE1, 0x1FE8 }, 97 { 0x1FE2, 0x1FE4, 0x1FE2 }, 98 { 0x1FE6, 0x1FE7, 0x1FE6 }, 99 { 0x1FF6, 0x1FF7, 0x1FF6 }, 100 { 0x210E, 0x210F, 0x210E }, 101 { 0x213C, 0x213D, 0x213C }, 102 { 0x2146, 0x2149, 0x2146 }, 103 { 0x2C30, 0x2C5E, 0x2C00 }, 104 { 0x2C77, 0x2C7B, 0x2C77 }, 105 { 0x2D00, 0x2D25, 0x10A0 }, 106 { 0xA730, 0xA731, 0xA730 }, 107 { 0xA771, 0xA778, 0xA771 }, 108 { 0xA794, 0xA795, 0xA794 }, 109 { 0xAB30, 0xAB5A, 0xAB30 }, 110 { 0xAB64, 0xAB65, 0xAB64 }, 111 { 0xFB00, 0xFB06, 0xFB00 }, 112 { 0xFB13, 0xFB17, 0xFB13 }, 113 { 0xFF41, 0xFF5A, 0xFF21 }, 114 { 0x10428, 0x1044F, 0x10400 }, 115 { 0x118C0, 0x118DF, 0x118A0 }, 116 { 0x1D41A, 0x1D433, 0x1D41A }, 117 { 0x1D44E, 0x1D454, 0x1D44E }, 118 { 0x1D456, 0x1D467, 0x1D456 }, 119 { 0x1D482, 0x1D49B, 0x1D482 }, 120 { 0x1D4B6, 0x1D4B9, 0x1D4B6 }, 121 { 0x1D4BD, 0x1D4C3, 0x1D4BD }, 122 { 0x1D4C5, 0x1D4CF, 0x1D4C5 }, 123 { 0x1D4EA, 0x1D503, 0x1D4EA }, 124 { 0x1D51E, 0x1D537, 0x1D51E }, 125 { 0x1D552, 0x1D56B, 0x1D552 }, 126 { 0x1D586, 0x1D59F, 0x1D586 }, 127 { 0x1D5BA, 0x1D5D3, 0x1D5BA }, 128 { 0x1D5EE, 0x1D607, 0x1D5EE }, 129 { 0x1D622, 0x1D63B, 0x1D622 }, 130 { 0x1D656, 0x1D66F, 0x1D656 }, 131 { 0x1D68A, 0x1D6A5, 0x1D68A }, 132 { 0x1D6C2, 0x1D6DA, 0x1D6C2 }, 133 { 0x1D6DC, 0x1D6E1, 0x1D6DC }, 134 { 0x1D6FC, 0x1D714, 0x1D6FC }, 135 { 0x1D716, 0x1D71B, 0x1D716 }, 136 { 0x1D736, 0x1D74E, 0x1D736 }, 137 { 0x1D750, 0x1D755, 0x1D750 }, 138 { 0x1D770, 0x1D788, 0x1D770 }, 139 { 0x1D78A, 0x1D78F, 0x1D78A }, 140 { 0x1D7AA, 0x1D7C2, 0x1D7AA }, 141 { 0x1D7C4, 0x1D7C9, 0x1D7C4 }, 142 }; 143 144 static Rune lower1[][2] = { 145 { 0x00B5, 0x039C }, 146 { 0x00DF, 0x00DF }, 147 { 0x00FF, 0x0178 }, 148 { 0x0131, 0x0049 }, 149 { 0x0138, 0x0138 }, 150 { 0x0149, 0x0149 }, 151 { 0x017F, 0x0053 }, 152 { 0x0180, 0x0243 }, 153 { 0x0188, 0x0187 }, 154 { 0x018C, 0x018B }, 155 { 0x018D, 0x018D }, 156 { 0x0192, 0x0191 }, 157 { 0x0195, 0x01F6 }, 158 { 0x0199, 0x0198 }, 159 { 0x019A, 0x023D }, 160 { 0x019B, 0x019B }, 161 { 0x019E, 0x0220 }, 162 { 0x01A8, 0x01A7 }, 163 { 0x01AD, 0x01AC }, 164 { 0x01B0, 0x01AF }, 165 { 0x01B9, 0x01B8 }, 166 { 0x01BA, 0x01BA }, 167 { 0x01BD, 0x01BC }, 168 { 0x01BE, 0x01BE }, 169 { 0x01BF, 0x01F7 }, 170 { 0x01C6, 0x01C4 }, 171 { 0x01C9, 0x01C7 }, 172 { 0x01CC, 0x01CA }, 173 { 0x01DD, 0x018E }, 174 { 0x01F0, 0x01F0 }, 175 { 0x01F3, 0x01F1 }, 176 { 0x01F5, 0x01F4 }, 177 { 0x0221, 0x0221 }, 178 { 0x023C, 0x023B }, 179 { 0x0242, 0x0241 }, 180 { 0x0250, 0x2C6F }, 181 { 0x0251, 0x2C6D }, 182 { 0x0252, 0x2C70 }, 183 { 0x0253, 0x0181 }, 184 { 0x0254, 0x0186 }, 185 { 0x0255, 0x0255 }, 186 { 0x0258, 0x0258 }, 187 { 0x0259, 0x018F }, 188 { 0x025A, 0x025A }, 189 { 0x025B, 0x0190 }, 190 { 0x025C, 0xA7AB }, 191 { 0x0260, 0x0193 }, 192 { 0x0261, 0xA7AC }, 193 { 0x0262, 0x0262 }, 194 { 0x0263, 0x0194 }, 195 { 0x0264, 0x0264 }, 196 { 0x0265, 0xA78D }, 197 { 0x0266, 0xA7AA }, 198 { 0x0267, 0x0267 }, 199 { 0x0268, 0x0197 }, 200 { 0x0269, 0x0196 }, 201 { 0x026A, 0x026A }, 202 { 0x026B, 0x2C62 }, 203 { 0x026C, 0xA7AD }, 204 { 0x026F, 0x019C }, 205 { 0x0270, 0x0270 }, 206 { 0x0271, 0x2C6E }, 207 { 0x0272, 0x019D }, 208 { 0x0275, 0x019F }, 209 { 0x027D, 0x2C64 }, 210 { 0x0280, 0x01A6 }, 211 { 0x0283, 0x01A9 }, 212 { 0x0287, 0xA7B1 }, 213 { 0x0288, 0x01AE }, 214 { 0x0289, 0x0244 }, 215 { 0x028C, 0x0245 }, 216 { 0x0292, 0x01B7 }, 217 { 0x0293, 0x0293 }, 218 { 0x029E, 0xA7B0 }, 219 { 0x0377, 0x0376 }, 220 { 0x0390, 0x0390 }, 221 { 0x03AC, 0x0386 }, 222 { 0x03B0, 0x03B0 }, 223 { 0x03C2, 0x03A3 }, 224 { 0x03CC, 0x038C }, 225 { 0x03D0, 0x0392 }, 226 { 0x03D1, 0x0398 }, 227 { 0x03D5, 0x03A6 }, 228 { 0x03D6, 0x03A0 }, 229 { 0x03D7, 0x03CF }, 230 { 0x03F0, 0x039A }, 231 { 0x03F1, 0x03A1 }, 232 { 0x03F2, 0x03F9 }, 233 { 0x03F3, 0x037F }, 234 { 0x03F5, 0x0395 }, 235 { 0x03F8, 0x03F7 }, 236 { 0x03FB, 0x03FA }, 237 { 0x03FC, 0x03FC }, 238 { 0x04CF, 0x04C0 }, 239 { 0x0587, 0x0587 }, 240 { 0x1D79, 0xA77D }, 241 { 0x1D7D, 0x2C63 }, 242 { 0x1E9B, 0x1E60 }, 243 { 0x1E9F, 0x1E9F }, 244 { 0x1F50, 0x1F50 }, 245 { 0x1F51, 0x1F59 }, 246 { 0x1F52, 0x1F52 }, 247 { 0x1F53, 0x1F5B }, 248 { 0x1F54, 0x1F54 }, 249 { 0x1F55, 0x1F5D }, 250 { 0x1F56, 0x1F56 }, 251 { 0x1F57, 0x1F5F }, 252 { 0x1FB2, 0x1FB2 }, 253 { 0x1FB3, 0x1FBC }, 254 { 0x1FB4, 0x1FB4 }, 255 { 0x1FBE, 0x0399 }, 256 { 0x1FC2, 0x1FC2 }, 257 { 0x1FC3, 0x1FCC }, 258 { 0x1FC4, 0x1FC4 }, 259 { 0x1FE5, 0x1FEC }, 260 { 0x1FF2, 0x1FF2 }, 261 { 0x1FF3, 0x1FFC }, 262 { 0x1FF4, 0x1FF4 }, 263 { 0x210A, 0x210A }, 264 { 0x2113, 0x2113 }, 265 { 0x212F, 0x212F }, 266 { 0x2134, 0x2134 }, 267 { 0x2139, 0x2139 }, 268 { 0x214E, 0x2132 }, 269 { 0x2184, 0x2183 }, 270 { 0x2C61, 0x2C60 }, 271 { 0x2C65, 0x023A }, 272 { 0x2C66, 0x023E }, 273 { 0x2C71, 0x2C71 }, 274 { 0x2C73, 0x2C72 }, 275 { 0x2C74, 0x2C74 }, 276 { 0x2C76, 0x2C75 }, 277 { 0x2CE4, 0x2CE4 }, 278 { 0x2CF3, 0x2CF2 }, 279 { 0x2D27, 0x10C7 }, 280 { 0x2D2D, 0x10CD }, 281 { 0xA78C, 0xA78B }, 282 { 0xA78E, 0xA78E }, 283 { 0xA7FA, 0xA7FA }, 284 { 0x1D4BB, 0x1D4BB }, 285 { 0x1D7CB, 0x1D7CB }, 286 }; 287 288 int 289 islowerrune(Rune r) 290 { 291 Rune *match; 292 293 if((match = bsearch(&r, lower4, nelem(lower4), sizeof *lower4, &rune2cmp))) 294 return !((r - match[0]) % 2); 295 if(bsearch(&r, lower2, nelem(lower2), sizeof *lower2, &rune2cmp)) 296 return 1; 297 if(bsearch(&r, lower1, nelem(lower1), sizeof *lower1, &rune1cmp)) 298 return 1; 299 return 0; 300 } 301 302 int 303 toupperrune(Rune r) 304 { 305 Rune *match; 306 307 match = bsearch(&r, lower4, nelem(lower4), sizeof *lower4, &rune2cmp); 308 if (match) 309 return ((r - match[0]) % 2) ? r : r - 1; 310 match = bsearch(&r, lower2, nelem(lower2), sizeof *lower2, &rune2cmp); 311 if (match) 312 return match[2] + (r - match[0]); 313 match = bsearch(&r, lower1, nelem(lower1), sizeof *lower1, &rune1cmp); 314 if (match) 315 return match[1]; 316 return r; 317 }