cptable.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Codepage tables
  3. *
  4. * Copyright 2000 Alexandre Julliard
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #include <stdlib.h>
  21. #include "wine/asm.h"
  22. #ifdef __ASM_OBSOLETE
  23. #include "unicode.h"
  24. /* Everything below this line is generated automatically by make_unicode */
  25. /* ### cpmap begin ### */
  26. extern union cptable cptable_037;
  27. extern union cptable cptable_437;
  28. extern union cptable cptable_500;
  29. extern union cptable cptable_737;
  30. extern union cptable cptable_775;
  31. extern union cptable cptable_850;
  32. extern union cptable cptable_852;
  33. extern union cptable cptable_855;
  34. extern union cptable cptable_857;
  35. extern union cptable cptable_860;
  36. extern union cptable cptable_861;
  37. extern union cptable cptable_862;
  38. extern union cptable cptable_863;
  39. extern union cptable cptable_864;
  40. extern union cptable cptable_865;
  41. extern union cptable cptable_866;
  42. extern union cptable cptable_869;
  43. extern union cptable cptable_874;
  44. extern union cptable cptable_875;
  45. extern union cptable cptable_932;
  46. extern union cptable cptable_936;
  47. extern union cptable cptable_949;
  48. extern union cptable cptable_950;
  49. extern union cptable cptable_1026;
  50. extern union cptable cptable_1250;
  51. extern union cptable cptable_1251;
  52. extern union cptable cptable_1252;
  53. extern union cptable cptable_1253;
  54. extern union cptable cptable_1254;
  55. extern union cptable cptable_1255;
  56. extern union cptable cptable_1256;
  57. extern union cptable cptable_1257;
  58. extern union cptable cptable_1258;
  59. extern union cptable cptable_1361;
  60. extern union cptable cptable_10000;
  61. extern union cptable cptable_10001;
  62. extern union cptable cptable_10002;
  63. extern union cptable cptable_10003;
  64. extern union cptable cptable_10004;
  65. extern union cptable cptable_10005;
  66. extern union cptable cptable_10006;
  67. extern union cptable cptable_10007;
  68. extern union cptable cptable_10008;
  69. extern union cptable cptable_10010;
  70. extern union cptable cptable_10017;
  71. extern union cptable cptable_10021;
  72. extern union cptable cptable_10029;
  73. extern union cptable cptable_10079;
  74. extern union cptable cptable_10081;
  75. extern union cptable cptable_10082;
  76. extern union cptable cptable_20127;
  77. extern union cptable cptable_20866;
  78. extern union cptable cptable_20932;
  79. extern union cptable cptable_21866;
  80. extern union cptable cptable_28591;
  81. extern union cptable cptable_28592;
  82. extern union cptable cptable_28593;
  83. extern union cptable cptable_28594;
  84. extern union cptable cptable_28595;
  85. extern union cptable cptable_28596;
  86. extern union cptable cptable_28597;
  87. extern union cptable cptable_28598;
  88. extern union cptable cptable_28599;
  89. extern union cptable cptable_28603;
  90. extern union cptable cptable_28605;
  91. static const union cptable * const cptables[65] =
  92. {
  93. &cptable_037,
  94. &cptable_437,
  95. &cptable_500,
  96. &cptable_737,
  97. &cptable_775,
  98. &cptable_850,
  99. &cptable_852,
  100. &cptable_855,
  101. &cptable_857,
  102. &cptable_860,
  103. &cptable_861,
  104. &cptable_862,
  105. &cptable_863,
  106. &cptable_864,
  107. &cptable_865,
  108. &cptable_866,
  109. &cptable_869,
  110. &cptable_874,
  111. &cptable_875,
  112. &cptable_932,
  113. &cptable_936,
  114. &cptable_949,
  115. &cptable_950,
  116. &cptable_1026,
  117. &cptable_1250,
  118. &cptable_1251,
  119. &cptable_1252,
  120. &cptable_1253,
  121. &cptable_1254,
  122. &cptable_1255,
  123. &cptable_1256,
  124. &cptable_1257,
  125. &cptable_1258,
  126. &cptable_1361,
  127. &cptable_10000,
  128. &cptable_10001,
  129. &cptable_10002,
  130. &cptable_10003,
  131. &cptable_10004,
  132. &cptable_10005,
  133. &cptable_10006,
  134. &cptable_10007,
  135. &cptable_10008,
  136. &cptable_10010,
  137. &cptable_10017,
  138. &cptable_10021,
  139. &cptable_10029,
  140. &cptable_10079,
  141. &cptable_10081,
  142. &cptable_10082,
  143. &cptable_20127,
  144. &cptable_20866,
  145. &cptable_20932,
  146. &cptable_21866,
  147. &cptable_28591,
  148. &cptable_28592,
  149. &cptable_28593,
  150. &cptable_28594,
  151. &cptable_28595,
  152. &cptable_28596,
  153. &cptable_28597,
  154. &cptable_28598,
  155. &cptable_28599,
  156. &cptable_28603,
  157. &cptable_28605,
  158. };
  159. /* ### cpmap end ### */
  160. /* Everything above this line is generated automatically by make_unicode */
  161. static int cmp_codepage( const void *codepage, const void *entry )
  162. {
  163. return *(const unsigned int *)codepage - (*(const union cptable *const *)entry)->info.codepage;
  164. }
  165. /* get the table of a given code page */
  166. const union cptable *wine_cp_get_table_obsolete( unsigned int codepage )
  167. {
  168. const union cptable **res;
  169. if (!(res = bsearch( &codepage, cptables, ARRAY_SIZE( cptables ),
  170. sizeof(cptables[0]), cmp_codepage ))) return NULL;
  171. return *res;
  172. }
  173. /* enum valid codepages */
  174. const union cptable *wine_cp_enum_table_obsolete( unsigned int index )
  175. {
  176. if (index >= ARRAY_SIZE( cptables )) return NULL;
  177. return cptables[index];
  178. }
  179. int wine_is_dbcs_leadbyte_obsolete( const union cptable *table, unsigned char ch )
  180. {
  181. return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]);
  182. }
  183. __ASM_OBSOLETE(wine_cp_get_table);
  184. __ASM_OBSOLETE(wine_cp_enum_table);
  185. __ASM_OBSOLETE(wine_is_dbcs_leadbyte);
  186. #endif /* __ASM_OBSOLETE */