update dev300-m58
[ooovba.git] / sal / textenc / tables.cxx
blobc414b56917ea3dc16bc6daf3d87c68cc4a81f1cd
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile$
7 * $Revision$
9 * last change: $Author$ $Date$
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 /* TODO! This file should not be called textenc.c, because it is not the
37 implementation of rtl/textenc.h. Rather, it should be called
38 gettextencodingdata.c. */
40 #ifndef INCLUDED_RTL_TEXTENC_GETTEXTENCODINGDATA_H
41 #include "gettextencodingdata.h"
42 #endif
44 #ifndef INCLUDED_RTL_TEXTENC_TENCHELP_H
45 #include "tenchelp.h"
46 #endif
48 #ifndef _RTL_TEXTENC_H
49 #include "rtl/textenc.h"
50 #endif
52 #ifndef INCLUDED_STDDEF_H
53 #include <stddef.h>
54 #define INCLUDED_STDDEF_H
55 #endif
57 #define NOTABUNI_START 0xFF
58 #define NOTABUNI_END 0x00
60 #define NOTABCHAR_START 0xFFFF
61 #define NOTABCHAR_END 0x0000
63 #define SAME8090UNI_START 0x80
64 #define SAME8090UNI_END 0x9F
65 static sal_uInt16 const aImpl8090SameToUniTab[SAME8090UNI_END
66 - SAME8090UNI_START
67 + 1]
68 = { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, /* 0x80 */
69 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
70 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, /* 0x90 */
71 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F };
73 #define SAME8090CHAR_START 0x0080
74 #define SAME8090CHAR_END 0x009F
75 static sal_uChar const aImpl8090SameToCharTab[SAME8090CHAR_END
76 - SAME8090CHAR_START
77 + 1]
78 = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x0080 */
79 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
80 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x0090 */
81 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F };
83 #define SAMEA0FFCHAR_START 0x00A0
84 #define SAMEA0FFCHAR_END 0x00FF
85 static sal_uChar const aImplA0FFSameToCharTab[SAMEA0FFCHAR_END
86 - SAMEA0FFCHAR_START
87 + 1]
88 = { 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, /* 0x00A0 */
89 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
90 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, /* 0x00B0 */
91 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
92 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 0x00C0 */
93 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
94 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 0x00D0 */
95 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
96 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* 0x00E0 */
97 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
98 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 0x00F0 */
99 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF };
101 static sal_uInt16 const aImplDoubleByteIdentifierTab[1] = { 0 };
103 #include "tcvtarb1.tab"
104 #include "tcvteas1.tab"
105 #include "tcvtest1.tab"
106 #include "tcvtjp1.tab"
107 #include "tcvtjp2.tab"
108 #include "tcvtjp3.tab"
109 #include "tcvtjp4.tab"
110 #include "tcvtjp5.tab"
111 #include "tcvtjp6.tab"
112 #include "tcvtkr1.tab"
113 #include "tcvtkr2.tab"
114 #include "tcvtkr4.tab"
115 #include "tcvtkr5.tab"
116 #include "tcvtkr6.tab"
117 #include "tcvtlat1.tab"
118 #include "tcvtscn1.tab"
119 #include "tcvtscn2.tab"
120 #include "tcvtscn3.tab"
121 #include "tcvtscn4.tab"
122 #include "tcvtscn5.tab"
123 #include "tcvtscn6.tab"
124 #include "tcvtsym1.tab"
125 #include "tcvttcn1.tab"
126 #include "tcvttcn2.tab"
127 #include "tcvttcn6.tab"
128 #include "tcvtuni1.tab"
129 #include "convertiscii.tab"
131 #include "convertbig5hkscs.tab"
132 #include "converteuctw.tab"
133 #include "convertgb18030.tab"
134 #include "convertiso2022cn.tab"
135 #include "convertiso2022jp.tab"
136 #include "convertiso2022kr.tab"
137 #include "convertadobe.tab"
139 ImplTextEncodingData const *
140 Impl_getTextEncodingData(rtl_TextEncoding nEncoding)
142 static ImplTextEncodingData const * const aData[]
143 = { NULL, /* DONTKNOW */
144 &aImplMS1252TextEncodingData, /* MS_1252 */
145 &aImplAPPLEROMANTextEncodingData, /* APPLE_ROMAN */
146 &aImplIBM437TextEncodingData, /* IBM_437 */
147 &aImplIBM850TextEncodingData, /* IBM_850 */
148 &aImplIBM860TextEncodingData, /* IBM_860 */
149 &aImplIBM861TextEncodingData, /* IBM_861 */
150 &aImplIBM863TextEncodingData, /* IBM_863 */
151 &aImplIBM865TextEncodingData, /* IBM_865 */
152 NULL, /* reserved (SYSTEM) */
153 &aImplSYMBOLTextEncodingData, /* SYMBOL */
154 &aImplUSASCIITextEncodingData, /* ASCII_US */
155 &aImplISO88591TextEncodingData, /* ISO_8859_1 */
156 &aImplISO88592TextEncodingData, /* ISO_8859_2 */
157 &aImplISO88593TextEncodingData, /* ISO_8859_3 */
158 &aImplISO88594TextEncodingData, /* ISO_8859_4 */
159 &aImplISO88595TextEncodingData, /* ISO_8859_5 */
160 &aImplISO88596TextEncodingData, /* ISO_8859_6 */
161 &aImplISO88597TextEncodingData, /* ISO_8859_7 */
162 &aImplISO88598TextEncodingData, /* ISO_8859_8 */
163 &aImplISO88599TextEncodingData, /* ISO_8859_9 */
164 &aImplISO885914TextEncodingData, /* ISO_8859_14 */
165 &aImplISO885915TextEncodingData, /* ISO_8859_15 */
166 &aImplIBM737TextEncodingData, /* IBM_737 */
167 &aImplIBM775TextEncodingData, /* IBM_775 */
168 &aImplIBM852TextEncodingData, /* IBM_852 */
169 &aImplIBM855TextEncodingData, /* IBM_855 */
170 &aImplIBM857TextEncodingData, /* IBM_857 */
171 &aImplIBM862TextEncodingData, /* IBM_862 */
172 &aImplIBM864TextEncodingData, /* IBM_864 */
173 &aImplIBM866TextEncodingData, /* IBM_866 */
174 &aImplIBM869TextEncodingData, /* IBM_869 */
175 &aImplMS874TextEncodingData, /* MS_874 */
176 &aImplMS1250TextEncodingData, /* MS_1250 */
177 &aImplMS1251TextEncodingData, /* MS_1251 */
178 &aImplMS1253TextEncodingData, /* MS_1253 */
179 &aImplMS1254TextEncodingData, /* MS_1254 */
180 &aImplMS1255TextEncodingData, /* MS_1255 */
181 &aImplMS1256TextEncodingData, /* MS_1256 */
182 &aImplMS1257TextEncodingData, /* MS_1257 */
183 &aImplMS1258TextEncodingData, /* MS_1258 */
184 NULL, /* TODO! APPLE_ARABIC */
185 &aImplAPPLECENTEUROTextEncodingData, /* APPLE_CENTEURO */
186 &aImplAPPLECROATIANTextEncodingData, /* APPLE_CROATIAN */
187 &aImplAPPLECYRILLICTextEncodingData, /* APPLE_CYRILLIC */
188 NULL, /* TODO! APPLE_DEVANAGARI */
189 NULL, /* TODO! APPLE_FARSI */
190 &aImplAPPLEGREEKTextEncodingData, /* APPLE_GREEK */
191 NULL, /* TODO! APPLE_GUJARATI */
192 NULL, /* TODO! APPLE_GURMUKHI */
193 NULL, /* TODO! APPLE_HEBREW */
194 &aImplAPPLEICELANDTextEncodingData, /* APPLE_ICELAND */
195 &aImplAPPLEROMANIANTextEncodingData, /* APPLE_ROMANIAN */
196 NULL, /* TODO! APPLE_THAI */
197 &aImplAPPLETURKISHTextEncodingData, /* APPLE_TURKISH */
198 &aImplAPPLEUKRAINIANTextEncodingData, /* APPLE_UKRAINIAN */
199 &aImplAPPLECHINSIMPTextEncodingData, /* APPLE_CHINSIMP */
200 &aImplAPPLECHINTRADTextEncodingData, /* APPLE_CHINTRAD */
201 &aImplAPPLEJAPANESETextEncodingData, /* APPLE_JAPANESE */
202 &aImplAPPLEKOREANTextEncodingData, /* APPLE_KOREAN */
203 &aImplMS932TextEncodingData, /* MS_932 */
204 &aImplMS936TextEncodingData, /* MS_936 */
205 &aImplMS949TextEncodingData, /* MS_949 */
206 &aImplMS950TextEncodingData, /* MS_950 */
207 &aImplSJISTextEncodingData, /* SHIFT_JIS */
208 &aImplGB2312TextEncodingData, /* GB_2312 */
209 &aImplGBT12345TextEncodingData, /* GBT_12345 */
210 &aImplGBKTextEncodingData, /* GBK */
211 &aImplBIG5TextEncodingData, /* BIG5 */
212 &aImplEUCJPTextEncodingData, /* EUC_JP */
213 &aImplEUCCNTextEncodingData, /* EUC_CN */
214 &aImplEucTwTextEncodingData, /* EUC_TW */
215 &aImplIso2022JpTextEncodingData, /* ISO_2022_JP */
216 &aImplIso2022CnTextEncodingData, /* ISO_2022_CN */
217 &aImplKOI8RTextEncodingData, /* KOI8_R */
218 &aImplUTF7TextEncodingData, /* UTF7 */
219 &aImplUTF8TextEncodingData, /* UTF8 */
220 &aImplISO885910TextEncodingData, /* ISO_8859_10 */
221 &aImplISO885913TextEncodingData, /* ISO_8859_13 */
222 &aImplEUCKRTextEncodingData, /* EUC_KR */
223 &aImplIso2022KrTextEncodingData, /* ISO_2022_KR */
224 &aImplJISX0201TextEncodingData, /* JIS_X_0201 */
225 &aImplJISX0208TextEncodingData, /* JIS_X_0208 */
226 &aImplJISX0212TextEncodingData, /* JIS_X_0212 */
227 &aImplMS1361TextEncodingData, /* MS_1361 */
228 &aImplGb18030TextEncodingData, /* GB_18030 */
229 &aImplBig5HkscsTextEncodingData, /* BIG5_HKSCS */
230 &aImplTis620TextEncodingData, /* TIS_620 */
231 &aImplKoi8UTextEncodingData, /* KOI8_U */
232 &aImplIsciiDevanagariTextEncodingData, /* ISCII_DEVANAGARI */
233 &aImplJavaUtf8TextEncodingData, /* JAVA_UTF8 */
234 &adobeStandardEncodingData, /* ADOBE_STANDARD */
235 &adobeSymbolEncodingData, /* ADOBE_SYMBOL */
236 &aImplPT154TextEncodingData }; /* PT154 */
237 return
238 nEncoding < sizeof aData / sizeof aData[0] ? aData[nEncoding] : NULL;
239 return NULL;