Mercurial > emacs
comparison src/process.c @ 23879:18e5d1cfa74b
(read_process_output): If NBYTES is zero and
CODING_MODE_LAST_BLOCK bit is not yet set in coding->mode, set it
and try decoding again.
(Fprocess_send_eof): If the coding system of PROCESS
requires flushing, call send_process with null-string at first.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 15 Dec 1998 04:35:38 +0000 |
parents | f69129948f65 |
children | a9f9015b5b83 |
comparison
equal
deleted
inserted
replaced
23878:0d713a8426b6 | 23879:18e5d1cfa74b |
---|---|
2839 | 2839 |
2840 XSETINT (p->decoding_carryover, 0); | 2840 XSETINT (p->decoding_carryover, 0); |
2841 | 2841 |
2842 /* At this point, NBYTES holds number of characters just received | 2842 /* At this point, NBYTES holds number of characters just received |
2843 (including the one in proc_buffered_char[channel]). */ | 2843 (including the one in proc_buffered_char[channel]). */ |
2844 if (nbytes <= 0) return nbytes; | 2844 if (nbytes <= 0) |
2845 { | |
2846 if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK) | |
2847 return nbytes; | |
2848 coding->mode |= CODING_MODE_LAST_BLOCK; | |
2849 } | |
2845 | 2850 |
2846 /* Now set NBYTES how many bytes we must decode. */ | 2851 /* Now set NBYTES how many bytes we must decode. */ |
2847 nbytes += carryover; | 2852 nbytes += carryover; |
2848 nchars = nbytes; | 2853 nchars = nbytes; |
2849 | 2854 |
3844 text to PROCESS after you call this function.") | 3849 text to PROCESS after you call this function.") |
3845 (process) | 3850 (process) |
3846 Lisp_Object process; | 3851 Lisp_Object process; |
3847 { | 3852 { |
3848 Lisp_Object proc; | 3853 Lisp_Object proc; |
3854 struct coding_system *coding; | |
3849 | 3855 |
3850 proc = get_process (process); | 3856 proc = get_process (process); |
3857 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; | |
3851 | 3858 |
3852 /* Make sure the process is really alive. */ | 3859 /* Make sure the process is really alive. */ |
3853 if (! NILP (XPROCESS (proc)->raw_status_low)) | 3860 if (! NILP (XPROCESS (proc)->raw_status_low)) |
3854 update_status (XPROCESS (proc)); | 3861 update_status (XPROCESS (proc)); |
3855 if (! EQ (XPROCESS (proc)->status, Qrun)) | 3862 if (! EQ (XPROCESS (proc)->status, Qrun)) |
3856 error ("Process %s not running", XSTRING (XPROCESS (proc)->name)->data); | 3863 error ("Process %s not running", XSTRING (XPROCESS (proc)->name)->data); |
3864 | |
3865 if (CODING_REQUIRE_FLUSHING (coding)) | |
3866 { | |
3867 coding->mode |= CODING_MODE_LAST_BLOCK; | |
3868 send_process (proc, "", 0, Qnil); | |
3869 } | |
3857 | 3870 |
3858 #ifdef VMS | 3871 #ifdef VMS |
3859 send_process (proc, "\032", 1, Qnil); /* ^z */ | 3872 send_process (proc, "\032", 1, Qnil); /* ^z */ |
3860 #else | 3873 #else |
3861 if (!NILP (XPROCESS (proc)->pty_flag)) | 3874 if (!NILP (XPROCESS (proc)->pty_flag)) |