af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Codepage tables
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright 2000 Alexandre Julliard
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is free software; you can redistribute it and/or
af062818b47340eef15700d2f0211576ba3506eevboxsync * modify it under the terms of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License as published by the Free Software Foundation; either
af062818b47340eef15700d2f0211576ba3506eevboxsync * version 2.1 of the License, or (at your option) any later version.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is distributed in the hope that it will be useful,
af062818b47340eef15700d2f0211576ba3506eevboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
af062818b47340eef15700d2f0211576ba3506eevboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * Lesser General Public License for more details.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * You should have received a copy of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License along with this library; if not, write to the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync/*
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * a choice of LGPL license versions is made available with the language indicating
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * of the LGPL is applied is otherwise unspecified.
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync */
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync
114410893548b9522c46fdcbd8f63385eb8bfb68vboxsync#include "config.h"
114410893548b9522c46fdcbd8f63385eb8bfb68vboxsync#include "wine/port.h"
114410893548b9522c46fdcbd8f63385eb8bfb68vboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <stdlib.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include "wine/unicode.h"
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* Everything below this line is generated automatically by cpmap.pl */
af062818b47340eef15700d2f0211576ba3506eevboxsync/* ### cpmap begin ### */
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_037;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_424;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_437;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_500;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_737;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_775;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_850;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_852;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_855;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_856;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_857;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_860;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_861;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_862;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_863;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_864;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_865;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_866;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_869;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_874;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_875;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_878;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_932;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_936;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_949;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_950;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1006;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1026;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1250;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1251;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1252;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1253;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1254;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1255;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1256;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1257;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1258;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_1361;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10000;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10006;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10007;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10029;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10079;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_10081;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_20127;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_20866;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_20932;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_21866;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28591;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28592;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28593;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28594;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28595;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28596;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28597;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28598;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28599;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28600;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28603;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28604;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28605;
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern union cptable cptable_28606;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic const union cptable * const cptables[62] =
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_037,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_424,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_437,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_500,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_737,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_775,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_850,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_852,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_855,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_856,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_857,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_860,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_861,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_862,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_863,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_864,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_865,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_866,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_869,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_874,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_875,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_878,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_932,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_936,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_949,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_950,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1006,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1026,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1250,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1251,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1252,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1253,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1254,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1255,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1256,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1257,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1258,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_1361,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10000,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10006,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10007,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10029,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10079,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_10081,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_20127,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_20866,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_20932,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_21866,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28591,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28592,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28593,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28594,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28595,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28596,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28597,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28598,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28599,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28600,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28603,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28604,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28605,
af062818b47340eef15700d2f0211576ba3506eevboxsync &cptable_28606,
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync/* ### cpmap end ### */
af062818b47340eef15700d2f0211576ba3506eevboxsync/* Everything above this line is generated automatically by cpmap.pl */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define NB_CODEPAGES (sizeof(cptables)/sizeof(cptables[0]))
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic int cmp_codepage( const void *codepage, const void *entry )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return *(const unsigned int *)codepage - (*(const union cptable *const *)entry)->info.codepage;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* get the table of a given code page */
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst union cptable *wine_cp_get_table( unsigned int codepage )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const union cptable **res;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync if (!(res = bsearch( &codepage, cptables, NB_CODEPAGES,
af062818b47340eef15700d2f0211576ba3506eevboxsync sizeof(cptables[0]), cmp_codepage ))) return NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *res;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* enum valid codepages */
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst union cptable *wine_cp_enum_table( unsigned int index )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (index >= NB_CODEPAGES) return NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync return cptables[index];
af062818b47340eef15700d2f0211576ba3506eevboxsync}