comparison src/process.c @ 17041:b61cbe595be5

Include charset.h and coding.h. (proc_decode_coding_system, proc_encode_coding_system): New variables. (Fstart_process, create_process, Fopen_network_stream): Setup coding systems for character code conversion. (READ_CHILD_OUTPUT): New macro. (read_process_output): Perform character code conversion of a process output. (send_process): Perform character code conversion of a text sent to a process. (Fset_process_coding_system, Fprocess_coding_system): New functions. (syms_of_process): Handle them.
author Karl Heuer <kwzh@gnu.org>
date Thu, 20 Feb 1997 06:53:55 +0000
parents e9dc2569cb12
children 3a348cbb354f
comparison
equal deleted inserted replaced
17040:74d21e4a28f9 17041:b61cbe595be5
96 #include "systty.h" 96 #include "systty.h"
97 97
98 #include "lisp.h" 98 #include "lisp.h"
99 #include "window.h" 99 #include "window.h"
100 #include "buffer.h" 100 #include "buffer.h"
101 #include "charset.h"
102 #include "coding.h"
101 #include "process.h" 103 #include "process.h"
102 #include "termhooks.h" 104 #include "termhooks.h"
103 #include "termopts.h" 105 #include "termopts.h"
104 #include "commands.h" 106 #include "commands.h"
105 #include "frame.h" 107 #include "frame.h"
244 Always -1 on systems that support FIONREAD. */ 246 Always -1 on systems that support FIONREAD. */
245 247
246 /* Don't make static; need to access externally. */ 248 /* Don't make static; need to access externally. */
247 int proc_buffered_char[MAXDESC]; 249 int proc_buffered_char[MAXDESC];
248 250
251 /* Table of `struct coding-system' for each process. */
252 static struct coding_system proc_decode_coding_system[MAXDESC];
253 static struct coding_system proc_encode_coding_system[MAXDESC];
254
249 static Lisp_Object get_process (); 255 static Lisp_Object get_process ();
250 256
251 extern EMACS_TIME timer_check (); 257 extern EMACS_TIME timer_check ();
252 extern int timers_run; 258 extern int timers_run;
253 259
1016 NAME is name for process. It is modified if necessary to make it unique.\n\ 1022 NAME is name for process. It is modified if necessary to make it unique.\n\
1017 BUFFER is the buffer or (buffer-name) to associate with the process.\n\ 1023 BUFFER is the buffer or (buffer-name) to associate with the process.\n\
1018 Process output goes at end of that buffer, unless you specify\n\ 1024 Process output goes at end of that buffer, unless you specify\n\
1019 an output stream or filter function to handle the output.\n\ 1025 an output stream or filter function to handle the output.\n\
1020 BUFFER may be also nil, meaning that this process is not associated\n\ 1026 BUFFER may be also nil, meaning that this process is not associated\n\
1021 with any buffer\n\ 1027 with any buffer.\n\
1022 Third arg is program file name. It is searched for as in the shell.\n\ 1028 Third arg is program file name. It is searched for as in the shell.\n\
1023 Remaining arguments are strings to give program as arguments.") 1029 Remaining arguments are strings to give program as arguments.")
1024 (nargs, args) 1030 (nargs, args)
1025 int nargs; 1031 int nargs;
1026 register Lisp_Object *args; 1032 register Lisp_Object *args;
1145 1151
1146 /* Make the process marker point into the process buffer (if any). */ 1152 /* Make the process marker point into the process buffer (if any). */
1147 if (!NILP (buffer)) 1153 if (!NILP (buffer))
1148 Fset_marker (XPROCESS (proc)->mark, 1154 Fset_marker (XPROCESS (proc)->mark,
1149 make_number (BUF_ZV (XBUFFER (buffer))), buffer); 1155 make_number (BUF_ZV (XBUFFER (buffer))), buffer);
1156
1157 /* Setup coding systems for communicating with the process. */
1158 {
1159 /* Qt denotes that we have not yet called Ffind_coding_system. */
1160 Lisp_Object coding_systems = Qt;
1161 Lisp_Object val, *args2;
1162 struct gcpro gcpro1;
1163
1164 if (NILP (val = Vcoding_system_for_read))
1165 {
1166 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
1167 args2[0] = Qstart_process;
1168 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1169 GCPRO1 (proc);
1170 coding_systems = Ffind_coding_system (nargs + 1, args2);
1171 UNGCPRO;
1172 if (CONSP (coding_systems))
1173 val = XCONS (coding_systems)->car;
1174 }
1175 XPROCESS (proc)->decode_coding_system = val;
1176
1177 if (NILP (val = Vcoding_system_for_write))
1178 {
1179 if (EQ (coding_systems, Qt))
1180 {
1181 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2);
1182 args2[0] = Qstart_process;
1183 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1184 GCPRO1 (proc);
1185 coding_systems = Ffind_coding_system (nargs + 1, args2);
1186 UNGCPRO;
1187 }
1188 if (CONSP (coding_systems))
1189 val = XCONS (coding_systems)->cdr;
1190 }
1191 XPROCESS (proc)->encode_coding_system = val;
1192 }
1193
1194 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1195 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
1150 1196
1151 create_process (proc, new_argv, current_dir); 1197 create_process (proc, new_argv, current_dir);
1152 1198
1153 return unbind_to (count, proc); 1199 return unbind_to (count, proc);
1154 } 1200 }
1308 XPROCESS (process)->subtty = Qnil; 1354 XPROCESS (process)->subtty = Qnil;
1309 else 1355 else
1310 XSETFASTINT (XPROCESS (process)->subtty, forkin); 1356 XSETFASTINT (XPROCESS (process)->subtty, forkin);
1311 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil); 1357 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil);
1312 XPROCESS (process)->status = Qrun; 1358 XPROCESS (process)->status = Qrun;
1359 setup_coding_system (XPROCESS (process)->decode_coding_system,
1360 &proc_decode_coding_system[inchannel]);
1361 setup_coding_system (XPROCESS (process)->encode_coding_system,
1362 &proc_encode_coding_system[outchannel]);
1313 1363
1314 /* Delay interrupts until we have a chance to store 1364 /* Delay interrupts until we have a chance to store
1315 the new fork's pid in its process structure */ 1365 the new fork's pid in its process structure */
1316 #ifdef POSIX_SIGNALS 1366 #ifdef POSIX_SIGNALS
1317 sigemptyset (&blocked); 1367 sigemptyset (&blocked);
1818 XPROCESS (proc)->status = Qrun; 1868 XPROCESS (proc)->status = Qrun;
1819 FD_SET (inch, &input_wait_mask); 1869 FD_SET (inch, &input_wait_mask);
1820 FD_SET (inch, &non_keyboard_wait_mask); 1870 FD_SET (inch, &non_keyboard_wait_mask);
1821 if (inch > max_process_desc) 1871 if (inch > max_process_desc)
1822 max_process_desc = inch; 1872 max_process_desc = inch;
1873
1874 /* Setup coding systems for communicating with the network stream. */
1875 {
1876 struct gcpro gcpro1;
1877 /* Qt denotes that we have not yet called Ffind_coding_system. */
1878 Lisp_Object coding_systems = Qt;
1879 Lisp_Object args[5], val;
1880
1881 if (NILP (val = Vcoding_system_for_read))
1882 {
1883 args[0] = Qopen_network_stream, args[1] = name,
1884 args[2] = buffer, args[3] = host, args[4] = service;
1885 GCPRO1 (proc);
1886 coding_systems = Ffind_coding_system (5, args);
1887 UNGCPRO;
1888 val = (CONSP (coding_systems) ? XCONS (coding_systems)->car : Qnil);
1889 }
1890 XPROCESS (proc)->decode_coding_system = val;
1891
1892 if (NILP (val = Vcoding_system_for_write))
1893 {
1894 if (EQ (coding_systems, Qt))
1895 {
1896 args[0] = Qopen_network_stream, args[1] = name,
1897 args[2] = buffer, args[3] = host, args[4] = service;
1898 GCPRO1 (proc);
1899 coding_systems = Ffind_coding_system (5, args);
1900 UNGCPRO;
1901 }
1902 val = (CONSP (coding_systems) ? XCONS (coding_systems)->cdr : Qnil);
1903 }
1904 XPROCESS (proc)->encode_coding_system = val;
1905 }
1906
1907 setup_coding_system (XPROCESS (proc)->decode_coding_system,
1908 &proc_decode_coding_system[inch]);
1909 setup_coding_system (XPROCESS (proc)->encode_coding_system,
1910 &proc_encode_coding_system[outch]);
1911
1912 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1913 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
1823 1914
1824 UNGCPRO; 1915 UNGCPRO;
1825 return proc; 1916 return proc;
1826 } 1917 }
1827 #endif /* HAVE_SOCKETS */ 1918 #endif /* HAVE_SOCKETS */
2445 Vinhibit_quit = Qt; 2536 Vinhibit_quit = Qt;
2446 update_echo_area (); 2537 update_echo_area ();
2447 Fsleep_for (make_number (2), Qnil); 2538 Fsleep_for (make_number (2), Qnil);
2448 } 2539 }
2449 2540
2541 #ifdef WINDOWSNT
2542 #define READ_CHILD_OUTPUT read_child_output
2543 #else
2544 #define READ_CHILD_OUTPUT read
2545 #endif
2546
2450 /* Read pending output from the process channel, 2547 /* Read pending output from the process channel,
2451 starting with our buffered-ahead character if we have one. 2548 starting with our buffered-ahead character if we have one.
2452 Yield number of characters read. 2549 Yield number of decoded characters read.
2453 2550
2454 This function reads at most 1024 characters. 2551 This function reads at most 1024 characters.
2455 If you want to read all available subprocess output, 2552 If you want to read all available subprocess output,
2456 you must call it repeatedly until it returns zero. */ 2553 you must call it repeatedly until it returns zero.
2554
2555 The characters read are decoded according to PROC's coding-system
2556 for decoding. */
2457 2557
2458 read_process_output (proc, channel) 2558 read_process_output (proc, channel)
2459 Lisp_Object proc; 2559 Lisp_Object proc;
2460 register int channel; 2560 register int channel;
2461 { 2561 {
2462 register int nchars; 2562 register int nchars;
2563 char *chars;
2463 #ifdef VMS 2564 #ifdef VMS
2464 char *chars; 2565 int chars_allocated = 0; /* If 1, `chars' should be freed later. */
2465 #else 2566 #else
2466 char chars[1024]; 2567 char buf[1024];
2467 #endif 2568 #endif
2468 register Lisp_Object outstream; 2569 register Lisp_Object outstream;
2469 register struct buffer *old = current_buffer; 2570 register struct buffer *old = current_buffer;
2470 register struct Lisp_Process *p = XPROCESS (proc); 2571 register struct Lisp_Process *p = XPROCESS (proc);
2471 register int opoint; 2572 register int opoint;
2573 struct coding_system *coding = &proc_decode_coding_system[channel];
2574 int chars_in_decoding_buf = 0; /* If 1, `chars' points
2575 XSTRING (p->decoding_buf)->data. */
2472 2576
2473 #ifdef VMS 2577 #ifdef VMS
2474 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); 2578 VMS_PROC_STUFF *vs, *get_vms_process_pointer();
2475 2579
2476 vs = get_vms_process_pointer (p->pid); 2580 vs = get_vms_process_pointer (p->pid);
2488 if (nchars <= 0) 2592 if (nchars <= 0)
2489 { 2593 {
2490 start_vms_process_read (vs); /* Crank up the next read on the process */ 2594 start_vms_process_read (vs); /* Crank up the next read on the process */
2491 return 1; /* Nothing worth printing, say we got 1 */ 2595 return 1; /* Nothing worth printing, say we got 1 */
2492 } 2596 }
2597 if (coding->carryover_size)
2598 {
2599 /* The data carried over in the previous decoding should be
2600 prepended to the new data read to decode all together. */
2601 char *buf = (char *) xmalloc (nchars + coding->carryover_size);
2602
2603 bcopy (coding->carryover, buf, coding->carryover_size);
2604 bcopy (chars, buf + coding->carryover_size, nchars);
2605 chars = buf;
2606 chars_allocated = 1;
2607 }
2493 #else /* not VMS */ 2608 #else /* not VMS */
2494 2609
2610 if (coding->carryover_size)
2611 /* The data carried over in the previous decoding should be
2612 prepended to the new data read to decode all together. */
2613 bcopy (coding->carryover, buf, coding->carryover_size);
2614
2495 if (proc_buffered_char[channel] < 0) 2615 if (proc_buffered_char[channel] < 0)
2496 nchars = read (channel, chars, sizeof (chars)); 2616 nchars = READ_CHILD_OUTPUT (channel, buf + coding->carryover_size,
2617 (sizeof buf) - coding->carryover_size);
2497 else 2618 else
2498 { 2619 {
2499 chars[0] = proc_buffered_char[channel]; 2620 buf[coding->carryover_size] = proc_buffered_char[channel];
2500 proc_buffered_char[channel] = -1; 2621 proc_buffered_char[channel] = -1;
2501 nchars = read (channel, chars + 1, sizeof (chars) - 1); 2622 nchars = READ_CHILD_OUTPUT (channel, buf + coding->carryover_size + 1,
2623 (sizeof buf) - coding->carryover_size - 1);
2502 if (nchars < 0) 2624 if (nchars < 0)
2503 nchars = 1; 2625 nchars = 1;
2504 else 2626 else
2505 nchars = nchars + 1; 2627 nchars = nchars + 1;
2506 } 2628 }
2629 chars = buf;
2507 #endif /* not VMS */ 2630 #endif /* not VMS */
2508 2631
2632 /* At this point, NCHARS holds number of characters just received
2633 (including the one in proc_buffered_char[channel]). */
2509 if (nchars <= 0) return nchars; 2634 if (nchars <= 0) return nchars;
2635
2636 /* Now set NCHARS how many bytes we must decode. */
2637 nchars += coding->carryover_size;
2638
2639 if (CODING_REQUIRE_CONVERSION (coding))
2640 {
2641 int require = decoding_buffer_size (coding, nchars);
2642 int consumed, produced;
2643
2644 if (XSTRING (p->decoding_buf)->size < require)
2645 p->decoding_buf = make_uninit_string (require);
2646 produced = decode_coding (coding, chars, XSTRING (p->decoding_buf)->data,
2647 nchars, XSTRING (p->decoding_buf)->size,
2648 &consumed);
2649
2650 /* New coding-system might be found by `decode_coding'. */
2651 if (!EQ (p->decode_coding_system, coding->symbol))
2652 {
2653 p->decode_coding_system = coding->symbol;
2654 setup_coding_system (coding->symbol,
2655 &proc_decode_coding_system[channel]);
2656 /* If coding-system for encoding is not yet decided, we set it
2657 as the same as coding-system for decoding. */
2658 if (NILP (p->encode_coding_system))
2659 {
2660 p->encode_coding_system = coding->symbol;
2661 setup_coding_system (coding->symbol,
2662 &proc_encode_coding_system[channel]);
2663 }
2664 }
2665 #ifdef VMS
2666 /* Now we don't need the contents of `chars'. */
2667 if (chars_allocated)
2668 free (chars);
2669 #endif
2670 if (produced == 0)
2671 return 0;
2672 chars = XSTRING (p->decoding_buf)->data;
2673 nchars = produced;
2674 chars_in_decoding_buf = 1;
2675 }
2676 #ifdef VMS
2677 else if (chars_allocated)
2678 {
2679 /* Although we don't have to decode the received data, we must
2680 move it to an area which we don't have to free. */
2681 if (! STRINGP (p->decoding_buf)
2682 || XSTRING (p->decoding_buf)->size < nchars)
2683 p->decoding_buf = make_uninit_string (nchars);
2684 bcopy (chars, XSTRING (p->decoding_buf)->data, nchars);
2685 free (chars);
2686 chars = XSTRING (p->decoding_buf)->data;
2687 chars_in_decoding_buf = 1;
2688 }
2689 #endif
2510 2690
2511 outstream = p->filter; 2691 outstream = p->filter;
2512 if (!NILP (outstream)) 2692 if (!NILP (outstream))
2513 { 2693 {
2514 /* We inhibit quit here instead of just catching it so that 2694 /* We inhibit quit here instead of just catching it so that
2622 if (PT <= XFASTINT (old_zv)) 2802 if (PT <= XFASTINT (old_zv))
2623 XSETFASTINT (old_zv, XFASTINT (old_zv) + nchars); 2803 XSETFASTINT (old_zv, XFASTINT (old_zv) + nchars);
2624 2804
2625 /* Insert before markers in case we are inserting where 2805 /* Insert before markers in case we are inserting where
2626 the buffer's mark is, and the user's next command is Meta-y. */ 2806 the buffer's mark is, and the user's next command is Meta-y. */
2627 insert_before_markers (chars, nchars); 2807 if (chars_in_decoding_buf)
2808 insert_from_string_before_markers (p->decoding_buf, 0, nchars, 0);
2809 else
2810 insert_before_markers (chars, nchars);
2628 Fset_marker (p->mark, make_number (PT), p->buffer); 2811 Fset_marker (p->mark, make_number (PT), p->buffer);
2629 2812
2630 update_mode_lines++; 2813 update_mode_lines++;
2631 2814
2632 /* If the restriction isn't what it should be, set it. */ 2815 /* If the restriction isn't what it should be, set it. */
2669 longjmp (send_process_frame, 1); 2852 longjmp (send_process_frame, 1);
2670 } 2853 }
2671 2854
2672 /* Send some data to process PROC. 2855 /* Send some data to process PROC.
2673 BUF is the beginning of the data; LEN is the number of characters. 2856 BUF is the beginning of the data; LEN is the number of characters.
2674 OBJECT is the Lisp object that the data comes from. */ 2857 OBJECT is the Lisp object that the data comes from.
2858
2859 The data is encoded by PROC's coding-system for encoding before it
2860 is sent. But if the data ends at the middle of multi-byte
2861 representation, that incomplete sequence of bytes are sent without
2862 being encoded. Should we store them in a buffer to prepend them to
2863 the data send later? */
2675 2864
2676 send_process (proc, buf, len, object) 2865 send_process (proc, buf, len, object)
2677 volatile Lisp_Object proc; 2866 volatile Lisp_Object proc;
2678 char *buf; 2867 char *buf;
2679 int len; 2868 int len;
2680 Lisp_Object object; 2869 Lisp_Object object;
2681 { 2870 {
2682 /* Use volatile to protect variables from being clobbered by longjmp. */ 2871 /* Use volatile to protect variables from being clobbered by longjmp. */
2683 int rv; 2872 int rv;
2684 volatile unsigned char *procname = XSTRING (XPROCESS (proc)->name)->data; 2873 volatile unsigned char *procname = XSTRING (XPROCESS (proc)->name)->data;
2874 struct coding_system *coding;
2685 struct gcpro gcpro1; 2875 struct gcpro gcpro1;
2686 2876
2687 GCPRO1 (object); 2877 GCPRO1 (object);
2688 2878
2689 #ifdef VMS 2879 #ifdef VMS
2693 2883
2694 if (! NILP (XPROCESS (proc)->raw_status_low)) 2884 if (! NILP (XPROCESS (proc)->raw_status_low))
2695 update_status (XPROCESS (proc)); 2885 update_status (XPROCESS (proc));
2696 if (! EQ (XPROCESS (proc)->status, Qrun)) 2886 if (! EQ (XPROCESS (proc)->status, Qrun))
2697 error ("Process %s not running", procname); 2887 error ("Process %s not running", procname);
2888 if (XINT (XPROCESS (proc)->outfd) < 0)
2889 error ("Output file descriptor of %s is closed", procname);
2890
2891 coding = &proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
2892 if (CODING_REQUIRE_CONVERSION (coding))
2893 {
2894 int require = encoding_buffer_size (coding, len);
2895 int offset, dummy;
2896 char *temp_buf = NULL;
2897
2898 /* Remember the offset of data because a string or a buffer may
2899 be relocated. Setting OFFSET to -1 means we don't have to
2900 care relocation. */
2901 offset = (BUFFERP (object)
2902 ? BUF_PTR_CHAR_POS (XBUFFER (object), (unsigned char *) buf)
2903 : (STRINGP (object)
2904 ? offset = buf - (char *) XSTRING (object)->data
2905 : -1));
2906
2907 if (coding->carryover_size > 0)
2908 {
2909 temp_buf = (char *) xmalloc (len + coding->carryover_size);
2910
2911 if (offset >= 0)
2912 {
2913 if (BUFFERP (object))
2914 buf = (char *) BUF_CHAR_ADDRESS (XBUFFER (object), offset);
2915 else if (STRINGP (object))
2916 buf = offset + (char *) XSTRING (object)->data;
2917 /* Now we don't have to care relocation. */
2918 offset = -1;
2919 }
2920 bcopy (coding->carryover, temp_buf, coding->carryover_size);
2921 bcopy (buf, temp_buf + coding->carryover_size, len);
2922 buf = temp_buf;
2923 }
2924
2925 if (XSTRING (XPROCESS (proc)->encoding_buf)->size < require)
2926 {
2927 XPROCESS (proc)->encoding_buf = make_uninit_string (require);
2928
2929 if (offset >= 0)
2930 {
2931 if (BUFFERP (object))
2932 buf = (char *) BUF_CHAR_ADDRESS (XBUFFER (object), offset);
2933 else if (STRINGP (object))
2934 buf = offset + (char *) XSTRING (object)->data;
2935 }
2936 }
2937 object = XPROCESS (proc)->encoding_buf;
2938 len = encode_coding (coding, buf, XSTRING (object)->data,
2939 len, XSTRING (object)->size, &dummy);
2940 buf = XSTRING (object)->data;
2941 if (temp_buf)
2942 xfree (temp_buf);
2943 }
2698 2944
2699 #ifdef VMS 2945 #ifdef VMS
2700 vs = get_vms_process_pointer (p->pid); 2946 vs = get_vms_process_pointer (p->pid);
2701 if (vs == 0) 2947 if (vs == 0)
2702 error ("Could not find this process: %x", p->pid); 2948 error ("Could not find this process: %x", p->pid);
2851 3097
2852 if (XINT (start) < GPT && XINT (end) > GPT) 3098 if (XINT (start) < GPT && XINT (end) > GPT)
2853 move_gap (start); 3099 move_gap (start);
2854 3100
2855 start1 = XINT (start); 3101 start1 = XINT (start);
2856 send_process (proc, &FETCH_CHAR (start1), XINT (end) - XINT (start), 3102 send_process (proc, POS_ADDR (start1), XINT (end) - XINT (start),
2857 Fcurrent_buffer ()); 3103 Fcurrent_buffer ());
2858 3104
2859 return Qnil; 3105 return Qnil;
2860 } 3106 }
2861 3107
3712 3958
3713 update_mode_lines++; /* in case buffers use %s in mode-line-format */ 3959 update_mode_lines++; /* in case buffers use %s in mode-line-format */
3714 redisplay_preserve_echo_area (); 3960 redisplay_preserve_echo_area ();
3715 3961
3716 UNGCPRO; 3962 UNGCPRO;
3963 }
3964
3965
3966 DEFUN ("set-process-coding-system", Fset_process_coding_system,
3967 Sset_process_coding_system, 1, 3, 0,
3968 "Set coding-systems of PROCESS to DECODING (input from the process) and\n\
3969 ENCODING (output to the process).")
3970 (proc, decoding, encoding)
3971 register Lisp_Object proc, decoding, encoding;
3972 {
3973 register struct Lisp_Process *p;
3974
3975 CHECK_PROCESS (proc, 0);
3976 p = XPROCESS (proc);
3977 if (XINT (p->infd) < 0)
3978 error ("Input file descriptor of %s closed", XSTRING (p->name)->data);
3979 if (XINT (p->outfd) < 0)
3980 error ("Output file descriptor of %s closed", XSTRING (p->name)->data);
3981
3982 p->decode_coding_system = Fcheck_coding_system (decoding);
3983 p->encode_coding_system = Fcheck_coding_system (encoding);
3984 setup_coding_system (decoding,
3985 &proc_decode_coding_system[XINT (p->infd)]);
3986 setup_coding_system (encoding,
3987 &proc_encode_coding_system[XINT (p->outfd)]);
3988
3989 return Qnil;
3990 }
3991
3992 DEFUN ("process-coding-system",
3993 Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0,
3994 "Return a cons of coding-system for decoding and encoding of PROCESS.")
3995 (proc)
3996 register Lisp_Object proc;
3997 {
3998 CHECK_PROCESS (proc, 0);
3999 return Fcons (XPROCESS (proc)->decode_coding_system,
4000 XPROCESS (proc)->encode_coding_system);
3717 } 4001 }
3718 4002
3719 /* The first time this is called, assume keyboard input comes from DESC 4003 /* The first time this is called, assume keyboard input comes from DESC
3720 instead of from where we used to expect it. 4004 instead of from where we used to expect it.
3721 Subsequent calls mean assume input keyboard can come from DESC 4005 Subsequent calls mean assume input keyboard can come from DESC
3872 defsubr (&Scontinue_process); 4156 defsubr (&Scontinue_process);
3873 defsubr (&Sprocess_send_eof); 4157 defsubr (&Sprocess_send_eof);
3874 defsubr (&Ssignal_process); 4158 defsubr (&Ssignal_process);
3875 defsubr (&Swaiting_for_user_input_p); 4159 defsubr (&Swaiting_for_user_input_p);
3876 /* defsubr (&Sprocess_connection); */ 4160 /* defsubr (&Sprocess_connection); */
4161 defsubr (&Sset_process_coding_system);
4162 defsubr (&Sprocess_coding_system);
3877 } 4163 }
3878 4164
3879 4165
3880 #else /* not subprocesses */ 4166 #else /* not subprocesses */
3881 4167