ISO8859InputCodingSystem.C 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: ISO8859InputCodingSystem.C /main/1 1996/07/29 16:53:56 cde-hp $ */
  24. // Copyright (c) 1995 James Clark
  25. // See the file COPYING for copying permission.
  26. #include "splib.h"
  27. #ifdef SP_MULTI_BYTE
  28. #include "ISO8859InputCodingSystem.h"
  29. #include "macros.h"
  30. #ifdef SP_NAMESPACE
  31. namespace SP_NAMESPACE {
  32. #endif
  33. inline const Char *ISO8859InputCodingSystem::partMap(int part)
  34. {
  35. ASSERT(2 <= part && part <= 9);
  36. return maps[part - 2];
  37. }
  38. ISO8859InputCodingSystem::ISO8859InputCodingSystem(int part)
  39. : TranslateInputCodingSystem(partMap(part))
  40. {
  41. }
  42. #define INVALID 0xFFFD
  43. // Tables mapping ISO 8859-2 through ISO 8859-9 to ISO 10646.
  44. // Generated from Unicode Consortium data.
  45. const Char ISO8859InputCodingSystem::maps[8][256] = {
  46. {
  47. 0, 1, 2, 3, 4, 5, 6, 7,
  48. 8, 9, 10, 11, 12, 13, 14, 15,
  49. 16, 17, 18, 19, 20, 21, 22, 23,
  50. 24, 25, 26, 27, 28, 29, 30, 31,
  51. 32, 33, 34, 35, 36, 37, 38, 39,
  52. 40, 41, 42, 43, 44, 45, 46, 47,
  53. 48, 49, 50, 51, 52, 53, 54, 55,
  54. 56, 57, 58, 59, 60, 61, 62, 63,
  55. 64, 65, 66, 67, 68, 69, 70, 71,
  56. 72, 73, 74, 75, 76, 77, 78, 79,
  57. 80, 81, 82, 83, 84, 85, 86, 87,
  58. 88, 89, 90, 91, 92, 93, 94, 95,
  59. 96, 97, 98, 99, 100, 101, 102, 103,
  60. 104, 105, 106, 107, 108, 109, 110, 111,
  61. 112, 113, 114, 115, 116, 117, 118, 119,
  62. 120, 121, 122, 123, 124, 125, 126, 127,
  63. 128, 129, 130, 131, 132, 133, 134, 135,
  64. 136, 137, 138, 139, 140, 141, 142, 143,
  65. 144, 145, 146, 147, 148, 149, 150, 151,
  66. 152, 153, 154, 155, 156, 157, 158, 159,
  67. 160, 260, 728, 321, 164, 317, 346, 167,
  68. 168, 352, 350, 356, 377, 173, 381, 379,
  69. 176, 261, 731, 322, 180, 318, 347, 711,
  70. 184, 353, 351, 357, 378, 733, 382, 380,
  71. 340, 193, 194, 258, 196, 313, 262, 199,
  72. 268, 201, 280, 203, 282, 205, 206, 270,
  73. 272, 323, 327, 211, 212, 336, 214, 215,
  74. 344, 366, 218, 368, 220, 221, 354, 223,
  75. 341, 225, 226, 259, 228, 314, 263, 231,
  76. 269, 233, 281, 235, 283, 237, 238, 271,
  77. 273, 324, 328, 243, 244, 337, 246, 247,
  78. 345, 367, 250, 369, 252, 253, 355, 729,
  79. },
  80. {
  81. 0, 1, 2, 3, 4, 5, 6, 7,
  82. 8, 9, 10, 11, 12, 13, 14, 15,
  83. 16, 17, 18, 19, 20, 21, 22, 23,
  84. 24, 25, 26, 27, 28, 29, 30, 31,
  85. 32, 33, 34, 35, 36, 37, 38, 39,
  86. 40, 41, 42, 43, 44, 45, 46, 47,
  87. 48, 49, 50, 51, 52, 53, 54, 55,
  88. 56, 57, 58, 59, 60, 61, 62, 63,
  89. 64, 65, 66, 67, 68, 69, 70, 71,
  90. 72, 73, 74, 75, 76, 77, 78, 79,
  91. 80, 81, 82, 83, 84, 85, 86, 87,
  92. 88, 89, 90, 91, 92, 93, 94, 95,
  93. 96, 97, 98, 99, 100, 101, 102, 103,
  94. 104, 105, 106, 107, 108, 109, 110, 111,
  95. 112, 113, 114, 115, 116, 117, 118, 119,
  96. 120, 121, 122, 123, 124, 125, 126, 127,
  97. 128, 129, 130, 131, 132, 133, 134, 135,
  98. 136, 137, 138, 139, 140, 141, 142, 143,
  99. 144, 145, 146, 147, 148, 149, 150, 151,
  100. 152, 153, 154, 155, 156, 157, 158, 159,
  101. 160, 294, 728, 163, 164, INVALID, 292, 167,
  102. 168, 304, 350, 286, 308, 173, INVALID, 379,
  103. 176, 295, 178, 179, 180, 181, 293, 183,
  104. 184, 305, 351, 287, 309, 189, INVALID, 380,
  105. 192, 193, 194, INVALID, 196, 266, 264, 199,
  106. 200, 201, 202, 203, 204, 205, 206, 207,
  107. INVALID, 209, 210, 211, 212, 288, 214, 215,
  108. 284, 217, 218, 219, 220, 364, 348, 223,
  109. 224, 225, 226, INVALID, 228, 267, 265, 231,
  110. 232, 233, 234, 235, 236, 237, 238, 239,
  111. INVALID, 241, 242, 243, 244, 289, 246, 247,
  112. 285, 249, 250, 251, 252, 365, 349, 729,
  113. },
  114. {
  115. 0, 1, 2, 3, 4, 5, 6, 7,
  116. 8, 9, 10, 11, 12, 13, 14, 15,
  117. 16, 17, 18, 19, 20, 21, 22, 23,
  118. 24, 25, 26, 27, 28, 29, 30, 31,
  119. 32, 33, 34, 35, 36, 37, 38, 39,
  120. 40, 41, 42, 43, 44, 45, 46, 47,
  121. 48, 49, 50, 51, 52, 53, 54, 55,
  122. 56, 57, 58, 59, 60, 61, 62, 63,
  123. 64, 65, 66, 67, 68, 69, 70, 71,
  124. 72, 73, 74, 75, 76, 77, 78, 79,
  125. 80, 81, 82, 83, 84, 85, 86, 87,
  126. 88, 89, 90, 91, 92, 93, 94, 95,
  127. 96, 97, 98, 99, 100, 101, 102, 103,
  128. 104, 105, 106, 107, 108, 109, 110, 111,
  129. 112, 113, 114, 115, 116, 117, 118, 119,
  130. 120, 121, 122, 123, 124, 125, 126, 127,
  131. 128, 129, 130, 131, 132, 133, 134, 135,
  132. 136, 137, 138, 139, 140, 141, 142, 143,
  133. 144, 145, 146, 147, 148, 149, 150, 151,
  134. 152, 153, 154, 155, 156, 157, 158, 159,
  135. 160, 260, 312, 342, 164, 296, 315, 167,
  136. 168, 352, 274, 290, 358, 173, 381, 175,
  137. 176, 261, 731, 343, 180, 297, 316, 711,
  138. 184, 353, 275, 291, 359, 330, 382, 331,
  139. 256, 193, 194, 195, 196, 197, 198, 302,
  140. 268, 201, 280, 203, 278, 205, 206, 298,
  141. 272, 325, 332, 310, 212, 213, 214, 215,
  142. 216, 370, 218, 219, 220, 360, 362, 223,
  143. 257, 225, 226, 227, 228, 229, 230, 303,
  144. 269, 233, 281, 235, 279, 237, 238, 299,
  145. 273, 326, 333, 311, 244, 245, 246, 247,
  146. 248, 371, 250, 251, 252, 361, 363, 729,
  147. },
  148. {
  149. 0, 1, 2, 3, 4, 5, 6, 7,
  150. 8, 9, 10, 11, 12, 13, 14, 15,
  151. 16, 17, 18, 19, 20, 21, 22, 23,
  152. 24, 25, 26, 27, 28, 29, 30, 31,
  153. 32, 33, 34, 35, 36, 37, 38, 39,
  154. 40, 41, 42, 43, 44, 45, 46, 47,
  155. 48, 49, 50, 51, 52, 53, 54, 55,
  156. 56, 57, 58, 59, 60, 61, 62, 63,
  157. 64, 65, 66, 67, 68, 69, 70, 71,
  158. 72, 73, 74, 75, 76, 77, 78, 79,
  159. 80, 81, 82, 83, 84, 85, 86, 87,
  160. 88, 89, 90, 91, 92, 93, 94, 95,
  161. 96, 97, 98, 99, 100, 101, 102, 103,
  162. 104, 105, 106, 107, 108, 109, 110, 111,
  163. 112, 113, 114, 115, 116, 117, 118, 119,
  164. 120, 121, 122, 123, 124, 125, 126, 127,
  165. 128, 129, 130, 131, 132, 133, 134, 135,
  166. 136, 137, 138, 139, 140, 141, 142, 143,
  167. 144, 145, 146, 147, 148, 149, 150, 151,
  168. 152, 153, 154, 155, 156, 157, 158, 159,
  169. 160, 1025, 1026, 1027, 1028, 1029, 1030, 1031,
  170. 1032, 1033, 1034, 1035, 1036, 173, 1038, 1039,
  171. 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
  172. 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
  173. 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
  174. 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
  175. 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
  176. 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
  177. 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
  178. 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
  179. 8470, 1105, 1106, 1107, 1108, 1109, 1110, 1111,
  180. 1112, 1113, 1114, 1115, 1116, 167, 1118, 1119,
  181. },
  182. {
  183. 0, 1, 2, 3, 4, 5, 6, 7,
  184. 8, 9, 10, 11, 12, 13, 14, 15,
  185. 16, 17, 18, 19, 20, 21, 22, 23,
  186. 24, 25, 26, 27, 28, 29, 30, 31,
  187. 32, 33, 34, 35, 36, 37, 38, 39,
  188. 40, 41, 42, 43, 44, 45, 46, 47,
  189. 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639,
  190. 1640, 1641, 58, 59, 60, 61, 62, 63,
  191. 64, 65, 66, 67, 68, 69, 70, 71,
  192. 72, 73, 74, 75, 76, 77, 78, 79,
  193. 80, 81, 82, 83, 84, 85, 86, 87,
  194. 88, 89, 90, 91, 92, 93, 94, 95,
  195. 96, 97, 98, 99, 100, 101, 102, 103,
  196. 104, 105, 106, 107, 108, 109, 110, 111,
  197. 112, 113, 114, 115, 116, 117, 118, 119,
  198. 120, 121, 122, 123, 124, 125, 126, 127,
  199. 128, 129, 130, 131, 132, 133, 134, 135,
  200. 136, 137, 138, 139, 140, 141, 142, 143,
  201. 144, 145, 146, 147, 148, 149, 150, 151,
  202. 152, 153, 154, 155, 156, 157, 158, 159,
  203. 160, INVALID, INVALID, INVALID, 164, INVALID, INVALID, INVALID,
  204. INVALID, INVALID, INVALID, INVALID, 1548, 173, INVALID, INVALID,
  205. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
  206. INVALID, INVALID, INVALID, 1563, INVALID, INVALID, INVALID, 1567,
  207. INVALID, 1569, 1570, 1571, 1572, 1573, 1574, 1575,
  208. 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583,
  209. 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591,
  210. 1592, 1593, 1594, INVALID, INVALID, INVALID, INVALID, INVALID,
  211. 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
  212. 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615,
  213. 1616, 1617, 1618, INVALID, INVALID, INVALID, INVALID, INVALID,
  214. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
  215. },
  216. {
  217. 0, 1, 2, 3, 4, 5, 6, 7,
  218. 8, 9, 10, 11, 12, 13, 14, 15,
  219. 16, 17, 18, 19, 20, 21, 22, 23,
  220. 24, 25, 26, 27, 28, 29, 30, 31,
  221. 32, 33, 34, 35, 36, 37, 38, 39,
  222. 40, 41, 42, 43, 44, 45, 46, 47,
  223. 48, 49, 50, 51, 52, 53, 54, 55,
  224. 56, 57, 58, 59, 60, 61, 62, 63,
  225. 64, 65, 66, 67, 68, 69, 70, 71,
  226. 72, 73, 74, 75, 76, 77, 78, 79,
  227. 80, 81, 82, 83, 84, 85, 86, 87,
  228. 88, 89, 90, 91, 92, 93, 94, 95,
  229. 96, 97, 98, 99, 100, 101, 102, 103,
  230. 104, 105, 106, 107, 108, 109, 110, 111,
  231. 112, 113, 114, 115, 116, 117, 118, 119,
  232. 120, 121, 122, 123, 124, 125, 126, 127,
  233. 128, 129, 130, 131, 132, 133, 134, 135,
  234. 136, 137, 138, 139, 140, 141, 142, 143,
  235. 144, 145, 146, 147, 148, 149, 150, 151,
  236. 152, 153, 154, 155, 156, 157, 158, 159,
  237. 160, 701, 700, 163, INVALID, INVALID, 166, 167,
  238. 168, 169, INVALID, 171, 172, 173, INVALID, 8213,
  239. 176, 177, 178, 179, 900, 901, 902, 183,
  240. 904, 905, 906, 187, 908, 189, 910, 911,
  241. 912, 913, 914, 915, 916, 917, 918, 919,
  242. 920, 921, 922, 923, 924, 925, 926, 927,
  243. 928, 929, INVALID, 931, 932, 933, 934, 935,
  244. 936, 937, 938, 939, 940, 941, 942, 943,
  245. 944, 945, 946, 947, 948, 949, 950, 951,
  246. 952, 953, 954, 955, 956, 957, 958, 959,
  247. 960, 961, 962, 963, 964, 965, 966, 967,
  248. 968, 969, 970, 971, 972, 973, 974, INVALID,
  249. },
  250. {
  251. 0, 1, 2, 3, 4, 5, 6, 7,
  252. 8, 9, 10, 11, 12, 13, 14, 15,
  253. 16, 17, 18, 19, 20, 21, 22, 23,
  254. 24, 25, 26, 27, 28, 29, 30, 31,
  255. 32, 33, 34, 35, 36, 37, 38, 39,
  256. 40, 41, 42, 43, 44, 45, 46, 47,
  257. 48, 49, 50, 51, 52, 53, 54, 55,
  258. 56, 57, 58, 59, 60, 61, 62, 63,
  259. 64, 65, 66, 67, 68, 69, 70, 71,
  260. 72, 73, 74, 75, 76, 77, 78, 79,
  261. 80, 81, 82, 83, 84, 85, 86, 87,
  262. 88, 89, 90, 91, 92, 93, 94, 95,
  263. 96, 97, 98, 99, 100, 101, 102, 103,
  264. 104, 105, 106, 107, 108, 109, 110, 111,
  265. 112, 113, 114, 115, 116, 117, 118, 119,
  266. 120, 121, 122, 123, 124, 125, 126, 127,
  267. 128, 129, 130, 131, 132, 133, 134, 135,
  268. 136, 137, 138, 139, 140, 141, 142, 143,
  269. 144, 145, 146, 147, 148, 149, 150, 151,
  270. 152, 153, 154, 155, 156, 157, 158, 159,
  271. 160, INVALID, 162, 163, 164, 165, 166, 167,
  272. 168, 169, 215, 171, 172, 173, 174, 8254,
  273. 176, 177, 178, 179, 180, 181, 182, 183,
  274. 184, 185, 247, 187, 188, 189, 190, INVALID,
  275. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
  276. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
  277. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
  278. INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, 8215,
  279. 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
  280. 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503,
  281. 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511,
  282. 1512, 1513, 1514, INVALID, INVALID, INVALID, INVALID, INVALID,
  283. },
  284. {
  285. 0, 1, 2, 3, 4, 5, 6, 7,
  286. 8, 9, 10, 11, 12, 13, 14, 15,
  287. 16, 17, 18, 19, 20, 21, 22, 23,
  288. 24, 25, 26, 27, 28, 29, 30, 31,
  289. 32, 33, 34, 35, 36, 37, 38, 39,
  290. 40, 41, 42, 43, 44, 45, 46, 47,
  291. 48, 49, 50, 51, 52, 53, 54, 55,
  292. 56, 57, 58, 59, 60, 61, 62, 63,
  293. 64, 65, 66, 67, 68, 69, 70, 71,
  294. 72, 73, 74, 75, 76, 77, 78, 79,
  295. 80, 81, 82, 83, 84, 85, 86, 87,
  296. 88, 89, 90, 91, 92, 93, 94, 95,
  297. 96, 97, 98, 99, 100, 101, 102, 103,
  298. 104, 105, 106, 107, 108, 109, 110, 111,
  299. 112, 113, 114, 115, 116, 117, 118, 119,
  300. 120, 121, 122, 123, 124, 125, 126, 127,
  301. 128, 129, 130, 131, 132, 133, 134, 135,
  302. 136, 137, 138, 139, 140, 141, 142, 143,
  303. 144, 145, 146, 147, 148, 149, 150, 151,
  304. 152, 153, 154, 155, 156, 157, 158, 159,
  305. 160, 161, 162, 163, 164, 165, 166, 167,
  306. 168, 169, 170, 171, 172, 173, 174, 175,
  307. 176, 177, 178, 179, 180, 181, 182, 183,
  308. 184, 185, 186, 187, 188, 189, 190, 191,
  309. 192, 193, 194, 195, 196, 197, 198, 199,
  310. 200, 201, 202, 203, 204, 205, 206, 207,
  311. 286, 209, 210, 211, 212, 213, 214, 215,
  312. 216, 217, 218, 219, 220, 304, 350, 223,
  313. 224, 225, 226, 227, 228, 229, 230, 231,
  314. 232, 233, 234, 235, 236, 237, 238, 239,
  315. 287, 241, 242, 243, 244, 245, 246, 247,
  316. 248, 249, 250, 251, 252, 305, 351, 255,
  317. }
  318. };
  319. #ifdef SP_NAMESPACE
  320. }
  321. #endif
  322. #else /* not SP_MULTI_BYTE */
  323. #ifndef __GNUG__
  324. static char non_empty_translation_unit; // sigh
  325. #endif
  326. #endif /* not SP_MULTI_BYTE */