comparison src/process.c @ 2200:5e58643bb169

(wait_reading_process_input): New option to wait till a given cons cell has a non-nil car. Delete vipc conditionals.
author Richard M. Stallman <rms@gnu.org>
date Mon, 15 Mar 1993 06:09:04 +0000
parents fc3cdca22f8d
children 7edc78402205
comparison
equal deleted inserted replaced
2199:d005529475af 2200:5e58643bb169
209 "exceeded file size limit" 209 "exceeded file size limit"
210 }; 210 };
211 #endif 211 #endif
212 #endif /* VMS */ 212 #endif /* VMS */
213 213
214 #ifdef vipc
215
216 #include "vipc.h"
217 extern int comm_server;
218 extern int net_listen_address;
219 #endif /* vipc */
220
221 /* t means use pty, nil means use a pipe, 214 /* t means use pty, nil means use a pipe,
222 maybe other values to come. */ 215 maybe other values to come. */
223 Lisp_Object Vprocess_connection_type; 216 Lisp_Object Vprocess_connection_type;
224 217
225 #ifdef SKTPAIR 218 #ifdef SKTPAIR
1656 -1 means gobble data immediately available but don't wait for any. 1649 -1 means gobble data immediately available but don't wait for any.
1657 1650
1658 read_kbd is a lisp value: 1651 read_kbd is a lisp value:
1659 0 to ignore keyboard input, or 1652 0 to ignore keyboard input, or
1660 1 to return when input is available, or 1653 1 to return when input is available, or
1661 -1 means caller will actually read the input, so don't throw to 1654 -1 meaning caller will actually read the input, so don't throw to
1662 the quit handler, or 1655 the quit handler, or
1656 a cons cell, meaning wait wait until its car is non-nil, or
1663 a process object, meaning wait until something arrives from that 1657 a process object, meaning wait until something arrives from that
1664 process. The return value is true iff we read some input from 1658 process. The return value is true iff we read some input from
1665 that process. 1659 that process.
1666 1660
1667 do_display != 0 means redisplay should be done to show subprocess 1661 do_display != 0 means redisplay should be done to show subprocess
1684 EMACS_TIME timeout, end_time, garbage; 1678 EMACS_TIME timeout, end_time, garbage;
1685 SELECT_TYPE Atemp; 1679 SELECT_TYPE Atemp;
1686 int wait_channel = 0; 1680 int wait_channel = 0;
1687 struct Lisp_Process *wait_proc = 0; 1681 struct Lisp_Process *wait_proc = 0;
1688 int got_some_input = 0; 1682 int got_some_input = 0;
1683 Lisp_Object *wait_for_cell = 0;
1689 1684
1690 FD_ZERO (&Available); 1685 FD_ZERO (&Available);
1691 1686
1692 /* If read_kbd is a process to watch, set wait_proc and wait_channel 1687 /* If read_kbd is a process to watch, set wait_proc and wait_channel
1693 accordingly. */ 1688 accordingly. */
1694 if (XTYPE (read_kbd) == Lisp_Process) 1689 if (XTYPE (read_kbd) == Lisp_Process)
1695 { 1690 {
1696 wait_proc = XPROCESS (read_kbd); 1691 wait_proc = XPROCESS (read_kbd);
1697 wait_channel = XFASTINT (wait_proc->infd); 1692 wait_channel = XFASTINT (wait_proc->infd);
1693 XFASTINT (read_kbd) = 0;
1694 }
1695
1696 /* If waiting for non-nil in a cell, record where. */
1697 if (XTYPE (read_kbd) == Lisp_Cons)
1698 {
1699 wait_for_cell = &XCONS (read_kbd)->car;
1698 XFASTINT (read_kbd) = 0; 1700 XFASTINT (read_kbd) = 0;
1699 } 1701 }
1700 1702
1701 waiting_for_user_input_p = XINT (read_kbd); 1703 waiting_for_user_input_p = XINT (read_kbd);
1702 1704
1844 to give it higher priority than subprocesses */ 1846 to give it higher priority than subprocesses */
1845 1847
1846 if (XINT (read_kbd) && detect_input_pending ()) 1848 if (XINT (read_kbd) && detect_input_pending ())
1847 break; 1849 break;
1848 1850
1851 /* Exit now if the cell we're waiting for became non-nil. */
1852 if (wait_for_cell && ! NILP (*wait_for_cell))
1853 break;
1854
1849 #ifdef SIGIO 1855 #ifdef SIGIO
1850 /* If we think we have keyboard input waiting, but didn't get SIGIO 1856 /* If we think we have keyboard input waiting, but didn't get SIGIO
1851 go read it. This can happen with X on BSD after logging out. 1857 go read it. This can happen with X on BSD after logging out.
1852 In that case, there really is no input and no SIGIO, 1858 In that case, there really is no input and no SIGIO,
1853 but select says there is input. */ 1859 but select says there is input. */
1854 1860
1855 /*
1856 if (XINT (read_kbd) && interrupt_input && (Available & fileno (stdin)))
1857 */
1858 if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) 1861 if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
1859 kill (0, SIGIO); 1862 kill (0, SIGIO);
1860 #endif 1863 #endif
1861
1862 #ifdef vipc
1863 /* Check for connection from other process */
1864
1865 if (Available & ChannelMask (comm_server))
1866 {
1867 Available &= ~(ChannelMask (comm_server));
1868 create_commchan ();
1869 }
1870 #endif /* vipc */
1871 1864
1872 if (! wait_proc) 1865 if (! wait_proc)
1873 got_some_input |= nfds > 0; 1866 got_some_input |= nfds > 0;
1874 1867
1875 /* If checking input just got us a size-change event from X, 1868 /* If checking input just got us a size-change event from X,
1894 got_some_input = 1; 1887 got_some_input = 1;
1895 } 1888 }
1896 proc = chan_process[channel]; 1889 proc = chan_process[channel];
1897 if (NILP (proc)) 1890 if (NILP (proc))
1898 continue; 1891 continue;
1899
1900 #ifdef vipc
1901 /* It's a command channel */
1902 if (!NILP (XPROCESS (proc)->command_channel_p))
1903 {
1904 ProcessCommChan (channel, proc);
1905 if (NILP (XPROCESS (proc)->command_channel_p))
1906 {
1907 /* It has ceased to be a command channel! */
1908 int bytes_available;
1909 if (ioctl (channel, FIONREAD, &bytes_available) < 0)
1910 bytes_available = 0;
1911 if (bytes_available)
1912 FD_SET (channel, &Available);
1913 }
1914 continue;
1915 }
1916 #endif /* vipc */
1917 1892
1918 /* Read data from the process, starting with our 1893 /* Read data from the process, starting with our
1919 buffered-ahead character if we have one. */ 1894 buffered-ahead character if we have one. */
1920 1895
1921 nread = read_process_output (proc, channel); 1896 nread = read_process_output (proc, channel);