comparison src/callproc.c @ 18651:982814f78d0d

(Fcall_process): If enable-multibyte-characters is nil, do not encode arguments for process, and decode output of process by emacs-mule. (Fcall_process_region): If enable-multibyte-characters is nil, do not encode text to be given to process, and decode output of process by emacs-mule.
author Kenichi Handa <handa@m17n.org>
date Mon, 07 Jul 1997 00:59:44 +0000
parents 8c13c54d52c8
children a407fb58d35f
comparison
equal deleted inserted replaced
18650:aa3f2820e2ac 18651:982814f78d0d
243 int i; 243 int i;
244 244
245 /* If arguments are supplied, we may have to encode them. */ 245 /* If arguments are supplied, we may have to encode them. */
246 if (nargs >= 5) 246 if (nargs >= 5)
247 { 247 {
248 if (NILP (val = Vcoding_system_for_write)) 248 if (!NILP (Vcoding_system_for_write))
249 val = Vcoding_system_for_write;
250 else if (NILP (current_buffer->enable_multibyte_characters))
251 val = Qnil;
252 else
249 { 253 {
250 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 254 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
251 args2[0] = Qcall_process; 255 args2[0] = Qcall_process;
252 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 256 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
253 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 257 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
254 if (CONSP (coding_systems)) 258 if (CONSP (coding_systems))
255 val = XCONS (coding_systems)->cdr; 259 val = XCONS (coding_systems)->cdr;
256 else if (CONSP (Vdefault_process_coding_system)) 260 else if (CONSP (Vdefault_process_coding_system))
257 val = XCONS (Vdefault_process_coding_system)->cdr; 261 val = XCONS (Vdefault_process_coding_system)->cdr;
262 else
263 val = Qnil;
258 } 264 }
259 setup_coding_system (Fcheck_coding_system (val), &argument_coding); 265 setup_coding_system (Fcheck_coding_system (val), &argument_coding);
260 } 266 }
261 267
262 /* If BUFFER is nil, we must read process output once and then 268 /* If BUFFER is nil, we must read process output once and then
264 an integer, we can discard it without reading. */ 270 an integer, we can discard it without reading. */
265 if (nargs < 3 || NILP (args[2])) 271 if (nargs < 3 || NILP (args[2]))
266 setup_coding_system (Qnil, &process_coding); 272 setup_coding_system (Qnil, &process_coding);
267 else if (!INTEGERP (args[2])) 273 else if (!INTEGERP (args[2]))
268 { 274 {
269 if (NILP (val = Vcoding_system_for_read)) 275 val = Qnil;
276 if (!NILP (Vcoding_system_for_read))
277 val = Vcoding_system_for_read;
278 else if (NILP (current_buffer->enable_multibyte_characters))
279 val = Qemacs_mule;
280 else
270 { 281 {
271 if (!EQ (coding_systems, Qt)) 282 if (!EQ (coding_systems, Qt))
272 { 283 {
273 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 284 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
274 args2[0] = Qcall_process; 285 args2[0] = Qcall_process;
278 } 289 }
279 if (CONSP (coding_systems)) 290 if (CONSP (coding_systems))
280 val = XCONS (coding_systems)->car; 291 val = XCONS (coding_systems)->car;
281 else if (CONSP (Vdefault_process_coding_system)) 292 else if (CONSP (Vdefault_process_coding_system))
282 val = XCONS (Vdefault_process_coding_system)->car; 293 val = XCONS (Vdefault_process_coding_system)->car;
294 else
295 val = Qnil;
283 } 296 }
284 setup_coding_system (Fcheck_coding_system (val), &process_coding); 297 setup_coding_system (Fcheck_coding_system (val), &process_coding);
285 } 298 }
286 } 299 }
287 300
779 specbind (Qbuffer_file_type, Vbinary_process_input); 792 specbind (Qbuffer_file_type, Vbinary_process_input);
780 if (NILP (Vbinary_process_input)) 793 if (NILP (Vbinary_process_input))
781 val = Qnil; 794 val = Qnil;
782 else 795 else
783 #endif 796 #endif
784 if (NILP (val = Vcoding_system_for_write)) 797 {
785 { 798 if (!NILP (Vcoding_system_for_write))
786 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 799 val = Vcoding_system_for_write;
787 args2[0] = Qcall_process_region; 800 else if (NILP (current_buffer->enable_multibyte_characters))
788 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 801 val = Qnil;
789 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 802 else
790 if (CONSP (coding_systems)) 803 {
791 val = XCONS (coding_systems)->cdr; 804 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
792 else if (CONSP (Vdefault_process_coding_system)) 805 args2[0] = Qcall_process_region;
793 val = XCONS (Vdefault_process_coding_system)->car; 806 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
794 } 807 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
808 if (CONSP (coding_systems))
809 val = XCONS (coding_systems)->cdr;
810 else if (CONSP (Vdefault_process_coding_system))
811 val = XCONS (Vdefault_process_coding_system)->car;
812 else
813 val = Qnil;
814 }
815 }
795 specbind (intern ("coding-system-for-write"), val); 816 specbind (intern ("coding-system-for-write"), val);
796 Fwrite_region (start, end, filename_string, Qnil, Qlambda, Qnil); 817 Fwrite_region (start, end, filename_string, Qnil, Qlambda, Qnil);
797 818
798 #ifdef DOS_NT 819 #ifdef DOS_NT
799 if (NILP (Vbinary_process_input)) 820 if (NILP (Vbinary_process_input))
800 val = Qnil; 821 val = Qnil;
801 else 822 else
802 #endif 823 #endif
803 if (NILP (val = Vcoding_system_for_read)) 824 {
804 { 825 if (!NILP (Vcoding_system_for_read))
805 if (EQ (coding_systems, Qt)) 826 val = Vcoding_system_for_read;
806 { 827 else if (NILP (current_buffer->enable_multibyte_characters))
807 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 828 val = Qemacs_mule;
808 args2[0] = Qcall_process_region; 829 else
809 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 830 {
810 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 831 if (EQ (coding_systems, Qt))
811 } 832 {
812 val = CONSP (coding_systems) ? XCONS (coding_systems)->car : Qnil; 833 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
813 } 834 args2[0] = Qcall_process_region;
835 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
836 coding_systems = Ffind_operation_coding_system (nargs + 1,
837 args2);
838 }
839 val = CONSP (coding_systems) ? XCONS (coding_systems)->car : Qnil;
840 }
841 }
814 specbind (intern ("coding-system-for-read"), val); 842 specbind (intern ("coding-system-for-read"), val);
815 843
816 record_unwind_protect (delete_temp_file, filename_string); 844 record_unwind_protect (delete_temp_file, filename_string);
817 845
818 if (!NILP (args[3])) 846 if (!NILP (args[3]))