comparison src/file-coding.h @ 448:3078fd1074e8 r21-2-39

Import from CVS: tag r21-2-39
author cvs
date Mon, 13 Aug 2007 11:38:25 +0200
parents 8de8e3f6228a
children ef4d2466a29c
comparison
equal deleted inserted replaced
447:4fc5f13f3bd3 448:3078fd1074e8
406 #define ISO_CODE_SS2 0x8E /* single-shift-2 */ 406 #define ISO_CODE_SS2 0x8E /* single-shift-2 */
407 #define ISO_CODE_SS3 0x8F /* single-shift-3 */ 407 #define ISO_CODE_SS3 0x8F /* single-shift-3 */
408 #define ISO_CODE_CSI 0x9B /* control-sequence-introduce */ 408 #define ISO_CODE_CSI 0x9B /* control-sequence-introduce */
409 #endif /* MULE */ 409 #endif /* MULE */
410 410
411 /* For detecting the encoding of text */ 411 /* Distinguishable categories of encodings.
412
413 This list determines the initial priority of the categories.
414
415 For better or worse, currently Mule files are encoded in 7-bit ISO 2022.
416 For this reason, under Mule ISO_7 gets highest priority.
417
418 Putting NO_CONVERSION second prevents "binary corruption" in the
419 default case in all but the (presumably) extremely rare case of a
420 binary file which contains redundant escape sequences but no 8-bit
421 characters.
422
423 The remaining priorities are based on perceived "internationalization
424 political correctness." An exception is UCS-4 at the bottom, since
425 basically everything is compatible with UCS-4, but it is likely to
426 be very rare as an external encoding. */
427
412 enum coding_category_type 428 enum coding_category_type
413 { 429 {
414 #ifdef MULE 430 /* must be a contiguous range of values 0 -- CODING_CATEGORY_LAST - 1 */
415 CODING_CATEGORY_SHIFT_JIS, 431 #ifdef MULE
416 CODING_CATEGORY_ISO_7, /* ISO2022 system using only seven-bit bytes, 432 CODING_CATEGORY_ISO_7, /* ISO2022 system using only seven-bit bytes,
417 no locking shift */ 433 no locking shift */
418 CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, 434 CODING_CATEGORY_NO_CONVERSION,
419 no locking shift, no single shift, 435 CODING_CATEGORY_UTF8,
420 using designation to switch charsets */
421 CODING_CATEGORY_ISO_8_1, /* ISO2022 system using eight-bit bytes, 436 CODING_CATEGORY_ISO_8_1, /* ISO2022 system using eight-bit bytes,
422 no locking shift, no designation sequences, 437 no locking shift, no designation sequences,
423 one-dimension characters in the upper half. */ 438 one-dimension characters in the upper half. */
424 CODING_CATEGORY_ISO_8_2, /* ISO2022 system using eight-bit bytes, 439 CODING_CATEGORY_ISO_8_2, /* ISO2022 system using eight-bit bytes,
425 no locking shift, no designation sequences, 440 no locking shift, no designation sequences,
426 two-dimension characters in the upper half. */ 441 two-dimension characters in the upper half. */
442 CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes,
443 no locking shift, no single shift,
444 using designation to switch charsets */
427 CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */ 445 CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */
446 CODING_CATEGORY_SHIFT_JIS,
428 CODING_CATEGORY_BIG5, 447 CODING_CATEGORY_BIG5,
429 CODING_CATEGORY_UCS4, 448 CODING_CATEGORY_UCS4,
430 CODING_CATEGORY_UTF8, 449 #else /* not MULE */
450 CODING_CATEGORY_NO_CONVERSION,
431 #endif /* MULE */ 451 #endif /* MULE */
432 CODING_CATEGORY_NO_CONVERSION 452 CODING_CATEGORY_LAST /* not a real coding category */
433 }; 453 };
434
435 #define CODING_CATEGORY_LAST CODING_CATEGORY_NO_CONVERSION
436 454
437 #ifdef MULE 455 #ifdef MULE
438 #define CODING_CATEGORY_SHIFT_JIS_MASK \ 456 #define CODING_CATEGORY_SHIFT_JIS_MASK \
439 (1 << CODING_CATEGORY_SHIFT_JIS) 457 (1 << CODING_CATEGORY_SHIFT_JIS)
440 #define CODING_CATEGORY_ISO_7_MASK \ 458 #define CODING_CATEGORY_ISO_7_MASK \