Mercurial > emacs
comparison src/coding.c @ 19365:d9374f5ebd3a
(CODING_FLAG_ISO_LATIN_EXTRA): New macro.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 16 Aug 1997 01:54:37 +0000 |
parents | af3d00fde172 |
children | 33c5695c6c7e |
comparison
equal
deleted
inserted
replaced
19364:7182edce9028 | 19365:d9374f5ebd3a |
---|---|
277 Lisp_Object Vcoding_system_for_write; | 277 Lisp_Object Vcoding_system_for_write; |
278 /* Coding-system actually used in the latest I/O. */ | 278 /* Coding-system actually used in the latest I/O. */ |
279 Lisp_Object Vlast_coding_system_used; | 279 Lisp_Object Vlast_coding_system_used; |
280 | 280 |
281 /* A vector of length 256 which contains information about special | 281 /* A vector of length 256 which contains information about special |
282 Microsoft codes. */ | 282 Latin codes (espepcially for dealing with Microsoft code). */ |
283 Lisp_Object Vmicrosoft_code_table; | 283 Lisp_Object Vlatin_extra_code_table; |
284 | 284 |
285 /* Flag to inhibit code conversion of end-of-line format. */ | 285 /* Flag to inhibit code conversion of end-of-line format. */ |
286 int inhibit_eol_conversion; | 286 int inhibit_eol_conversion; |
287 | 287 |
288 /* Coding system to be used to encode text for terminal display. */ | 288 /* Coding system to be used to encode text for terminal display. */ |
619 | CODING_CATEGORY_MASK_ISO_7_ELSE | 619 | CODING_CATEGORY_MASK_ISO_7_ELSE |
620 | CODING_CATEGORY_MASK_ISO_8_ELSE | 620 | CODING_CATEGORY_MASK_ISO_8_ELSE |
621 ); | 621 ); |
622 int g1 = 0; /* 1 iff designating to G1. */ | 622 int g1 = 0; /* 1 iff designating to G1. */ |
623 int c, i; | 623 int c, i; |
624 | 624 struct coding_system coding_iso_8_1, coding_iso_8_2; |
625 while (src < src_end) | 625 |
626 /* Coding systems of these categories may accept latin extra codes. */ | |
627 setup_coding_system | |
628 (XSYMBOL (coding_category_table[CODING_CATEGORY_IDX_ISO_8_1])->value, | |
629 &coding_iso_8_1); | |
630 setup_coding_system | |
631 (XSYMBOL (coding_category_table[CODING_CATEGORY_IDX_ISO_8_2])->value, | |
632 &coding_iso_8_2); | |
633 | |
634 while (mask && src < src_end) | |
626 { | 635 { |
627 c = *src++; | 636 c = *src++; |
628 switch (c) | 637 switch (c) |
629 { | 638 { |
630 case ISO_CODE_ESC: | 639 case ISO_CODE_ESC: |
681 break; | 690 break; |
682 | 691 |
683 case ISO_CODE_CSI: | 692 case ISO_CODE_CSI: |
684 case ISO_CODE_SS2: | 693 case ISO_CODE_SS2: |
685 case ISO_CODE_SS3: | 694 case ISO_CODE_SS3: |
686 return CODING_CATEGORY_MASK_ISO_8_ELSE; | 695 { |
696 int newmask = CODING_CATEGORY_MASK_ISO_8_ELSE; | |
697 | |
698 if (VECTORP (Vlatin_extra_code_table) | |
699 && !NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) | |
700 { | |
701 if (coding_iso_8_1.flags & CODING_FLAG_ISO_LATIN_EXTRA) | |
702 newmask |= CODING_CATEGORY_MASK_ISO_8_1; | |
703 if (coding_iso_8_2.flags & CODING_FLAG_ISO_LATIN_EXTRA) | |
704 newmask |= CODING_CATEGORY_MASK_ISO_8_2; | |
705 } | |
706 mask &= newmask; | |
707 } | |
708 break; | |
687 | 709 |
688 default: | 710 default: |
689 if (c < 0x80) | 711 if (c < 0x80) |
690 break; | 712 break; |
691 else if (c < 0xA0) | 713 else if (c < 0xA0) |
692 { | 714 { |
693 if (VECTORP (Vmicrosoft_code_table) | 715 if (VECTORP (Vlatin_extra_code_table) |
694 && !NILP (XVECTOR (Vmicrosoft_code_table)->contents[c])) | 716 && !NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) |
695 { | 717 { |
696 mask &= ~(CODING_CATEGORY_MASK_ISO_7 | 718 int newmask = 0; |
697 | CODING_CATEGORY_MASK_ISO_7_ELSE); | 719 |
698 break; | 720 if (coding_iso_8_1.flags & CODING_FLAG_ISO_LATIN_EXTRA) |
721 newmask |= CODING_CATEGORY_MASK_ISO_8_1; | |
722 if (coding_iso_8_2.flags & CODING_FLAG_ISO_LATIN_EXTRA) | |
723 newmask |= CODING_CATEGORY_MASK_ISO_8_2; | |
724 mask &= newmask; | |
699 } | 725 } |
700 return 0; | 726 else |
727 return 0; | |
701 } | 728 } |
702 else | 729 else |
703 { | 730 { |
704 unsigned char *src_begin = src; | 731 unsigned char *src_begin = src; |
705 | 732 |
2368 | (NILP (flags[11]) ? 0 : CODING_FLAG_ISO_USE_OLDJIS) | 2395 | (NILP (flags[11]) ? 0 : CODING_FLAG_ISO_USE_OLDJIS) |
2369 | (NILP (flags[12]) ? 0 : CODING_FLAG_ISO_NO_DIRECTION) | 2396 | (NILP (flags[12]) ? 0 : CODING_FLAG_ISO_NO_DIRECTION) |
2370 | (NILP (flags[13]) ? 0 : CODING_FLAG_ISO_INIT_AT_BOL) | 2397 | (NILP (flags[13]) ? 0 : CODING_FLAG_ISO_INIT_AT_BOL) |
2371 | (NILP (flags[14]) ? 0 : CODING_FLAG_ISO_DESIGNATE_AT_BOL) | 2398 | (NILP (flags[14]) ? 0 : CODING_FLAG_ISO_DESIGNATE_AT_BOL) |
2372 | (NILP (flags[15]) ? 0 : CODING_FLAG_ISO_SAFE) | 2399 | (NILP (flags[15]) ? 0 : CODING_FLAG_ISO_SAFE) |
2400 | (NILP (flags[16]) ? 0 : CODING_FLAG_ISO_LATIN_EXTRA) | |
2373 ); | 2401 ); |
2374 | 2402 |
2375 /* Invoke graphic register 0 to plane 0. */ | 2403 /* Invoke graphic register 0 to plane 0. */ |
2376 CODING_SPEC_ISO_INVOCATION (coding, 0) = 0; | 2404 CODING_SPEC_ISO_INVOCATION (coding, 0) = 0; |
2377 /* Invoke graphic register 1 to plane 1 if we can use full 8-bit. */ | 2405 /* Invoke graphic register 1 to plane 1 if we can use full 8-bit. */ |
2654 /* No valid ISO2022 code follows C. Try again. */ | 2682 /* No valid ISO2022 code follows C. Try again. */ |
2655 goto label_loop_detect_coding; | 2683 goto label_loop_detect_coding; |
2656 } | 2684 } |
2657 else if (c < 0xA0) | 2685 else if (c < 0xA0) |
2658 { | 2686 { |
2659 /* If C is a special Microsoft code, | 2687 /* If C is a special latin extra code, |
2660 or is an ISO2022 specific control code of C1 (SS2 or SS3), | 2688 or is an ISO2022 specific control code of C1 (SS2 or SS3), |
2661 or is an ISO2022 control-sequence-introducer (CSI), | 2689 or is an ISO2022 control-sequence-introducer (CSI), |
2662 we should also consider the possibility of someof ISO2022 codings. */ | 2690 we should also consider the possibility of someof ISO2022 codings. */ |
2663 if ((VECTORP (Vmicrosoft_code_table) | 2691 if ((VECTORP (Vlatin_extra_code_table) |
2664 && !NILP (XVECTOR (Vmicrosoft_code_table)->contents[c])) | 2692 && !NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) |
2665 || (c == ISO_CODE_SS2 || c == ISO_CODE_SS3) | 2693 || (c == ISO_CODE_SS2 || c == ISO_CODE_SS3) |
2666 || (c == ISO_CODE_CSI | 2694 || (c == ISO_CODE_CSI |
2667 && (src < src_end | 2695 && (src < src_end |
2668 && (*src == ']' | 2696 && (*src == ']' |
2669 || (src + 1 < src_end | 2697 || (src + 1 < src_end |
4015 "Cons of coding systems used for process I/O by default.\n\ | 4043 "Cons of coding systems used for process I/O by default.\n\ |
4016 The car part is used for decoding a process output,\n\ | 4044 The car part is used for decoding a process output,\n\ |
4017 the cdr part is used for encoding a text to be sent to a process."); | 4045 the cdr part is used for encoding a text to be sent to a process."); |
4018 Vdefault_process_coding_system = Qnil; | 4046 Vdefault_process_coding_system = Qnil; |
4019 | 4047 |
4020 DEFVAR_LISP ("special-microsoft-code-table", &Vmicrosoft_code_table, | 4048 DEFVAR_LISP ("latin-extra-code-table", &Vlatin_extra_code_table, |
4021 "Table of special Microsoft codes in the range 128..159 (inclusive).\n\ | 4049 "Table of extra Latin codes in the range 128..159 (inclusive).\n\ |
4022 This is a vector of length 256.\n\ | 4050 This is a vector of length 256.\n\ |
4023 If Nth element is non-nil, the existence of code N in a file\n\ | 4051 If Nth element is non-nil, the existence of code N in a file\n\ |
4024 (or output of subprocess) doesn't prevent it to be detected as\n\ | 4052 (or output of subprocess) doesn't prevent it to be detected as\n\ |
4025 a coding system of ISO 2022 variant (e.g. iso-latin-1) on reading a file\n\ | 4053 a coding system of ISO 2022 variant which has a flag\n\ |
4054 `accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file\n\ | |
4026 or reading output of a subprocess.\n\ | 4055 or reading output of a subprocess.\n\ |
4027 Only 128th through 159th elements has a meaning."); | 4056 Only 128th through 159th elements has a meaning."); |
4028 Vmicrosoft_code_table = Fmake_vector (make_number (256), Qnil); | 4057 Vlatin_extra_code_table = Fmake_vector (make_number (256), Qnil); |
4029 } | 4058 } |
4030 | 4059 |
4031 #endif /* emacs */ | 4060 #endif /* emacs */ |