Mercurial > emacs
comparison src/process.c @ 31136:d1344c992a9a
(create_process): Don't setup raw-text coding here.
(Fopen_network_stream): Don't set coding->src_multibyte and
coding->dst_multibyte here.
(read_process_output): For process filter, return unibyte string
if default-enable-multibyte-characters is nil.
(send_process): If OBJECT is multibyte text, be sure to encoded it
by the specified coding system for the process. Otherwise, setup
raw-text coding.
(init_process): Don't initialize default-process-coding-system
here.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 24 Aug 2000 02:06:43 +0000 |
parents | 0fe5afca71e4 |
children | bd258f4dc0fa |
comparison
equal
deleted
inserted
replaced
31135:d5fa3ad39669 | 31136:d1344c992a9a |
---|---|
1407 if (!proc_encode_coding_system[outchannel]) | 1407 if (!proc_encode_coding_system[outchannel]) |
1408 proc_encode_coding_system[outchannel] | 1408 proc_encode_coding_system[outchannel] |
1409 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 1409 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
1410 setup_coding_system (XPROCESS (process)->encode_coding_system, | 1410 setup_coding_system (XPROCESS (process)->encode_coding_system, |
1411 proc_encode_coding_system[outchannel]); | 1411 proc_encode_coding_system[outchannel]); |
1412 | |
1413 if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) | |
1414 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) | |
1415 { | |
1416 /* In unibyte mode, character code conversion should not take | |
1417 place but EOL conversion should. So, setup raw-text or one | |
1418 of the subsidiary according to the information just setup. */ | |
1419 if (!NILP (XPROCESS (process)->decode_coding_system)) | |
1420 setup_raw_text_coding_system (proc_decode_coding_system[inchannel]); | |
1421 if (!NILP (XPROCESS (process)->encode_coding_system)) | |
1422 setup_raw_text_coding_system (proc_encode_coding_system[outchannel]); | |
1423 } | |
1424 | 1412 |
1425 /* Delay interrupts until we have a chance to store | 1413 /* Delay interrupts until we have a chance to store |
1426 the new fork's pid in its process structure */ | 1414 the new fork's pid in its process structure */ |
1427 #ifdef POSIX_SIGNALS | 1415 #ifdef POSIX_SIGNALS |
1428 sigemptyset (&blocked); | 1416 sigemptyset (&blocked); |
2107 if (!proc_decode_coding_system[inch]) | 2095 if (!proc_decode_coding_system[inch]) |
2108 proc_decode_coding_system[inch] | 2096 proc_decode_coding_system[inch] |
2109 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 2097 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
2110 setup_coding_system (XPROCESS (proc)->decode_coding_system, | 2098 setup_coding_system (XPROCESS (proc)->decode_coding_system, |
2111 proc_decode_coding_system[inch]); | 2099 proc_decode_coding_system[inch]); |
2112 proc_decode_coding_system[inch]->src_multibyte = 1; | |
2113 proc_decode_coding_system[inch]->dst_multibyte = 0; | |
2114 if (!proc_encode_coding_system[outch]) | 2100 if (!proc_encode_coding_system[outch]) |
2115 proc_encode_coding_system[outch] | 2101 proc_encode_coding_system[outch] |
2116 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 2102 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
2117 setup_coding_system (XPROCESS (proc)->encode_coding_system, | 2103 setup_coding_system (XPROCESS (proc)->encode_coding_system, |
2118 proc_encode_coding_system[outch]); | 2104 proc_encode_coding_system[outch]); |
2119 proc_encode_coding_system[inch]->src_multibyte = 0; | |
2120 proc_encode_coding_system[inch]->dst_multibyte = 1; | |
2121 | 2105 |
2122 XPROCESS (proc)->decoding_buf = make_uninit_string (0); | 2106 XPROCESS (proc)->decoding_buf = make_uninit_string (0); |
2123 XPROCESS (proc)->decoding_carryover = make_number (0); | 2107 XPROCESS (proc)->decoding_carryover = make_number (0); |
2124 XPROCESS (proc)->encoding_buf = make_uninit_string (0); | 2108 XPROCESS (proc)->encoding_buf = make_uninit_string (0); |
2125 XPROCESS (proc)->encoding_carryover = make_number (0); | 2109 XPROCESS (proc)->encoding_carryover = make_number (0); |
2954 save the match data in a special nonrecursive fashion. */ | 2938 save the match data in a special nonrecursive fashion. */ |
2955 running_asynch_code = 1; | 2939 running_asynch_code = 1; |
2956 | 2940 |
2957 text = decode_coding_string (make_unibyte_string (chars, nbytes), | 2941 text = decode_coding_string (make_unibyte_string (chars, nbytes), |
2958 coding, 0); | 2942 coding, 0); |
2943 if (NILP (buffer_defaults.enable_multibyte_characters)) | |
2944 /* We had better return unibyte string. */ | |
2945 text = string_make_unibyte (text); | |
2946 | |
2959 Vlast_coding_system_used = coding->symbol; | 2947 Vlast_coding_system_used = coding->symbol; |
2960 /* A new coding system might be found. */ | 2948 /* A new coding system might be found. */ |
2961 if (!EQ (p->decode_coding_system, coding->symbol)) | 2949 if (!EQ (p->decode_coding_system, coding->symbol)) |
2962 { | 2950 { |
2963 p->decode_coding_system = coding->symbol; | 2951 p->decode_coding_system = coding->symbol; |
3199 Vlast_coding_system_used = coding->symbol; | 3187 Vlast_coding_system_used = coding->symbol; |
3200 | 3188 |
3201 if ((STRINGP (object) && STRING_MULTIBYTE (object)) | 3189 if ((STRINGP (object) && STRING_MULTIBYTE (object)) |
3202 || (BUFFERP (object) | 3190 || (BUFFERP (object) |
3203 && !NILP (XBUFFER (object)->enable_multibyte_characters))) | 3191 && !NILP (XBUFFER (object)->enable_multibyte_characters))) |
3204 coding->src_multibyte = 1; | 3192 { |
3193 coding->src_multibyte = 1; | |
3194 if (!EQ (coding->symbol, XPROCESS (proc)->encode_coding_system)) | |
3195 /* The coding system for encoding was changed to raw-text | |
3196 because we sent a unibyte text previously. Now we are | |
3197 sending a multibyte text, thus we must encode it by the | |
3198 original coding system specified for the current | |
3199 process. */ | |
3200 setup_coding_system (XPROCESS (proc)->encode_coding_system, | |
3201 coding); | |
3202 } | |
3203 else | |
3204 { | |
3205 coding->src_multibyte = 0; | |
3206 /* For sending a unibyte text, character code conversion | |
3207 should not take place but EOL conversion should. So, setup | |
3208 raw-text or one of the subsidiary. */ | |
3209 setup_raw_text_coding_system (coding); | |
3210 } | |
3205 coding->dst_multibyte = 0; | 3211 coding->dst_multibyte = 0; |
3206 | 3212 |
3207 if (CODING_REQUIRE_ENCODING (coding)) | 3213 if (CODING_REQUIRE_ENCODING (coding)) |
3208 { | 3214 { |
3209 int require = encoding_buffer_size (coding, len); | 3215 int require = encoding_buffer_size (coding, len); |
4505 chan_process[i] = Qnil; | 4511 chan_process[i] = Qnil; |
4506 proc_buffered_char[i] = -1; | 4512 proc_buffered_char[i] = -1; |
4507 } | 4513 } |
4508 bzero (proc_decode_coding_system, sizeof proc_decode_coding_system); | 4514 bzero (proc_decode_coding_system, sizeof proc_decode_coding_system); |
4509 bzero (proc_encode_coding_system, sizeof proc_encode_coding_system); | 4515 bzero (proc_encode_coding_system, sizeof proc_encode_coding_system); |
4510 | |
4511 Vdefault_process_coding_system | |
4512 = (NILP (buffer_defaults.enable_multibyte_characters) | |
4513 ? Fcons (Qraw_text, Qnil) | |
4514 : Fcons (Qemacs_mule, Qnil)); | |
4515 } | 4516 } |
4516 | 4517 |
4517 void | 4518 void |
4518 syms_of_process () | 4519 syms_of_process () |
4519 { | 4520 { |