+ MBCS_STAGE_3_GRANULARITY=16, /* =1<<4: MBCS stage 2 indexes are shifted left 4 */
+ MBCS_STAGE_3_SBCS_SIZE=0x10000, /* max 64k mappings for SBCS */
+ MBCS_STAGE_3_MBCS_SIZE=0x10000*MBCS_STAGE_3_GRANULARITY, /* max mappings for MBCS */
+
+ /*
+ * SBCS_UTF8_MAX: Maximum code point with UTF-8-friendly SBCS data structures.
+ * Possible values are 0x01ff..0xffff, in steps of 0x100.
+ *
+ * Unlike for MBCS, this constant only affects the stage 3 block allocation size;
+ * there is no additional stage 1/2 table stored in the .cnv file.
+ * The max value should be at least 0x7ff to cover 2-byte UTF-8.
+ * 0xfff also covers a number other small scripts which have legacy charsets
+ * (like Thai).
+ * Higher values up to 0x1fff are harmless and potentially useful because
+ * that covers small-script blocks which usually have either dense mappings
+ * or no mappings at all.
+ * Starting at U+2000, there are mostly symbols and format characters
+ * with a low density of SBCS mappings, which would result in more wasted
+ * stage 3 entries with the larger block size.
+ */
+ SBCS_UTF8_MAX=0x1fff,
+
+ /*
+ * MBCS_UTF8_MAX: Maximum code point with UTF-8-friendly MBCS data structures.
+ * Possible values are 0x01ff..0xffff, in steps of 0x100.
+ *
+ * Note that with 0xffff, MBCSAddFromUnicode() may overflow the additional UTF-8 stage table
+ * with extreme input data. The function checks for this overflow.
+ *
+ * 0xd7ff is chosen for the majority of common characters including Unihan and Hangul.
+ * At U+d800 there are mostly surrogates, private use codes, compatibility characters, etc.
+ * Larger values cause slightly larger MBCS .cnv files.
+ */
+ MBCS_UTF8_MAX=0xd7ff,
+ MBCS_UTF8_LIMIT=MBCS_UTF8_MAX+1, /* =0xd800 */
+
+ MBCS_UTF8_STAGE_SHIFT=6,
+ MBCS_UTF8_STAGE_3_BLOCK_SIZE=0x40, /* =64=1<<6 for 6 bits from last trail byte */
+ MBCS_UTF8_STAGE_3_BLOCK_MASK=0x3f,
+
+ /* size of the single-stage table for up to U+d7ff (used instead of stage1/2) */
+ MBCS_UTF8_STAGE_SIZE=MBCS_UTF8_LIMIT>>MBCS_UTF8_STAGE_SHIFT, /* =0x360 */
+
+ MBCS_FROM_U_EXT_FLAG=0x10, /* UCMapping.f bit for base table mappings that fit into the base toU table */
+ MBCS_FROM_U_EXT_MASK=0x0f, /* but need to go into the extension fromU table */
+
+ /* =4 number of regular stage 3 blocks for final UTF-8 trail byte */
+ MBCS_UTF8_STAGE_3_BLOCKS=MBCS_UTF8_STAGE_3_BLOCK_SIZE/MBCS_STAGE_3_BLOCK_SIZE,
+