Bug 468575 - Scrape some gunk off the config/ grout, r=ted
[wine-gecko.git] / intl / uconv / ucvcn / gbku.h
blobf545990622bcc8874fe4c4d713dfb1757f7e9658
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is mozilla.org code.
16 * The Initial Developer of the Original Code is
17 * Intel Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1999
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Yueheng Xu <yueheng.xu@intel.com>
23 * Hoa Nguyen <hoa.nguyen@intel.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
38 // =======================================================================
39 // Original Author: Yueheng Xu
40 // email: yueheng.xu@intel.com
41 // phone: (503)264-2248
42 // Intel Corporation, Oregon, USA
43 // Last Update: September 7, 1999
44 // Revision History:
45 // 09/07/1999 - initial version.
46 // 09/28/1999 - changed leftbyte and rightbyte from char to unsigned char
47 // in struct DByte
48 // 04/10/1999 - changed leftbyte. rightbyte to PRUint8 in struct DByte;
49 // added table UnicodeToGBKTable[0x5200]
50 //
51 // 05/16/2000 - added gUnicodeToGBKTableInitialized flag for optimization
52 // ======================================================================================
53 // Table GBKToUnicode[] maps the GBK code to its unicode.
54 // The mapping data of this GBK table is obtained from
55 // ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT
56 // Frank Tang of Netscape wrote the original perl tool to re-align the
57 // mapping data into an 8-item per line format ( i.e. file cp936map.txt ).
59 // The valid GBK charset range: left byte is [0x81, 0xfe], right byte are
60 // [0x40, 0x7e] and [0x80, 0xfe]. But for the convenience of index
61 // calculation, the table here has a single consecutive range of
62 // [0x40, 0xfe] for the right byte. Those invalid chars whose right byte
63 // is 0x7f will be mapped to undefined unicode 0xFFFF.
65 //
66 // Table UnicodeToGBK[] maps the unicode to GBK code. To reduce memory usage, we
67 // only do Unicode to GBK table mapping for unicode between 0x4E00 and 0xA000;
68 // Others let converter to do search from table GBKToUnicode[]. If we want further
69 // trade memory for performance, we can let more unicode to do table mapping to get
70 // its GBK instead of searching table GBKToUnicode[].
71 #ifndef _GBKU_H__
72 #define _GBKU_H__
75 #define UCS2_NO_MAPPING ((PRUnichar) 0xfffd)
76 #define UINT8_IN_RANGE(a, b, c) \
77 (((PRUint8)(a) <= (PRUint8)(b))&&((PRUint8)(b) <= (PRUint8)(c)))
78 #define UNICHAR_IN_RANGE(a, b, c) \
79 (((PRUnichar)(a) <= (PRUnichar)(b))&&((PRUnichar)(b) <= (PRUnichar)(c)))
80 #define CAST_CHAR_TO_UNICHAR(a) ((PRUnichar)((unsigned char)(a)))
81 #define CAST_UNICHAR_TO_CHAR(a) ((char)a)
83 #define IS_ASCII(a) (0==(0xff80 & (a)))
84 #define IS_GBK_EURO(c) ((char)0x80 == (c))
85 #define UCS2_EURO ((PRUnichar) 0x20ac)
87 #include "nsGBKConvUtil.h"
89 #endif /* _GBKU_H__ */