Mercurial > hg > xemacs-beta
comparison src/process.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | 441bb1e64a06 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
358 connected_via_filedesc_p (struct Lisp_Process *p) | 358 connected_via_filedesc_p (struct Lisp_Process *p) |
359 { | 359 { |
360 return p->connected_via_filedesc_p; | 360 return p->connected_via_filedesc_p; |
361 } | 361 } |
362 | 362 |
363 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0 /* | 363 DEFUN ("processp", Fprocessp, 1, 1, 0, /* |
364 Return t if OBJECT is a process. | 364 Return t if OBJECT is a process. |
365 */ ) | 365 */ |
366 (obj) | 366 (obj)) |
367 Lisp_Object obj; | |
368 { | 367 { |
369 return ((PROCESSP (obj)) ? Qt : Qnil); | 368 return ((PROCESSP (obj)) ? Qt : Qnil); |
370 } | 369 } |
371 | 370 |
372 DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0 /* | 371 DEFUN ("process-list", Fprocess_list, 0, 0, 0, /* |
373 Return a list of all processes. | 372 Return a list of all processes. |
374 */ ) | 373 */ |
375 () | 374 ()) |
376 { | 375 { |
377 return Fcopy_sequence (Vprocess_list); | 376 return Fcopy_sequence (Vprocess_list); |
378 } | 377 } |
379 | 378 |
380 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0 /* | 379 DEFUN ("get-process", Fget_process, 1, 1, 0, /* |
381 Return the process named NAME, or nil if there is none. | 380 Return the process named NAME, or nil if there is none. |
382 */ ) | 381 */ |
383 (name) | 382 (name)) |
384 Lisp_Object name; | |
385 { | 383 { |
386 Lisp_Object tail; | 384 Lisp_Object tail; |
387 | 385 |
388 if (GC_PROCESSP (name)) | 386 if (GC_PROCESSP (name)) |
389 return (name); | 387 return (name); |
401 return (XCAR (tail)); | 399 return (XCAR (tail)); |
402 } | 400 } |
403 return Qnil; | 401 return Qnil; |
404 } | 402 } |
405 | 403 |
406 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0 /* | 404 DEFUN ("get-buffer-process", Fget_buffer_process, 1, 1, 0, /* |
407 Return the (or, a) process associated with BUFFER. | 405 Return the (or, a) process associated with BUFFER. |
408 BUFFER may be a buffer or the name of one. | 406 BUFFER may be a buffer or the name of one. |
409 */ ) | 407 */ |
410 (name) | 408 (name)) |
411 Lisp_Object name; | |
412 { | 409 { |
413 Lisp_Object buf, tail, proc; | 410 Lisp_Object buf, tail, proc; |
414 | 411 |
415 if (GC_NILP (name)) return Qnil; | 412 if (GC_NILP (name)) return Qnil; |
416 buf = Fget_buffer (name); | 413 buf = Fget_buffer (name); |
473 error ("Process %s does not exist", XSTRING_DATA (name)); | 470 error ("Process %s does not exist", XSTRING_DATA (name)); |
474 /* NOTREACHED */ | 471 /* NOTREACHED */ |
475 return Qnil; /* warning suppression */ | 472 return Qnil; /* warning suppression */ |
476 } | 473 } |
477 | 474 |
478 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0 /* | 475 DEFUN ("process-id", Fprocess_id, 1, 1, 0, /* |
479 Return the process id of PROCESS. | 476 Return the process id of PROCESS. |
480 This is the pid of the Unix process which PROCESS uses or talks to. | 477 This is the pid of the Unix process which PROCESS uses or talks to. |
481 For a network connection, this value is a cons of | 478 For a network connection, this value is a cons of |
482 (foreign-network-port . foreign-host-name). | 479 (foreign-network-port . foreign-host-name). |
483 */ ) | 480 */ |
484 (proc) | 481 (proc)) |
485 Lisp_Object proc; | |
486 { | 482 { |
487 Lisp_Object pid; | 483 Lisp_Object pid; |
488 CHECK_PROCESS (proc); | 484 CHECK_PROCESS (proc); |
489 | 485 |
490 pid = XPROCESS (proc)->pid; | 486 pid = XPROCESS (proc)->pid; |
493 return (Fcons (Fcar (pid), Fcdr (pid))); | 489 return (Fcons (Fcar (pid), Fcdr (pid))); |
494 else | 490 else |
495 return (pid); | 491 return (pid); |
496 } | 492 } |
497 | 493 |
498 DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0 /* | 494 DEFUN ("process-name", Fprocess_name, 1, 1, 0, /* |
499 Return the name of PROCESS, as a string. | 495 Return the name of PROCESS, as a string. |
500 This is the name of the program invoked in PROCESS, | 496 This is the name of the program invoked in PROCESS, |
501 possibly modified to make it unique among process names. | 497 possibly modified to make it unique among process names. |
502 */ ) | 498 */ |
503 (proc) | 499 (proc)) |
504 Lisp_Object proc; | |
505 { | 500 { |
506 CHECK_PROCESS (proc); | 501 CHECK_PROCESS (proc); |
507 return XPROCESS (proc)->name; | 502 return XPROCESS (proc)->name; |
508 } | 503 } |
509 | 504 |
510 DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0 /* | 505 DEFUN ("process-command", Fprocess_command, 1, 1, 0, /* |
511 Return the command that was executed to start PROCESS. | 506 Return the command that was executed to start PROCESS. |
512 This is a list of strings, the first string being the program executed | 507 This is a list of strings, the first string being the program executed |
513 and the rest of the strings being the arguments given to it. | 508 and the rest of the strings being the arguments given to it. |
514 */ ) | 509 */ |
515 (proc) | 510 (proc)) |
516 Lisp_Object proc; | |
517 { | 511 { |
518 CHECK_PROCESS (proc); | 512 CHECK_PROCESS (proc); |
519 return XPROCESS (proc)->command; | 513 return XPROCESS (proc)->command; |
520 } | 514 } |
521 | 515 |
1082 if (EQ (XPROCESS (proc)->pid, Qnil)) | 1076 if (EQ (XPROCESS (proc)->pid, Qnil)) |
1083 remove_process (proc); | 1077 remove_process (proc); |
1084 return Qnil; | 1078 return Qnil; |
1085 } | 1079 } |
1086 | 1080 |
1087 DEFUN ("start-process-internal", Fstart_process_internal, | 1081 DEFUN ("start-process-internal", Fstart_process_internal, 3, MANY, 0, /* |
1088 Sstart_process_internal, 3, MANY, 0 /* | |
1089 Start a program in a subprocess. Return the process object for it. | 1082 Start a program in a subprocess. Return the process object for it. |
1090 Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS | 1083 Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS |
1091 NAME is name for process. It is modified if necessary to make it unique. | 1084 NAME is name for process. It is modified if necessary to make it unique. |
1092 BUFFER is the buffer or (buffer-name) to associate with the process. | 1085 BUFFER is the buffer or (buffer-name) to associate with the process. |
1093 Process output goes at end of that buffer, unless you specify | 1086 Process output goes at end of that buffer, unless you specify |
1096 with any buffer | 1089 with any buffer |
1097 Third arg is program file name. It is searched for as in the shell. | 1090 Third arg is program file name. It is searched for as in the shell. |
1098 Remaining arguments are strings to give program as arguments. | 1091 Remaining arguments are strings to give program as arguments. |
1099 INCODE and OUTCODE specify the coding-system objects used in input/output | 1092 INCODE and OUTCODE specify the coding-system objects used in input/output |
1100 from/to the process. | 1093 from/to the process. |
1101 */ ) | 1094 */ |
1102 (nargs, args) | 1095 (int nargs, Lisp_Object *args)) |
1103 int nargs; | |
1104 Lisp_Object *args; | |
1105 { | 1096 { |
1106 /* !!#### This function has not been Mule-ized */ | 1097 /* !!#### This function has not been Mule-ized */ |
1107 /* This function can GC */ | 1098 /* This function can GC */ |
1108 Lisp_Object buffer, name, program, proc, current_dir; | 1099 Lisp_Object buffer, name, program, proc, current_dir; |
1109 Lisp_Object tem; | 1100 Lisp_Object tem; |
1348 exactly like a normal process when reading and writing. Only | 1339 exactly like a normal process when reading and writing. Only |
1349 differences are in status display and process deletion. A network | 1340 differences are in status display and process deletion. A network |
1350 connection has no PID; you cannot signal it. All you can do is | 1341 connection has no PID; you cannot signal it. All you can do is |
1351 deactivate and close it via delete-process */ | 1342 deactivate and close it via delete-process */ |
1352 | 1343 |
1353 DEFUN ("open-network-stream-internal", Fopen_network_stream_internal, | 1344 DEFUN ("open-network-stream-internal", Fopen_network_stream_internal, 4, 4, 0, /* |
1354 Sopen_network_stream_internal, | |
1355 4, 4, 0 /* | |
1356 Open a TCP connection for a service to a host. | 1345 Open a TCP connection for a service to a host. |
1357 Returns a subprocess-object to represent the connection. | 1346 Returns a subprocess-object to represent the connection. |
1358 Input and output work as for subprocesses; `delete-process' closes it. | 1347 Input and output work as for subprocesses; `delete-process' closes it. |
1359 Args are NAME BUFFER HOST SERVICE. | 1348 Args are NAME BUFFER HOST SERVICE. |
1360 NAME is name for process. It is modified if necessary to make it unique. | 1349 NAME is name for process. It is modified if necessary to make it unique. |
1364 BUFFER may be also nil, meaning that this process is not associated | 1353 BUFFER may be also nil, meaning that this process is not associated |
1365 with any buffer | 1354 with any buffer |
1366 Third arg is name of the host to connect to, or its IP address. | 1355 Third arg is name of the host to connect to, or its IP address. |
1367 Fourth arg SERVICE is name of the service desired, or an integer | 1356 Fourth arg SERVICE is name of the service desired, or an integer |
1368 specifying a port number to connect to. | 1357 specifying a port number to connect to. |
1369 */ ) | 1358 */ |
1370 (name, buffer, host, service) | 1359 (name, buffer, host, service)) |
1371 Lisp_Object name, buffer, host, service; | |
1372 { | 1360 { |
1373 /* !!#### This function has not been Mule-ized */ | 1361 /* !!#### This function has not been Mule-ized */ |
1374 /* This function can GC */ | 1362 /* This function can GC */ |
1375 Lisp_Object proc; | 1363 Lisp_Object proc; |
1376 struct sockaddr_in address; | 1364 struct sockaddr_in address; |
1526 return host; | 1514 return host; |
1527 #endif | 1515 #endif |
1528 } | 1516 } |
1529 | 1517 |
1530 | 1518 |
1531 DEFUN ("set-process-window-size", Fset_process_window_size, | 1519 DEFUN ("set-process-window-size", Fset_process_window_size, 3, 3, 0, /* |
1532 Sset_process_window_size, 3, 3, 0 /* | |
1533 Tell PROCESS that it has logical window size HEIGHT and WIDTH. | 1520 Tell PROCESS that it has logical window size HEIGHT and WIDTH. |
1534 */ ) | 1521 */ |
1535 (proc, height, width) | 1522 (proc, height, width)) |
1536 Lisp_Object proc, height, width; | |
1537 { | 1523 { |
1538 CHECK_PROCESS (proc); | 1524 CHECK_PROCESS (proc); |
1539 CHECK_NATNUM (height); | 1525 CHECK_NATNUM (height); |
1540 CHECK_NATNUM (width); | 1526 CHECK_NATNUM (width); |
1541 if (set_window_size (XPROCESS (proc)->infd, XINT (height), XINT (width)) | 1527 if (set_window_size (XPROCESS (proc)->infd, XINT (height), XINT (width)) |
1876 } | 1862 } |
1877 Lstream_flush (XLSTREAM (p->outstream)); | 1863 Lstream_flush (XLSTREAM (p->outstream)); |
1878 UNGCPRO; | 1864 UNGCPRO; |
1879 } | 1865 } |
1880 | 1866 |
1881 DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0 /* | 1867 DEFUN ("process-tty-name", Fprocess_tty_name, 1, 1, 0, /* |
1882 Return the name of the terminal PROCESS uses, or nil if none. | 1868 Return the name of the terminal PROCESS uses, or nil if none. |
1883 This is the terminal that the process itself reads and writes on, | 1869 This is the terminal that the process itself reads and writes on, |
1884 not the name of the pty that Emacs uses to talk with that terminal. | 1870 not the name of the pty that Emacs uses to talk with that terminal. |
1885 */ ) | 1871 */ |
1886 (proc) | 1872 (proc)) |
1887 Lisp_Object proc; | |
1888 { | 1873 { |
1889 CHECK_PROCESS (proc); | 1874 CHECK_PROCESS (proc); |
1890 return XPROCESS (proc)->tty_name; | 1875 return XPROCESS (proc)->tty_name; |
1891 } | 1876 } |
1892 | 1877 |
1893 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer, | 1878 DEFUN ("set-process-buffer", Fset_process_buffer, 2, 2, 0, /* |
1894 2, 2, 0 /* | |
1895 Set buffer associated with PROCESS to BUFFER (a buffer, or nil). | 1879 Set buffer associated with PROCESS to BUFFER (a buffer, or nil). |
1896 */ ) | 1880 */ |
1897 (proc, buffer) | 1881 (proc, buffer)) |
1898 Lisp_Object proc, buffer; | |
1899 { | 1882 { |
1900 CHECK_PROCESS (proc); | 1883 CHECK_PROCESS (proc); |
1901 if (!NILP (buffer)) | 1884 if (!NILP (buffer)) |
1902 CHECK_BUFFER (buffer); | 1885 CHECK_BUFFER (buffer); |
1903 XPROCESS (proc)->buffer = buffer; | 1886 XPROCESS (proc)->buffer = buffer; |
1904 return buffer; | 1887 return buffer; |
1905 } | 1888 } |
1906 | 1889 |
1907 DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer, | 1890 DEFUN ("process-buffer", Fprocess_buffer, 1, 1, 0, /* |
1908 1, 1, 0 /* | |
1909 Return the buffer PROCESS is associated with. | 1891 Return the buffer PROCESS is associated with. |
1910 Output from PROCESS is inserted in this buffer | 1892 Output from PROCESS is inserted in this buffer |
1911 unless PROCESS has a filter. | 1893 unless PROCESS has a filter. |
1912 */ ) | 1894 */ |
1913 (proc) | 1895 (proc)) |
1914 Lisp_Object proc; | |
1915 { | 1896 { |
1916 CHECK_PROCESS (proc); | 1897 CHECK_PROCESS (proc); |
1917 return XPROCESS (proc)->buffer; | 1898 return XPROCESS (proc)->buffer; |
1918 } | 1899 } |
1919 | 1900 |
1920 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, | 1901 DEFUN ("process-mark", Fprocess_mark, 1, 1, 0, /* |
1921 1, 1, 0 /* | |
1922 Return the marker for the end of the last output from PROCESS. | 1902 Return the marker for the end of the last output from PROCESS. |
1923 */ ) | 1903 */ |
1924 (proc) | 1904 (proc)) |
1925 Lisp_Object proc; | |
1926 { | 1905 { |
1927 CHECK_PROCESS (proc); | 1906 CHECK_PROCESS (proc); |
1928 #ifdef ENERGIZE | 1907 #ifdef ENERGIZE |
1929 if (EQ (proc, Venergize_process)) /* per buffer rather than per process */ | 1908 if (EQ (proc, Venergize_process)) /* per buffer rather than per process */ |
1930 return Fenergize_user_input_buffer_mark (Qnil); /* ## current_buffer ok? */ | 1909 return Fenergize_user_input_buffer_mark (Qnil); /* ## current_buffer ok? */ |
1944 | 1923 |
1945 XPROCESS (proc)->filter = filter; | 1924 XPROCESS (proc)->filter = filter; |
1946 XPROCESS (proc)->filter_does_read = filter_does_read; | 1925 XPROCESS (proc)->filter_does_read = filter_does_read; |
1947 } | 1926 } |
1948 | 1927 |
1949 DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, | 1928 DEFUN ("set-process-filter", Fset_process_filter, 2, 2, 0, /* |
1950 2, 2, 0 /* | |
1951 Give PROCESS the filter function FILTER; nil means no filter. | 1929 Give PROCESS the filter function FILTER; nil means no filter. |
1952 t means stop accepting output from the process. | 1930 t means stop accepting output from the process. |
1953 When a process has a filter, each time it does output | 1931 When a process has a filter, each time it does output |
1954 the entire string of output is passed to the filter. | 1932 the entire string of output is passed to the filter. |
1955 The filter gets two arguments: the process and the string of output. | 1933 The filter gets two arguments: the process and the string of output. |
1956 If the process has a filter, its buffer is not used for output. | 1934 If the process has a filter, its buffer is not used for output. |
1957 */ ) | 1935 */ |
1958 (proc, filter) | 1936 (proc, filter)) |
1959 Lisp_Object proc, filter; | |
1960 { | 1937 { |
1961 set_process_filter (proc, filter, 0); | 1938 set_process_filter (proc, filter, 0); |
1962 return filter; | 1939 return filter; |
1963 } | 1940 } |
1964 | 1941 |
1965 DEFUN ("process-filter", Fprocess_filter, Sprocess_filter, | 1942 DEFUN ("process-filter", Fprocess_filter, 1, 1, 0, /* |
1966 1, 1, 0 /* | |
1967 Return the filter function of PROCESS; nil if none. | 1943 Return the filter function of PROCESS; nil if none. |
1968 See `set-process-filter' for more info on filter functions. | 1944 See `set-process-filter' for more info on filter functions. |
1969 */ ) | 1945 */ |
1970 (proc) | 1946 (proc)) |
1971 Lisp_Object proc; | |
1972 { | 1947 { |
1973 CHECK_PROCESS (proc); | 1948 CHECK_PROCESS (proc); |
1974 return XPROCESS (proc)->filter; | 1949 return XPROCESS (proc)->filter; |
1975 } | 1950 } |
1976 | 1951 |
1977 DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, | 1952 DEFUN ("process-send-region", Fprocess_send_region, 3, 3, 0, /* |
1978 3, 3, 0 /* | |
1979 Send current contents of region as input to PROCESS. | 1953 Send current contents of region as input to PROCESS. |
1980 PROCESS may be a process name or an actual process. | 1954 PROCESS may be a process name or an actual process. |
1981 Called from program, takes three arguments, PROCESS, START and END. | 1955 Called from program, takes three arguments, PROCESS, START and END. |
1982 If the region is more than 500 or so characters long, | 1956 If the region is more than 500 or so characters long, |
1983 it is sent in several bunches. This may happen even for shorter regions. | 1957 it is sent in several bunches. This may happen even for shorter regions. |
1984 Output from processes can arrive in between bunches. | 1958 Output from processes can arrive in between bunches. |
1985 */ ) | 1959 */ |
1986 (process, start, end) | 1960 (process, start, end)) |
1987 Lisp_Object process, start, end; | |
1988 { | 1961 { |
1989 /* This function can GC */ | 1962 /* This function can GC */ |
1990 Lisp_Object proc = get_process (process); | 1963 Lisp_Object proc = get_process (process); |
1991 Bufpos st, en; | 1964 Bufpos st, en; |
1992 | 1965 |
1995 send_process (proc, Fcurrent_buffer (), 0, | 1968 send_process (proc, Fcurrent_buffer (), 0, |
1996 st, en - st); | 1969 st, en - st); |
1997 return (Qnil); | 1970 return (Qnil); |
1998 } | 1971 } |
1999 | 1972 |
2000 DEFUN ("process-send-string", Fprocess_send_string, Sprocess_send_string, | 1973 DEFUN ("process-send-string", Fprocess_send_string, 2, 4, 0, /* |
2001 2, 4, 0 /* | |
2002 Send PROCESS the contents of STRING as input. | 1974 Send PROCESS the contents of STRING as input. |
2003 PROCESS may be a process name or an actual process. | 1975 PROCESS may be a process name or an actual process. |
2004 Optional arguments FROM and TO specify part of STRING, see `substring'. | 1976 Optional arguments FROM and TO specify part of STRING, see `substring'. |
2005 If STRING is more than 500 or so characters long, | 1977 If STRING is more than 500 or so characters long, |
2006 it is sent in several bunches. This may happen even for shorter strings. | 1978 it is sent in several bunches. This may happen even for shorter strings. |
2007 Output from processes can arrive in between bunches. | 1979 Output from processes can arrive in between bunches. |
2008 */ ) | 1980 */ |
2009 (process, string, from, to) | 1981 (process, string, from, to)) |
2010 Lisp_Object process, string, from, to; | |
2011 { | 1982 { |
2012 /* This function can GC */ | 1983 /* This function can GC */ |
2013 Lisp_Object proc; | 1984 Lisp_Object proc; |
2014 Bytecount len; | 1985 Bytecount len; |
2015 Bytecount bfr, bto; | 1986 Bytecount bfr, bto; |
2068 running_asynch_code = 0; | 2039 running_asynch_code = 0; |
2069 restore_match_data (); | 2040 restore_match_data (); |
2070 unbind_to (speccount, Qnil); | 2041 unbind_to (speccount, Qnil); |
2071 } | 2042 } |
2072 | 2043 |
2073 DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel, | 2044 DEFUN ("set-process-sentinel", Fset_process_sentinel, 2, 2, 0, /* |
2074 2, 2, 0 /* | |
2075 Give PROCESS the sentinel SENTINEL; nil for none. | 2045 Give PROCESS the sentinel SENTINEL; nil for none. |
2076 The sentinel is called as a function when the process changes state. | 2046 The sentinel is called as a function when the process changes state. |
2077 It gets two arguments: the process, and a string describing the change. | 2047 It gets two arguments: the process, and a string describing the change. |
2078 */ ) | 2048 */ |
2079 (proc, sentinel) | 2049 (proc, sentinel)) |
2080 Lisp_Object proc, sentinel; | |
2081 { | 2050 { |
2082 CHECK_PROCESS (proc); | 2051 CHECK_PROCESS (proc); |
2083 XPROCESS (proc)->sentinel = sentinel; | 2052 XPROCESS (proc)->sentinel = sentinel; |
2084 return sentinel; | 2053 return sentinel; |
2085 } | 2054 } |
2086 | 2055 |
2087 DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel, | 2056 DEFUN ("process-sentinel", Fprocess_sentinel, 1, 1, 0, /* |
2088 1, 1, 0 /* | |
2089 Return the sentinel of PROCESS; nil if none. | 2057 Return the sentinel of PROCESS; nil if none. |
2090 See `set-process-sentinel' for more info on sentinels. | 2058 See `set-process-sentinel' for more info on sentinels. |
2091 */ ) | 2059 */ |
2092 (proc) | 2060 (proc)) |
2093 Lisp_Object proc; | |
2094 { | 2061 { |
2095 CHECK_PROCESS (proc); | 2062 CHECK_PROCESS (proc); |
2096 return XPROCESS (proc)->sentinel; | 2063 return XPROCESS (proc)->sentinel; |
2097 } | 2064 } |
2098 | 2065 |
2542 update_tick = temp_process_tick; | 2509 update_tick = temp_process_tick; |
2543 | 2510 |
2544 UNGCPRO; | 2511 UNGCPRO; |
2545 } | 2512 } |
2546 | 2513 |
2547 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0 /* | 2514 DEFUN ("process-status", Fprocess_status, 1, 1, 0, /* |
2548 Return the status of PROCESS. | 2515 Return the status of PROCESS. |
2549 This is a symbol, one of these: | 2516 This is a symbol, one of these: |
2550 | 2517 |
2551 run -- for a process that is running. | 2518 run -- for a process that is running. |
2552 stop -- for a process stopped but continuable. | 2519 stop -- for a process stopped but continuable. |
2555 open -- for a network stream connection that is open. | 2522 open -- for a network stream connection that is open. |
2556 closed -- for a network stream connection that is closed. | 2523 closed -- for a network stream connection that is closed. |
2557 nil -- if arg is a process name and no such process exists. | 2524 nil -- if arg is a process name and no such process exists. |
2558 PROCESS may be a process, a buffer, the name of a process or buffer, or | 2525 PROCESS may be a process, a buffer, the name of a process or buffer, or |
2559 nil, indicating the current buffer's process. | 2526 nil, indicating the current buffer's process. |
2560 */ ) | 2527 */ |
2561 (proc) | 2528 (proc)) |
2562 Lisp_Object proc; | |
2563 { | 2529 { |
2564 Lisp_Object status; | 2530 Lisp_Object status; |
2565 | 2531 |
2566 if (STRINGP (proc)) | 2532 if (STRINGP (proc)) |
2567 proc = Fget_process (proc); | 2533 proc = Fget_process (proc); |
2580 status = Qclosed; | 2546 status = Qclosed; |
2581 } | 2547 } |
2582 return (status); | 2548 return (status); |
2583 } | 2549 } |
2584 | 2550 |
2585 DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status, | 2551 DEFUN ("process-exit-status", Fprocess_exit_status, 1, 1, 0, /* |
2586 1, 1, 0 /* | |
2587 Return the exit status of PROCESS or the signal number that killed it. | 2552 Return the exit status of PROCESS or the signal number that killed it. |
2588 If PROCESS has not yet exited or died, return 0. | 2553 If PROCESS has not yet exited or died, return 0. |
2589 */ ) | 2554 */ |
2590 (proc) | 2555 (proc)) |
2591 Lisp_Object proc; | |
2592 { | 2556 { |
2593 CHECK_PROCESS (proc); | 2557 CHECK_PROCESS (proc); |
2594 return (make_int (XPROCESS (proc)->exit_code)); | 2558 return (make_int (XPROCESS (proc)->exit_code)); |
2595 } | 2559 } |
2596 | 2560 |
2803 #else /* ! defined (TIOCSIGSEND) */ | 2767 #else /* ! defined (TIOCSIGSEND) */ |
2804 EMACS_KILLPG (-gid, signo); | 2768 EMACS_KILLPG (-gid, signo); |
2805 #endif /* ! defined (TIOCSIGSEND) */ | 2769 #endif /* ! defined (TIOCSIGSEND) */ |
2806 } | 2770 } |
2807 | 2771 |
2808 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0 /* | 2772 DEFUN ("interrupt-process", Finterrupt_process, 0, 2, 0, /* |
2809 Interrupt process PROCESS. May be process or name of one. | 2773 Interrupt process PROCESS. May be process or name of one. |
2810 Nil or no arg means current buffer's process. | 2774 Nil or no arg means current buffer's process. |
2811 Second arg CURRENT-GROUP non-nil means send signal to | 2775 Second arg CURRENT-GROUP non-nil means send signal to |
2812 the current process-group of the process's controlling terminal | 2776 the current process-group of the process's controlling terminal |
2813 rather than to the process's own process group. | 2777 rather than to the process's own process group. |
2814 If the process is a shell, this means interrupt current subjob | 2778 If the process is a shell, this means interrupt current subjob |
2815 rather than the shell. | 2779 rather than the shell. |
2816 */ ) | 2780 */ |
2817 (process, current_group) | 2781 (process, current_group)) |
2818 Lisp_Object process, current_group; | |
2819 { | 2782 { |
2820 /* This function can GC */ | 2783 /* This function can GC */ |
2821 process_send_signal (process, SIGINT, !NILP (current_group), 0); | 2784 process_send_signal (process, SIGINT, !NILP (current_group), 0); |
2822 return process; | 2785 return process; |
2823 } | 2786 } |
2824 | 2787 |
2825 DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0 /* | 2788 DEFUN ("kill-process", Fkill_process, 0, 2, 0, /* |
2826 Kill process PROCESS. May be process or name of one. | 2789 Kill process PROCESS. May be process or name of one. |
2827 See function `interrupt-process' for more details on usage. | 2790 See function `interrupt-process' for more details on usage. |
2828 */ ) | 2791 */ |
2829 (process, current_group) | 2792 (process, current_group)) |
2830 Lisp_Object process, current_group; | |
2831 { | 2793 { |
2832 /* This function can GC */ | 2794 /* This function can GC */ |
2833 process_send_signal (process, SIGKILL, !NILP (current_group), | 2795 process_send_signal (process, SIGKILL, !NILP (current_group), |
2834 0); | 2796 0); |
2835 return process; | 2797 return process; |
2836 } | 2798 } |
2837 | 2799 |
2838 DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0 /* | 2800 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /* |
2839 Send QUIT signal to process PROCESS. May be process or name of one. | 2801 Send QUIT signal to process PROCESS. May be process or name of one. |
2840 See function `interrupt-process' for more details on usage. | 2802 See function `interrupt-process' for more details on usage. |
2841 */ ) | 2803 */ |
2842 (process, current_group) | 2804 (process, current_group)) |
2843 Lisp_Object process, current_group; | |
2844 { | 2805 { |
2845 /* This function can GC */ | 2806 /* This function can GC */ |
2846 process_send_signal (process, SIGQUIT, !NILP (current_group), | 2807 process_send_signal (process, SIGQUIT, !NILP (current_group), |
2847 0); | 2808 0); |
2848 return process; | 2809 return process; |
2849 } | 2810 } |
2850 | 2811 |
2851 DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0 /* | 2812 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /* |
2852 Stop process PROCESS. May be process or name of one. | 2813 Stop process PROCESS. May be process or name of one. |
2853 See function `interrupt-process' for more details on usage. | 2814 See function `interrupt-process' for more details on usage. |
2854 */ ) | 2815 */ |
2855 (process, current_group) | 2816 (process, current_group)) |
2856 Lisp_Object process, current_group; | |
2857 { | 2817 { |
2858 /* This function can GC */ | 2818 /* This function can GC */ |
2859 #ifndef SIGTSTP | 2819 #ifndef SIGTSTP |
2860 error ("no SIGTSTP support"); | 2820 error ("no SIGTSTP support"); |
2861 #else | 2821 #else |
2863 0); | 2823 0); |
2864 #endif | 2824 #endif |
2865 return process; | 2825 return process; |
2866 } | 2826 } |
2867 | 2827 |
2868 DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0 /* | 2828 DEFUN ("continue-process", Fcontinue_process, 0, 2, 0, /* |
2869 Continue process PROCESS. May be process or name of one. | 2829 Continue process PROCESS. May be process or name of one. |
2870 See function `interrupt-process' for more details on usage. | 2830 See function `interrupt-process' for more details on usage. |
2871 */ ) | 2831 */ |
2872 (process, current_group) | 2832 (process, current_group)) |
2873 Lisp_Object process, current_group; | |
2874 { | 2833 { |
2875 /* This function can GC */ | 2834 /* This function can GC */ |
2876 #ifdef SIGCONT | 2835 #ifdef SIGCONT |
2877 process_send_signal (process, SIGCONT, !NILP (current_group), | 2836 process_send_signal (process, SIGCONT, !NILP (current_group), |
2878 0); | 2837 0); |
2880 error ("no SIGCONT support"); | 2839 error ("no SIGCONT support"); |
2881 #endif | 2840 #endif |
2882 return process; | 2841 return process; |
2883 } | 2842 } |
2884 | 2843 |
2885 DEFUN ("signal-process", Fsignal_process, Ssignal_process, | 2844 DEFUN ("signal-process", Fsignal_process, 2, 2, |
2886 2, 2, "nProcess number: \nnSignal code: " /* | 2845 "nProcess number: \nnSignal code: ", /* |
2887 Send the process with process id PID the signal with code SIGCODE. | 2846 Send the process with process id PID the signal with code SIGCODE. |
2888 PID must be an integer. The process need not be a child of this Emacs. | 2847 PID must be an integer. The process need not be a child of this Emacs. |
2889 SIGCODE may be an integer, or a symbol whose name is a signal name. | 2848 SIGCODE may be an integer, or a symbol whose name is a signal name. |
2890 */ ) | 2849 */ |
2891 (pid, sigcode) | 2850 (pid, sigcode)) |
2892 Lisp_Object pid, sigcode; | |
2893 { | 2851 { |
2894 CHECK_INT (pid); | 2852 CHECK_INT (pid); |
2895 | 2853 |
2896 #define handle_signal(NAME, VALUE) \ | 2854 #define handle_signal(NAME, VALUE) \ |
2897 else if (!strcmp ((CONST char *) name, NAME)) \ | 2855 else if (!strcmp ((CONST char *) name, NAME)) \ |
3010 #else | 2968 #else |
3011 return make_int (kill (XINT (pid), XINT (sigcode))); | 2969 return make_int (kill (XINT (pid), XINT (sigcode))); |
3012 #endif | 2970 #endif |
3013 } | 2971 } |
3014 | 2972 |
3015 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0 /* | 2973 DEFUN ("process-send-eof", Fprocess_send_eof, 0, 1, 0, /* |
3016 Make PROCESS see end-of-file in its input. | 2974 Make PROCESS see end-of-file in its input. |
3017 PROCESS may be a process, a buffer, the name of a process or buffer, or | 2975 PROCESS may be a process, a buffer, the name of a process or buffer, or |
3018 nil, indicating the current buffer's process. | 2976 nil, indicating the current buffer's process. |
3019 If PROCESS is a network connection, or is a process communicating | 2977 If PROCESS is a network connection, or is a process communicating |
3020 through a pipe (as opposed to a pty), then you cannot send any more | 2978 through a pipe (as opposed to a pty), then you cannot send any more |
3021 text to PROCESS after you call this function. | 2979 text to PROCESS after you call this function. |
3022 */ ) | 2980 */ |
3023 (process) | 2981 (process)) |
3024 Lisp_Object process; | |
3025 { | 2982 { |
3026 /* This function can GC */ | 2983 /* This function can GC */ |
3027 Lisp_Object proc; | 2984 Lisp_Object proc; |
3028 | 2985 |
3029 proc = get_process (process); | 2986 proc = get_process (process); |
3120 Fset_marker (XPROCESS (proc)->mark, Qnil, Qnil); | 3077 Fset_marker (XPROCESS (proc)->mark, Qnil, Qnil); |
3121 | 3078 |
3122 deactivate_process (proc); | 3079 deactivate_process (proc); |
3123 } | 3080 } |
3124 | 3081 |
3125 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0 /* | 3082 DEFUN ("delete-process", Fdelete_process, 1, 1, 0, /* |
3126 Delete PROCESS: kill it and forget about it immediately. | 3083 Delete PROCESS: kill it and forget about it immediately. |
3127 PROCESS may be a process or the name of one, or a buffer name. | 3084 PROCESS may be a process or the name of one, or a buffer name. |
3128 */ ) | 3085 */ |
3129 (proc) | 3086 (proc)) |
3130 Lisp_Object proc; | |
3131 { | 3087 { |
3132 /* This function can GC */ | 3088 /* This function can GC */ |
3133 struct Lisp_Process *p; | 3089 struct Lisp_Process *p; |
3134 proc = get_process (proc); | 3090 proc = get_process (proc); |
3135 p = XPROCESS (proc); | 3091 p = XPROCESS (proc); |
3195 | 3151 |
3196 return count; | 3152 return count; |
3197 } | 3153 } |
3198 #endif /* Unused */ | 3154 #endif /* Unused */ |
3199 | 3155 |
3200 DEFUN ("process-kill-without-query", Fprocess_kill_without_query, | 3156 DEFUN ("process-kill-without-query", Fprocess_kill_without_query, 1, 2, 0, /* |
3201 Sprocess_kill_without_query, 1, 2, 0 /* | |
3202 Say no query needed if PROCESS is running when Emacs is exited. | 3157 Say no query needed if PROCESS is running when Emacs is exited. |
3203 Optional second argument if non-nil says to require a query. | 3158 Optional second argument if non-nil says to require a query. |
3204 Value is t if a query was formerly required. | 3159 Value is t if a query was formerly required. |
3205 */ ) | 3160 */ |
3206 (proc, require_query_p) | 3161 (proc, require_query_p)) |
3207 Lisp_Object proc, require_query_p; | |
3208 { | 3162 { |
3209 int tem; | 3163 int tem; |
3210 | 3164 |
3211 CHECK_PROCESS (proc); | 3165 CHECK_PROCESS (proc); |
3212 tem = XPROCESS (proc)->kill_without_query; | 3166 tem = XPROCESS (proc)->kill_without_query; |
3213 XPROCESS (proc)->kill_without_query = NILP (require_query_p); | 3167 XPROCESS (proc)->kill_without_query = NILP (require_query_p); |
3214 | 3168 |
3215 return (tem ? Qnil : Qt); | 3169 return (tem ? Qnil : Qt); |
3216 } | 3170 } |
3217 | 3171 |
3218 DEFUN ("process-kill-without-query-p", Fprocess_kill_without_query_p, | 3172 DEFUN ("process-kill-without-query-p", Fprocess_kill_without_query_p, 1, 1, 0, /* |
3219 Sprocess_kill_without_query_p, 1, 1, 0 /* | |
3220 Whether PROC will be killed without query if running when emacs is exited. | 3173 Whether PROC will be killed without query if running when emacs is exited. |
3221 */ ) | 3174 */ |
3222 (proc) | 3175 (proc)) |
3223 Lisp_Object proc; | |
3224 { | 3176 { |
3225 CHECK_PROCESS (proc); | 3177 CHECK_PROCESS (proc); |
3226 return (XPROCESS (proc)->kill_without_query ? Qt : Qnil); | 3178 return (XPROCESS (proc)->kill_without_query ? Qt : Qnil); |
3227 } | 3179 } |
3228 | 3180 |
3273 * defsymbol (&Qexit, "exit"); | 3225 * defsymbol (&Qexit, "exit"); |
3274 */ | 3226 */ |
3275 defsymbol (&Qopen, "open"); | 3227 defsymbol (&Qopen, "open"); |
3276 defsymbol (&Qclosed, "closed"); | 3228 defsymbol (&Qclosed, "closed"); |
3277 | 3229 |
3278 defsubr (&Sprocessp); | 3230 DEFSUBR (Fprocessp); |
3279 defsubr (&Sget_process); | 3231 DEFSUBR (Fget_process); |
3280 defsubr (&Sget_buffer_process); | 3232 DEFSUBR (Fget_buffer_process); |
3281 defsubr (&Sdelete_process); | 3233 DEFSUBR (Fdelete_process); |
3282 defsubr (&Sprocess_status); | 3234 DEFSUBR (Fprocess_status); |
3283 defsubr (&Sprocess_exit_status); | 3235 DEFSUBR (Fprocess_exit_status); |
3284 defsubr (&Sprocess_id); | 3236 DEFSUBR (Fprocess_id); |
3285 defsubr (&Sprocess_name); | 3237 DEFSUBR (Fprocess_name); |
3286 defsubr (&Sprocess_tty_name); | 3238 DEFSUBR (Fprocess_tty_name); |
3287 defsubr (&Sprocess_command); | 3239 DEFSUBR (Fprocess_command); |
3288 defsubr (&Sset_process_buffer); | 3240 DEFSUBR (Fset_process_buffer); |
3289 defsubr (&Sprocess_buffer); | 3241 DEFSUBR (Fprocess_buffer); |
3290 defsubr (&Sprocess_mark); | 3242 DEFSUBR (Fprocess_mark); |
3291 defsubr (&Sset_process_filter); | 3243 DEFSUBR (Fset_process_filter); |
3292 defsubr (&Sprocess_filter); | 3244 DEFSUBR (Fprocess_filter); |
3293 defsubr (&Sset_process_window_size); | 3245 DEFSUBR (Fset_process_window_size); |
3294 defsubr (&Sset_process_sentinel); | 3246 DEFSUBR (Fset_process_sentinel); |
3295 defsubr (&Sprocess_sentinel); | 3247 DEFSUBR (Fprocess_sentinel); |
3296 defsubr (&Sprocess_kill_without_query); | 3248 DEFSUBR (Fprocess_kill_without_query); |
3297 defsubr (&Sprocess_kill_without_query_p); | 3249 DEFSUBR (Fprocess_kill_without_query_p); |
3298 defsubr (&Sprocess_list); | 3250 DEFSUBR (Fprocess_list); |
3299 defsubr (&Sstart_process_internal); | 3251 DEFSUBR (Fstart_process_internal); |
3300 #ifdef HAVE_SOCKETS | 3252 #ifdef HAVE_SOCKETS |
3301 defsubr (&Sopen_network_stream_internal); | 3253 DEFSUBR (Fopen_network_stream_internal); |
3302 #endif /* HAVE_SOCKETS */ | 3254 #endif /* HAVE_SOCKETS */ |
3303 defsubr (&Sprocess_send_region); | 3255 DEFSUBR (Fprocess_send_region); |
3304 defsubr (&Sprocess_send_string); | 3256 DEFSUBR (Fprocess_send_string); |
3305 defsubr (&Sinterrupt_process); | 3257 DEFSUBR (Finterrupt_process); |
3306 defsubr (&Skill_process); | 3258 DEFSUBR (Fkill_process); |
3307 defsubr (&Squit_process); | 3259 DEFSUBR (Fquit_process); |
3308 defsubr (&Sstop_process); | 3260 DEFSUBR (Fstop_process); |
3309 defsubr (&Scontinue_process); | 3261 DEFSUBR (Fcontinue_process); |
3310 defsubr (&Sprocess_send_eof); | 3262 DEFSUBR (Fprocess_send_eof); |
3311 defsubr (&Ssignal_process); | 3263 DEFSUBR (Fsignal_process); |
3312 /* defsubr (&Sprocess_connection); */ | 3264 /* DEFSUBR (Fprocess_connection); */ |
3313 } | 3265 } |
3314 | 3266 |
3315 void | 3267 void |
3316 vars_of_process (void) | 3268 vars_of_process (void) |
3317 { | 3269 { |