comparison src/process.c @ 14085:85ce7bab31dc

(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status, Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command, Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark, Fset_process_filter, Fprocess_filter, Fset_process_sentinel, Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query, Faccept_process_output): Harmonize arguments with documentation.
author Erik Naggum <erik@naggum.no>
date Tue, 09 Jan 1996 00:33:39 +0000
parents 621a575db6f7
children 7717b68abd2e
comparison
equal deleted inserted replaced
14084:8765a56417ac 14085:85ce7bab31dc
507 deactivate_process (proc); 507 deactivate_process (proc);
508 } 508 }
509 509
510 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, 510 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
511 "Return t if OBJECT is a process.") 511 "Return t if OBJECT is a process.")
512 (obj) 512 (object)
513 Lisp_Object obj; 513 Lisp_Object object;
514 { 514 {
515 return PROCESSP (obj) ? Qt : Qnil; 515 return PROCESSP (object) ? Qt : Qnil;
516 } 516 }
517 517
518 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, 518 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
519 "Return the process named NAME, or nil if there is none.") 519 "Return the process named NAME, or nil if there is none.")
520 (name) 520 (name)
527 } 527 }
528 528
529 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, 529 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
530 "Return the (or, a) process associated with BUFFER.\n\ 530 "Return the (or, a) process associated with BUFFER.\n\
531 BUFFER may be a buffer or the name of one.") 531 BUFFER may be a buffer or the name of one.")
532 (name) 532 (buffer)
533 register Lisp_Object name; 533 register Lisp_Object buffer;
534 { 534 {
535 register Lisp_Object buf, tail, proc; 535 register Lisp_Object buf, tail, proc;
536 536
537 if (NILP (name)) return Qnil; 537 if (NILP (buffer)) return Qnil;
538 buf = Fget_buffer (name); 538 buf = Fget_buffer (buffer);
539 if (NILP (buf)) return Qnil; 539 if (NILP (buf)) return Qnil;
540 540
541 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) 541 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
542 { 542 {
543 proc = Fcdr (Fcar (tail)); 543 proc = Fcdr (Fcar (tail));
588 588
589 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, 589 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
590 "Delete PROCESS: kill it and forget about it immediately.\n\ 590 "Delete PROCESS: kill it and forget about it immediately.\n\
591 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 591 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\
592 nil, indicating the current buffer's process.") 592 nil, indicating the current buffer's process.")
593 (proc) 593 (process)
594 register Lisp_Object proc; 594 register Lisp_Object process;
595 { 595 {
596 proc = get_process (proc); 596 process = get_process (process);
597 XPROCESS (proc)->raw_status_low = Qnil; 597 XPROCESS (process)->raw_status_low = Qnil;
598 XPROCESS (proc)->raw_status_high = Qnil; 598 XPROCESS (process)->raw_status_high = Qnil;
599 if (NETCONN_P (proc)) 599 if (NETCONN_P (process))
600 { 600 {
601 XPROCESS (proc)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 601 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
602 XSETINT (XPROCESS (proc)->tick, ++process_tick); 602 XSETINT (XPROCESS (process)->tick, ++process_tick);
603 } 603 }
604 else if (XINT (XPROCESS (proc)->infd) >= 0) 604 else if (XINT (XPROCESS (process)->infd) >= 0)
605 { 605 {
606 Fkill_process (proc, Qnil); 606 Fkill_process (process, Qnil);
607 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 607 /* Do this now, since remove_process will make sigchld_handler do nothing. */
608 XPROCESS (proc)->status 608 XPROCESS (process)->status
609 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); 609 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
610 XSETINT (XPROCESS (proc)->tick, ++process_tick); 610 XSETINT (XPROCESS (process)->tick, ++process_tick);
611 status_notify (); 611 status_notify ();
612 } 612 }
613 remove_process (proc); 613 remove_process (process);
614 return Qnil; 614 return Qnil;
615 } 615 }
616 616
617 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0, 617 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0,
618 "Return the status of PROCESS: a symbol, one of these:\n\ 618 "Return the status of PROCESS: a symbol, one of these:\n\
623 open -- for a network stream connection that is open.\n\ 623 open -- for a network stream connection that is open.\n\
624 closed -- for a network stream connection that is closed.\n\ 624 closed -- for a network stream connection that is closed.\n\
625 nil -- if arg is a process name and no such process exists.\n\ 625 nil -- if arg is a process name and no such process exists.\n\
626 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 626 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\
627 nil, indicating the current buffer's process.") 627 nil, indicating the current buffer's process.")
628 (proc) 628 (process)
629 register Lisp_Object proc; 629 register Lisp_Object process;
630 { 630 {
631 register struct Lisp_Process *p; 631 register struct Lisp_Process *p;
632 register Lisp_Object status; 632 register Lisp_Object status;
633 633
634 if (STRINGP (proc)) 634 if (STRINGP (process))
635 proc = Fget_process (proc); 635 process = Fget_process (process);
636 else 636 else
637 proc = get_process (proc); 637 process = get_process (process);
638 638
639 if (NILP (proc)) 639 if (NILP (process))
640 return proc; 640 return process;
641 641
642 p = XPROCESS (proc); 642 p = XPROCESS (process);
643 if (!NILP (p->raw_status_low)) 643 if (!NILP (p->raw_status_low))
644 update_status (p); 644 update_status (p);
645 status = p->status; 645 status = p->status;
646 if (CONSP (status)) 646 if (CONSP (status))
647 status = XCONS (status)->car; 647 status = XCONS (status)->car;
648 if (NETCONN_P (proc)) 648 if (NETCONN_P (process))
649 { 649 {
650 if (EQ (status, Qrun)) 650 if (EQ (status, Qrun))
651 status = Qopen; 651 status = Qopen;
652 else if (EQ (status, Qexit)) 652 else if (EQ (status, Qexit))
653 status = Qclosed; 653 status = Qclosed;
657 657
658 DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status, 658 DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status,
659 1, 1, 0, 659 1, 1, 0,
660 "Return the exit status of PROCESS or the signal number that killed it.\n\ 660 "Return the exit status of PROCESS or the signal number that killed it.\n\
661 If PROCESS has not yet exited or died, return 0.") 661 If PROCESS has not yet exited or died, return 0.")
662 (proc) 662 (process)
663 register Lisp_Object proc; 663 register Lisp_Object process;
664 { 664 {
665 CHECK_PROCESS (proc, 0); 665 CHECK_PROCESS (process, 0);
666 if (!NILP (XPROCESS (proc)->raw_status_low)) 666 if (!NILP (XPROCESS (process)->raw_status_low))
667 update_status (XPROCESS (proc)); 667 update_status (XPROCESS (process));
668 if (CONSP (XPROCESS (proc)->status)) 668 if (CONSP (XPROCESS (process)->status))
669 return XCONS (XCONS (XPROCESS (proc)->status)->cdr)->car; 669 return XCONS (XCONS (XPROCESS (process)->status)->cdr)->car;
670 return make_number (0); 670 return make_number (0);
671 } 671 }
672 672
673 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, 673 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
674 "Return the process id of PROCESS.\n\ 674 "Return the process id of PROCESS.\n\
675 This is the pid of the Unix process which PROCESS uses or talks to.\n\ 675 This is the pid of the Unix process which PROCESS uses or talks to.\n\
676 For a network connection, this value is nil.") 676 For a network connection, this value is nil.")
677 (proc) 677 (process)
678 register Lisp_Object proc; 678 register Lisp_Object process;
679 { 679 {
680 CHECK_PROCESS (proc, 0); 680 CHECK_PROCESS (process, 0);
681 return XPROCESS (proc)->pid; 681 return XPROCESS (process)->pid;
682 } 682 }
683 683
684 DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0, 684 DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
685 "Return the name of PROCESS, as a string.\n\ 685 "Return the name of PROCESS, as a string.\n\
686 This is the name of the program invoked in PROCESS,\n\ 686 This is the name of the program invoked in PROCESS,\n\
687 possibly modified to make it unique among process names.") 687 possibly modified to make it unique among process names.")
688 (proc) 688 (process)
689 register Lisp_Object proc; 689 register Lisp_Object process;
690 { 690 {
691 CHECK_PROCESS (proc, 0); 691 CHECK_PROCESS (process, 0);
692 return XPROCESS (proc)->name; 692 return XPROCESS (process)->name;
693 } 693 }
694 694
695 DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0, 695 DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
696 "Return the command that was executed to start PROCESS.\n\ 696 "Return the command that was executed to start PROCESS.\n\
697 This is a list of strings, the first string being the program executed\n\ 697 This is a list of strings, the first string being the program executed\n\
698 and the rest of the strings being the arguments given to it.\n\ 698 and the rest of the strings being the arguments given to it.\n\
699 For a non-child channel, this is nil.") 699 For a non-child channel, this is nil.")
700 (proc) 700 (process)
701 register Lisp_Object proc; 701 register Lisp_Object process;
702 { 702 {
703 CHECK_PROCESS (proc, 0); 703 CHECK_PROCESS (process, 0);
704 return XPROCESS (proc)->command; 704 return XPROCESS (process)->command;
705 } 705 }
706 706
707 DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0, 707 DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
708 "Return the name of the terminal PROCESS uses, or nil if none.\n\ 708 "Return the name of the terminal PROCESS uses, or nil if none.\n\
709 This is the terminal that the process itself reads and writes on,\n\ 709 This is the terminal that the process itself reads and writes on,\n\
710 not the name of the pty that Emacs uses to talk with that terminal.") 710 not the name of the pty that Emacs uses to talk with that terminal.")
711 (proc) 711 (process)
712 register Lisp_Object proc; 712 register Lisp_Object process;
713 { 713 {
714 CHECK_PROCESS (proc, 0); 714 CHECK_PROCESS (process, 0);
715 return XPROCESS (proc)->tty_name; 715 return XPROCESS (process)->tty_name;
716 } 716 }
717 717
718 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer, 718 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
719 2, 2, 0, 719 2, 2, 0,
720 "Set buffer associated with PROCESS to BUFFER (a buffer, or nil).") 720 "Set buffer associated with PROCESS to BUFFER (a buffer, or nil).")
721 (proc, buffer) 721 (process, buffer)
722 register Lisp_Object proc, buffer; 722 register Lisp_Object process, buffer;
723 { 723 {
724 CHECK_PROCESS (proc, 0); 724 CHECK_PROCESS (process, 0);
725 if (!NILP (buffer)) 725 if (!NILP (buffer))
726 CHECK_BUFFER (buffer, 1); 726 CHECK_BUFFER (buffer, 1);
727 XPROCESS (proc)->buffer = buffer; 727 XPROCESS (process)->buffer = buffer;
728 return buffer; 728 return buffer;
729 } 729 }
730 730
731 DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer, 731 DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer,
732 1, 1, 0, 732 1, 1, 0,
733 "Return the buffer PROCESS is associated with.\n\ 733 "Return the buffer PROCESS is associated with.\n\
734 Output from PROCESS is inserted in this buffer\n\ 734 Output from PROCESS is inserted in this buffer\n\
735 unless PROCESS has a filter.") 735 unless PROCESS has a filter.")
736 (proc) 736 (process)
737 register Lisp_Object proc; 737 register Lisp_Object process;
738 { 738 {
739 CHECK_PROCESS (proc, 0); 739 CHECK_PROCESS (process, 0);
740 return XPROCESS (proc)->buffer; 740 return XPROCESS (process)->buffer;
741 } 741 }
742 742
743 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, 743 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
744 1, 1, 0, 744 1, 1, 0,
745 "Return the marker for the end of the last output from PROCESS.") 745 "Return the marker for the end of the last output from PROCESS.")
746 (proc) 746 (process)
747 register Lisp_Object proc; 747 register Lisp_Object process;
748 { 748 {
749 CHECK_PROCESS (proc, 0); 749 CHECK_PROCESS (process, 0);
750 return XPROCESS (proc)->mark; 750 return XPROCESS (process)->mark;
751 } 751 }
752 752
753 DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, 753 DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
754 2, 2, 0, 754 2, 2, 0,
755 "Give PROCESS the filter function FILTER; nil means no filter.\n\ 755 "Give PROCESS the filter function FILTER; nil means no filter.\n\
756 t means stop accepting output from the process.\n\ 756 t means stop accepting output from the process.\n\
757 When a process has a filter, each time it does output\n\ 757 When a process has a filter, each time it does output\n\
758 the entire string of output is passed to the filter.\n\ 758 the entire string of output is passed to the filter.\n\
759 The filter gets two arguments: the process and the string of output.\n\ 759 The filter gets two arguments: the process and the string of output.\n\
760 If the process has a filter, its buffer is not used for output.") 760 If the process has a filter, its buffer is not used for output.")
761 (proc, filter) 761 (process, filter)
762 register Lisp_Object proc, filter; 762 register Lisp_Object process, filter;
763 { 763 {
764 CHECK_PROCESS (proc, 0); 764 CHECK_PROCESS (process, 0);
765 if (EQ (filter, Qt)) 765 if (EQ (filter, Qt))
766 { 766 {
767 FD_CLR (XINT (XPROCESS (proc)->infd), &input_wait_mask); 767 FD_CLR (XINT (XPROCESS (process)->infd), &input_wait_mask);
768 FD_CLR (XINT (XPROCESS (proc)->infd), &non_keyboard_wait_mask); 768 FD_CLR (XINT (XPROCESS (process)->infd), &non_keyboard_wait_mask);
769 } 769 }
770 else if (EQ (XPROCESS (proc)->filter, Qt)) 770 else if (EQ (XPROCESS (process)->filter, Qt))
771 { 771 {
772 FD_SET (XINT (XPROCESS (proc)->infd), &input_wait_mask); 772 FD_SET (XINT (XPROCESS (process)->infd), &input_wait_mask);
773 FD_SET (XINT (XPROCESS (proc)->infd), &non_keyboard_wait_mask); 773 FD_SET (XINT (XPROCESS (process)->infd), &non_keyboard_wait_mask);
774 } 774 }
775 XPROCESS (proc)->filter = filter; 775 XPROCESS (process)->filter = filter;
776 return filter; 776 return filter;
777 } 777 }
778 778
779 DEFUN ("process-filter", Fprocess_filter, Sprocess_filter, 779 DEFUN ("process-filter", Fprocess_filter, Sprocess_filter,
780 1, 1, 0, 780 1, 1, 0,
781 "Returns the filter function of PROCESS; nil if none.\n\ 781 "Returns the filter function of PROCESS; nil if none.\n\
782 See `set-process-filter' for more info on filter functions.") 782 See `set-process-filter' for more info on filter functions.")
783 (proc) 783 (process)
784 register Lisp_Object proc; 784 register Lisp_Object process;
785 { 785 {
786 CHECK_PROCESS (proc, 0); 786 CHECK_PROCESS (process, 0);
787 return XPROCESS (proc)->filter; 787 return XPROCESS (process)->filter;
788 } 788 }
789 789
790 DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel, 790 DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel,
791 2, 2, 0, 791 2, 2, 0,
792 "Give PROCESS the sentinel SENTINEL; nil for none.\n\ 792 "Give PROCESS the sentinel SENTINEL; nil for none.\n\
793 The sentinel is called as a function when the process changes state.\n\ 793 The sentinel is called as a function when the process changes state.\n\
794 It gets two arguments: the process, and a string describing the change.") 794 It gets two arguments: the process, and a string describing the change.")
795 (proc, sentinel) 795 (process, sentinel)
796 register Lisp_Object proc, sentinel; 796 register Lisp_Object process, sentinel;
797 { 797 {
798 CHECK_PROCESS (proc, 0); 798 CHECK_PROCESS (process, 0);
799 XPROCESS (proc)->sentinel = sentinel; 799 XPROCESS (process)->sentinel = sentinel;
800 return sentinel; 800 return sentinel;
801 } 801 }
802 802
803 DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel, 803 DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel,
804 1, 1, 0, 804 1, 1, 0,
805 "Return the sentinel of PROCESS; nil if none.\n\ 805 "Return the sentinel of PROCESS; nil if none.\n\
806 See `set-process-sentinel' for more info on sentinels.") 806 See `set-process-sentinel' for more info on sentinels.")
807 (proc) 807 (process)
808 register Lisp_Object proc; 808 register Lisp_Object process;
809 { 809 {
810 CHECK_PROCESS (proc, 0); 810 CHECK_PROCESS (process, 0);
811 return XPROCESS (proc)->sentinel; 811 return XPROCESS (process)->sentinel;
812 } 812 }
813 813
814 DEFUN ("set-process-window-size", Fset_process_window_size, 814 DEFUN ("set-process-window-size", Fset_process_window_size,
815 Sset_process_window_size, 3, 3, 0, 815 Sset_process_window_size, 3, 3, 0,
816 "Tell PROCESS that it has logical window size HEIGHT and WIDTH.") 816 "Tell PROCESS that it has logical window size HEIGHT and WIDTH.")
817 (proc, height, width) 817 (process, height, width)
818 register Lisp_Object proc, height, width; 818 register Lisp_Object process, height, width;
819 { 819 {
820 CHECK_PROCESS (proc, 0); 820 CHECK_PROCESS (process, 0);
821 CHECK_NATNUM (height, 0); 821 CHECK_NATNUM (height, 0);
822 CHECK_NATNUM (width, 0); 822 CHECK_NATNUM (width, 0);
823 if (set_window_size (XINT (XPROCESS (proc)->infd), 823 if (set_window_size (XINT (XPROCESS (process)->infd),
824 XINT (height), XINT(width)) <= 0) 824 XINT (height), XINT(width)) <= 0)
825 return Qnil; 825 return Qnil;
826 else 826 else
827 return Qt; 827 return Qt;
828 } 828 }
830 DEFUN ("process-kill-without-query", Fprocess_kill_without_query, 830 DEFUN ("process-kill-without-query", Fprocess_kill_without_query,
831 Sprocess_kill_without_query, 1, 2, 0, 831 Sprocess_kill_without_query, 1, 2, 0,
832 "Say no query needed if PROCESS is running when Emacs is exited.\n\ 832 "Say no query needed if PROCESS is running when Emacs is exited.\n\
833 Optional second argument if non-nil says to require a query.\n\ 833 Optional second argument if non-nil says to require a query.\n\
834 Value is t if a query was formerly required.") 834 Value is t if a query was formerly required.")
835 (proc, value) 835 (process, value)
836 register Lisp_Object proc, value; 836 register Lisp_Object process, value;
837 { 837 {
838 Lisp_Object tem; 838 Lisp_Object tem;
839 839
840 CHECK_PROCESS (proc, 0); 840 CHECK_PROCESS (process, 0);
841 tem = XPROCESS (proc)->kill_without_query; 841 tem = XPROCESS (process)->kill_without_query;
842 XPROCESS (proc)->kill_without_query = Fnull (value); 842 XPROCESS (process)->kill_without_query = Fnull (value);
843 843
844 return Fnull (tem); 844 return Fnull (tem);
845 } 845 }
846 846
847 #if 0 /* Turned off because we don't currently record this info 847 #if 0 /* Turned off because we don't currently record this info
1864 from PROCESS.\n\ 1864 from PROCESS.\n\
1865 Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of\n\ 1865 Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of\n\
1866 seconds and microseconds to wait; return after that much time whether\n\ 1866 seconds and microseconds to wait; return after that much time whether\n\
1867 or not there is input.\n\ 1867 or not there is input.\n\
1868 Return non-nil iff we received any output before the timeout expired.") 1868 Return non-nil iff we received any output before the timeout expired.")
1869 (proc, timeout, timeout_msecs) 1869 (process, timeout, timeout_msecs)
1870 register Lisp_Object proc, timeout, timeout_msecs; 1870 register Lisp_Object process, timeout, timeout_msecs;
1871 { 1871 {
1872 int seconds; 1872 int seconds;
1873 int useconds; 1873 int useconds;
1874 1874
1875 if (! NILP (timeout_msecs)) 1875 if (! NILP (timeout_msecs))
1905 if (seconds <= 0) 1905 if (seconds <= 0)
1906 seconds = -1; 1906 seconds = -1;
1907 } 1907 }
1908 else 1908 else
1909 { 1909 {
1910 if (NILP (proc)) 1910 if (NILP (process))
1911 seconds = -1; 1911 seconds = -1;
1912 else 1912 else
1913 seconds = 0; 1913 seconds = 0;
1914 } 1914 }
1915 1915
1916 if (NILP (proc)) 1916 if (NILP (process))
1917 XSETFASTINT (proc, 0); 1917 XSETFASTINT (process, 0);
1918 1918
1919 return 1919 return
1920 (wait_reading_process_input (seconds, useconds, proc, 0) 1920 (wait_reading_process_input (seconds, useconds, process, 0)
1921 ? Qt : Qnil); 1921 ? Qt : Qnil);
1922 } 1922 }
1923 1923
1924 /* This variable is different from waiting_for_input in keyboard.c. 1924 /* This variable is different from waiting_for_input in keyboard.c.
1925 It is used to communicate to a lisp process-filter/sentinel (via the 1925 It is used to communicate to a lisp process-filter/sentinel (via the