typedef int Charset_ID;
-#define MIN_LEADING_BYTE 0x80
+#define MIN_LEADING_BYTE 0x00
+#define CHARSET_ID_OFFSET 0x40
-#define LEADING_BYTE_UCS_BMP 0x80
-#define LEADING_BYTE_CONTROL_1 0x81 /* represent normal 80-9F */
-#define LEADING_BYTE_HIRAGANA_JISX0208 0x82
-#define LEADING_BYTE_KATAKANA_JISX0208 0x83
-#define LEADING_BYTE_LATIN_VISCII 0x84
+/* represent normal 80-9F */
+#define LEADING_BYTE_CONTROL_1 (CHARSET_ID_OFFSET - 1)
-#define MIN_LEADING_BYTE_PRIVATE 0x85
-#define MAX_LEADING_BYTE_PRIVATE 0x94
+/* ISO/IEC 10646 BMP */
+#define LEADING_BYTE_UCS_BMP (CHARSET_ID_OFFSET - 2)
+/* VISCII 1.1 */
+#define LEADING_BYTE_LATIN_VISCII (CHARSET_ID_OFFSET - 3)
-#define CHARSET_ID_OFFSET_94 (0x95 - '0')
+#define LEADING_BYTE_HIRAGANA_JISX0208 (CHARSET_ID_OFFSET - 4)
+#define LEADING_BYTE_KATAKANA_JISX0208 (CHARSET_ID_OFFSET - 5)
+
+#define MIN_LEADING_BYTE_PRIVATE MIN_LEADING_BYTE
+#define MAX_LEADING_BYTE_PRIVATE (CHARSET_ID_OFFSET - 6)
+
+
+#define CHARSET_ID_OFFSET_94 (CHARSET_ID_OFFSET - '0')
#define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0')
#define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?')
#define LEADING_BYTE_LATIN_JISX0201 (CHARSET_ID_OFFSET_94 + 'J')
-#define CHARSET_ID_OFFSET_96 (0xB0 - '0')
+#define CHARSET_ID_OFFSET_96 (CHARSET_ID_OFFSET_94 + 80)
#define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET_96 + '1')
#define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET_96 + '2')
#define LEADING_BYTE_THAI_TIS620 (CHARSET_ID_OFFSET_96 + 'T')
-#define CHARSET_ID_OFFSET_94x94 (0xE0 - '0')
+#define CHARSET_ID_OFFSET_94x94 (CHARSET_ID_OFFSET_96 + 80)
/* Big5 Level 1 */
#define LEADING_BYTE_CHINESE_BIG5_1 ('0' + CHARSET_ID_OFFSET_94x94)