aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-01-22 01:26:45 +0000
committerKenichi Handa1998-01-22 01:26:45 +0000
commit6589fd67a7c1f278315fc84df2475460ac3bd45e (patch)
tree7681523416ec0d9123f2a68c99d0f3c9ef2c061a /src
parent9391d06ab452fe8f54f97b5baa04d4a0c69f9b3f (diff)
downloademacs-6589fd67a7c1f278315fc84df2475460ac3bd45e.tar.gz
emacs-6589fd67a7c1f278315fc84df2475460ac3bd45e.zip
(encode_terminal_code): Adjusted for the change of
encode_coding. (write_glyphs): Likewise. Adjusted for the change of struct coding_system. (insert_glyphs): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/term.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/term.c b/src/term.c
index eba0461a235..64f78cc7b02 100644
--- a/src/term.c
+++ b/src/term.c
@@ -788,9 +788,14 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
788 register GLYPH g; 788 register GLYPH g;
789 unsigned int c; 789 unsigned int c;
790 unsigned char workbuf[4], *buf; 790 unsigned char workbuf[4], *buf;
791 int len, produced, processed; 791 int len;
792 register int tlen = GLYPH_TABLE_LENGTH; 792 register int tlen = GLYPH_TABLE_LENGTH;
793 register Lisp_Object *tbase = GLYPH_TABLE_BASE; 793 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
794 struct coding_system *coding;
795
796 coding = (CODING_REQUIRE_ENCODING (&terminal_coding)
797 ? &terminal_coding
798 : &safe_terminal_coding);
794 799
795 while (src < src_end) 800 while (src < src_end)
796 { 801 {
@@ -828,21 +833,14 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
828 buf = GLYPH_STRING (tbase, g); 833 buf = GLYPH_STRING (tbase, g);
829 } 834 }
830 835
831 if (! CODING_REQUIRE_ENCODING (&terminal_coding)) 836 encode_coding (coding, buf, dst, len, dst_end - dst);
832 /* We had better avoid sending Emacs' internal code to 837 if (coding->consumed < len)
833 terminal. */
834 produced = encode_coding (&safe_terminal_coding, buf, dst,
835 len, dst_end - dst, &processed);
836 else
837 produced = encode_coding (&terminal_coding, buf, dst,
838 len, dst_end - dst, &processed);
839 if (processed < len)
840 /* We get a carryover because the remaining output 838 /* We get a carryover because the remaining output
841 buffer is too short. We must break the loop here 839 buffer is too short. We must break the loop here
842 without increasing SRC so that the next call of 840 without increasing SRC so that the next call of
843 this function start from the same glyph. */ 841 this function start from the same glyph. */
844 break; 842 break;
845 dst += produced; 843 dst += coding->produced;
846 } 844 }
847 src++; 845 src++;
848 } 846 }
@@ -882,8 +880,9 @@ write_glyphs (string, len)
882 return; 880 return;
883 881
884 cmplus (len); 882 cmplus (len);
885 /* The field `last_block' should be set to 1 only at the tail. */ 883 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
886 terminal_coding.last_block = 0; 884 the tail. */
885 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
887 while (len > 0) 886 while (len > 0)
888 { 887 {
889 /* We use shared conversion buffer of the current size (1024 888 /* We use shared conversion buffer of the current size (1024
@@ -905,18 +904,17 @@ write_glyphs (string, len)
905 /* We may have to output some codes to terminate the writing. */ 904 /* We may have to output some codes to terminate the writing. */
906 if (CODING_REQUIRE_FLUSHING (&terminal_coding)) 905 if (CODING_REQUIRE_FLUSHING (&terminal_coding))
907 { 906 {
908 terminal_coding.last_block = 1; 907 terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
909 produced = encode_coding (&terminal_coding, (char *)0, conversion_buffer, 908 encode_coding (&terminal_coding, (char *)0, conversion_buffer,
910 0, conversion_buffer_size, 909 0, conversion_buffer_size);
911 &consumed); 910 if (terminal_coding.produced > 0)
912
913 if (produced > 0)
914 { 911 {
915 fwrite (conversion_buffer, 1, produced, stdout); 912 fwrite (conversion_buffer, 1, terminal_coding.produced, stdout);
916 if (ferror (stdout)) 913 if (ferror (stdout))
917 clearerr (stdout); 914 clearerr (stdout);
918 if (termscript) 915 if (termscript)
919 fwrite (conversion_buffer, 1, produced, termscript); 916 fwrite (conversion_buffer, 1, terminal_coding.produced,
917 termscript);
920 } 918 }
921 } 919 }
922 cmcheckmagic (); 920 cmcheckmagic ();
@@ -955,8 +953,8 @@ insert_glyphs (start, len)
955 953
956 turn_on_insert (); 954 turn_on_insert ();
957 cmplus (len); 955 cmplus (len);
958 /* The field `last_block' should be set to 1 only at the tail. */ 956 /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */
959 terminal_coding.last_block = 0; 957 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
960 while (len-- > 0) 958 while (len-- > 0)
961 { 959 {
962 int produced, consumed; 960 int produced, consumed;
@@ -978,7 +976,7 @@ insert_glyphs (start, len)
978 976
979 if (len <= 0) 977 if (len <= 0)
980 /* This is the last glyph. */ 978 /* This is the last glyph. */
981 terminal_coding.last_block = 1; 979 terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
982 980
983 /* We use shared conversion buffer of the current size (1024 981 /* We use shared conversion buffer of the current size (1024
984 bytes at least). It is surely sufficient for just one glyph. */ 982 bytes at least). It is surely sufficient for just one glyph. */