diff options
| author | Kenichi Handa | 2000-10-25 11:06:51 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-10-25 11:06:51 +0000 |
| commit | a92e4183e850869f1ed37300f908dc81db2c9428 (patch) | |
| tree | 13321ae89367d4cbd3610b778a6c38de8354f504 /src/process.c | |
| parent | 68c3a13776f80f103be2598072e75c98e39b3940 (diff) | |
| download | emacs-a92e4183e850869f1ed37300f908dc81db2c9428.tar.gz emacs-a92e4183e850869f1ed37300f908dc81db2c9428.zip | |
(send_process): If OBJECT is t, it means that the data
is from C string, but we should encode it. Before calling
setup_raw_text_coding_system, be sure to flush out data by the
previous coding system.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/process.c b/src/process.c index b36fbc79108..cb51af92af3 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3185,13 +3185,11 @@ send_process_trap () | |||
| 3185 | 3185 | ||
| 3186 | /* Send some data to process PROC. | 3186 | /* Send some data to process PROC. |
| 3187 | BUF is the beginning of the data; LEN is the number of characters. | 3187 | BUF is the beginning of the data; LEN is the number of characters. |
| 3188 | OBJECT is the Lisp object that the data comes from. | 3188 | OBJECT is the Lisp object that the data comes from. If OBJECT is |
| 3189 | nil or t, it means that the data comes from C string. | ||
| 3189 | 3190 | ||
| 3190 | The data is encoded by PROC's coding-system for encoding before it | 3191 | If OBJECT is not nil, the data is encoded by PROC's coding-system |
| 3191 | is sent. But if the data ends at the middle of multi-byte | 3192 | for encoding before it is sent. |
| 3192 | representation, that incomplete sequence of bytes are sent without | ||
| 3193 | being encoded. Should we store them in a buffer to prepend them to | ||
| 3194 | the data send later? | ||
| 3195 | 3193 | ||
| 3196 | This function can evaluate Lisp code and can garbage collect. */ | 3194 | This function can evaluate Lisp code and can garbage collect. */ |
| 3197 | 3195 | ||
| @@ -3228,7 +3226,8 @@ send_process (proc, buf, len, object) | |||
| 3228 | 3226 | ||
| 3229 | if ((STRINGP (object) && STRING_MULTIBYTE (object)) | 3227 | if ((STRINGP (object) && STRING_MULTIBYTE (object)) |
| 3230 | || (BUFFERP (object) | 3228 | || (BUFFERP (object) |
| 3231 | && !NILP (XBUFFER (object)->enable_multibyte_characters))) | 3229 | && !NILP (XBUFFER (object)->enable_multibyte_characters)) |
| 3230 | || EQ (object, Qt)) | ||
| 3232 | { | 3231 | { |
| 3233 | coding->src_multibyte = 1; | 3232 | coding->src_multibyte = 1; |
| 3234 | if (!EQ (coding->symbol, XPROCESS (proc)->encode_coding_system)) | 3233 | if (!EQ (coding->symbol, XPROCESS (proc)->encode_coding_system)) |
| @@ -3242,11 +3241,20 @@ send_process (proc, buf, len, object) | |||
| 3242 | } | 3241 | } |
| 3243 | else | 3242 | else |
| 3244 | { | 3243 | { |
| 3245 | coding->src_multibyte = 0; | 3244 | /* For sending a unibyte text, character code conversion should |
| 3246 | /* For sending a unibyte text, character code conversion | 3245 | not take place but EOL conversion should. So, setup raw-text |
| 3247 | should not take place but EOL conversion should. So, setup | 3246 | or one of the subsidiary if we have not yet done it. */ |
| 3248 | raw-text or one of the subsidiary. */ | 3247 | if (coding->type != coding_type_raw_text) |
| 3249 | setup_raw_text_coding_system (coding); | 3248 | { |
| 3249 | if (CODING_REQUIRE_FLUSHING (coding)) | ||
| 3250 | { | ||
| 3251 | /* But, before changing the coding, we must flush out data. */ | ||
| 3252 | coding->mode |= CODING_MODE_LAST_BLOCK; | ||
| 3253 | send_process (proc, "", 0, Qt); | ||
| 3254 | } | ||
| 3255 | coding->src_multibyte = 0; | ||
| 3256 | setup_raw_text_coding_system (coding); | ||
| 3257 | } | ||
| 3250 | } | 3258 | } |
| 3251 | coding->dst_multibyte = 0; | 3259 | coding->dst_multibyte = 0; |
| 3252 | 3260 | ||