michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* This file is generated by the following C snippet, which depends on michael@0: * cp936map.h. It maps Unicode to GBK. */ michael@0: michael@0: /* michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #define MAX_GBK_LENGTH 24066 // (0xfe-0x80)*(0xfe-0x3f) michael@0: #define UNICHAR_IN_RANGE(a, b, c) \ michael@0: (((uint16_t)(a) <= (uint16_t)(b))&&((uint16_t)(b) <= (uint16_t)(c))) michael@0: michael@0: static const uint16_t gGBKToUnicodeTable[MAX_GBK_LENGTH] = { michael@0: #include "cp936map.h" michael@0: }; michael@0: michael@0: static uint16_t gUnicodeToGBKTable[0xA000-0x4e00]; michael@0: michael@0: int main() michael@0: { michael@0: uint16_t unicode; michael@0: uint16_t i; michael@0: // zap it to zero first michael@0: memset(gUnicodeToGBKTable,0, sizeof(gUnicodeToGBKTable)); michael@0: michael@0: for ( i=0; i