comparison src/process.c @ 40103:6b389fb978bc

Change doc-string comments to `new style' [w/`doc:' keyword].
author Pavel Janík <Pavel@Janik.cz>
date Sat, 20 Oct 2001 20:54:39 +0000
parents 579177964efa
children ede1719b1cb9
comparison
equal deleted inserted replaced
40102:d001bdd0593d 40103:6b389fb978bc
479 479
480 deactivate_process (proc); 480 deactivate_process (proc);
481 } 481 }
482 482
483 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, 483 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
484 "Return t if OBJECT is a process.") 484 doc: /* Return t if OBJECT is a process. */)
485 (object) 485 (object)
486 Lisp_Object object; 486 Lisp_Object object;
487 { 487 {
488 return PROCESSP (object) ? Qt : Qnil; 488 return PROCESSP (object) ? Qt : Qnil;
489 } 489 }
490 490
491 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, 491 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
492 "Return the process named NAME, or nil if there is none.") 492 doc: /* Return the process named NAME, or nil if there is none. */)
493 (name) 493 (name)
494 register Lisp_Object name; 494 register Lisp_Object name;
495 { 495 {
496 if (PROCESSP (name)) 496 if (PROCESSP (name))
497 return name; 497 return name;
498 CHECK_STRING (name, 0); 498 CHECK_STRING (name, 0);
499 return Fcdr (Fassoc (name, Vprocess_alist)); 499 return Fcdr (Fassoc (name, Vprocess_alist));
500 } 500 }
501 501
502 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, 502 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
503 "Return the (or a) process associated with BUFFER.\n\ 503 doc: /* Return the (or a) process associated with BUFFER.
504 BUFFER may be a buffer or the name of one.") 504 BUFFER may be a buffer or the name of one. */)
505 (buffer) 505 (buffer)
506 register Lisp_Object buffer; 506 register Lisp_Object buffer;
507 { 507 {
508 register Lisp_Object buf, tail, proc; 508 register Lisp_Object buf, tail, proc;
509 509
510 if (NILP (buffer)) return Qnil; 510 if (NILP (buffer)) return Qnil;
558 } 558 }
559 return proc; 559 return proc;
560 } 560 }
561 561
562 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, 562 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
563 "Delete PROCESS: kill it and forget about it immediately.\n\ 563 doc: /* Delete PROCESS: kill it and forget about it immediately.
564 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 564 PROCESS may be a process, a buffer, the name of a process or buffer, or
565 nil, indicating the current buffer's process.") 565 nil, indicating the current buffer's process. */)
566 (process) 566 (process)
567 register Lisp_Object process; 567 register Lisp_Object process;
568 { 568 {
569 process = get_process (process); 569 process = get_process (process);
570 XPROCESS (process)->raw_status_low = Qnil; 570 XPROCESS (process)->raw_status_low = Qnil;
571 XPROCESS (process)->raw_status_high = Qnil; 571 XPROCESS (process)->raw_status_high = Qnil;
586 remove_process (process); 586 remove_process (process);
587 return Qnil; 587 return Qnil;
588 } 588 }
589 589
590 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0, 590 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0,
591 "Return the status of PROCESS.\n\ 591 doc: /* Return the status of PROCESS.
592 The returned value is one of the following symbols:\n\ 592 The returned value is one of the following symbols:
593 run -- for a process that is running.\n\ 593 run -- for a process that is running.
594 stop -- for a process stopped but continuable.\n\ 594 stop -- for a process stopped but continuable.
595 exit -- for a process that has exited.\n\ 595 exit -- for a process that has exited.
596 signal -- for a process that has got a fatal signal.\n\ 596 signal -- for a process that has got a fatal signal.
597 open -- for a network stream connection that is open.\n\ 597 open -- for a network stream connection that is open.
598 closed -- for a network stream connection that is closed.\n\ 598 closed -- for a network stream connection that is closed.
599 nil -- if arg is a process name and no such process exists.\n\ 599 nil -- if arg is a process name and no such process exists.
600 PROCESS may be a process, a buffer, the name of a process, or\n\ 600 PROCESS may be a process, a buffer, the name of a process, or
601 nil, indicating the current buffer's process.") 601 nil, indicating the current buffer's process. */)
602 (process) 602 (process)
603 register Lisp_Object process; 603 register Lisp_Object process;
604 { 604 {
605 register struct Lisp_Process *p; 605 register struct Lisp_Process *p;
606 register Lisp_Object status; 606 register Lisp_Object status;
607 607
629 return status; 629 return status;
630 } 630 }
631 631
632 DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status, 632 DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status,
633 1, 1, 0, 633 1, 1, 0,
634 "Return the exit status of PROCESS or the signal number that killed it.\n\ 634 doc: /* Return the exit status of PROCESS or the signal number that killed it.
635 If PROCESS has not yet exited or died, return 0.") 635 If PROCESS has not yet exited or died, return 0. */)
636 (process) 636 (process)
637 register Lisp_Object process; 637 register Lisp_Object process;
638 { 638 {
639 CHECK_PROCESS (process, 0); 639 CHECK_PROCESS (process, 0);
640 if (!NILP (XPROCESS (process)->raw_status_low)) 640 if (!NILP (XPROCESS (process)->raw_status_low))
641 update_status (XPROCESS (process)); 641 update_status (XPROCESS (process));
643 return XCAR (XCDR (XPROCESS (process)->status)); 643 return XCAR (XCDR (XPROCESS (process)->status));
644 return make_number (0); 644 return make_number (0);
645 } 645 }
646 646
647 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, 647 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
648 "Return the process id of PROCESS.\n\ 648 doc: /* Return the process id of PROCESS.
649 This is the pid of the Unix process which PROCESS uses or talks to.\n\ 649 This is the pid of the Unix process which PROCESS uses or talks to.
650 For a network connection, this value is nil.") 650 For a network connection, this value is nil. */)
651 (process) 651 (process)
652 register Lisp_Object process; 652 register Lisp_Object process;
653 { 653 {
654 CHECK_PROCESS (process, 0); 654 CHECK_PROCESS (process, 0);
655 return XPROCESS (process)->pid; 655 return XPROCESS (process)->pid;
656 } 656 }
657 657
658 DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0, 658 DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
659 "Return the name of PROCESS, as a string.\n\ 659 doc: /* Return the name of PROCESS, as a string.
660 This is the name of the program invoked in PROCESS,\n\ 660 This is the name of the program invoked in PROCESS,
661 possibly modified to make it unique among process names.") 661 possibly modified to make it unique among process names. */)
662 (process) 662 (process)
663 register Lisp_Object process; 663 register Lisp_Object process;
664 { 664 {
665 CHECK_PROCESS (process, 0); 665 CHECK_PROCESS (process, 0);
666 return XPROCESS (process)->name; 666 return XPROCESS (process)->name;
667 } 667 }
668 668
669 DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0, 669 DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
670 "Return the command that was executed to start PROCESS.\n\ 670 doc: /* Return the command that was executed to start PROCESS.
671 This is a list of strings, the first string being the program executed\n\ 671 This is a list of strings, the first string being the program executed
672 and the rest of the strings being the arguments given to it.\n\ 672 and the rest of the strings being the arguments given to it.
673 For a non-child channel, this is nil.") 673 For a non-child channel, this is nil. */)
674 (process) 674 (process)
675 register Lisp_Object process; 675 register Lisp_Object process;
676 { 676 {
677 CHECK_PROCESS (process, 0); 677 CHECK_PROCESS (process, 0);
678 return XPROCESS (process)->command; 678 return XPROCESS (process)->command;
679 } 679 }
680 680
681 DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0, 681 DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
682 "Return the name of the terminal PROCESS uses, or nil if none.\n\ 682 doc: /* Return the name of the terminal PROCESS uses, or nil if none.
683 This is the terminal that the process itself reads and writes on,\n\ 683 This is the terminal that the process itself reads and writes on,
684 not the name of the pty that Emacs uses to talk with that terminal.") 684 not the name of the pty that Emacs uses to talk with that terminal. */)
685 (process) 685 (process)
686 register Lisp_Object process; 686 register Lisp_Object process;
687 { 687 {
688 CHECK_PROCESS (process, 0); 688 CHECK_PROCESS (process, 0);
689 return XPROCESS (process)->tty_name; 689 return XPROCESS (process)->tty_name;
690 } 690 }
691 691
692 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer, 692 DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
693 2, 2, 0, 693 2, 2, 0,
694 "Set buffer associated with PROCESS to BUFFER (a buffer, or nil).") 694 doc: /* Set buffer associated with PROCESS to BUFFER (a buffer, or nil). */)
695 (process, buffer) 695 (process, buffer)
696 register Lisp_Object process, buffer; 696 register Lisp_Object process, buffer;
697 { 697 {
698 CHECK_PROCESS (process, 0); 698 CHECK_PROCESS (process, 0);
699 if (!NILP (buffer)) 699 if (!NILP (buffer))
700 CHECK_BUFFER (buffer, 1); 700 CHECK_BUFFER (buffer, 1);
701 XPROCESS (process)->buffer = buffer; 701 XPROCESS (process)->buffer = buffer;
702 return buffer; 702 return buffer;
703 } 703 }
704 704
705 DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer, 705 DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer,
706 1, 1, 0, 706 1, 1, 0,
707 "Return the buffer PROCESS is associated with.\n\ 707 doc: /* Return the buffer PROCESS is associated with.
708 Output from PROCESS is inserted in this buffer unless PROCESS has a filter.") 708 Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */)
709 (process) 709 (process)
710 register Lisp_Object process; 710 register Lisp_Object process;
711 { 711 {
712 CHECK_PROCESS (process, 0); 712 CHECK_PROCESS (process, 0);
713 return XPROCESS (process)->buffer; 713 return XPROCESS (process)->buffer;
714 } 714 }
715 715
716 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, 716 DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
717 1, 1, 0, 717 1, 1, 0,
718 "Return the marker for the end of the last output from PROCESS.") 718 doc: /* Return the marker for the end of the last output from PROCESS. */)
719 (process) 719 (process)
720 register Lisp_Object process; 720 register Lisp_Object process;
721 { 721 {
722 CHECK_PROCESS (process, 0); 722 CHECK_PROCESS (process, 0);
723 return XPROCESS (process)->mark; 723 return XPROCESS (process)->mark;
724 } 724 }
725 725
726 DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, 726 DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
727 2, 2, 0, 727 2, 2, 0,
728 "Give PROCESS the filter function FILTER; nil means no filter.\n\ 728 doc: /* Give PROCESS the filter function FILTER; nil means no filter.
729 t means stop accepting output from the process.\n\ 729 t means stop accepting output from the process.
730 When a process has a filter, each time it does output\n\ 730 When a process has a filter, each time it does output
731 the entire string of output is passed to the filter.\n\ 731 the entire string of output is passed to the filter.
732 The filter gets two arguments: the process and the string of output.\n\ 732 The filter gets two arguments: the process and the string of output.
733 If the process has a filter, its buffer is not used for output.") 733 If the process has a filter, its buffer is not used for output. */)
734 (process, filter) 734 (process, filter)
735 register Lisp_Object process, filter; 735 register Lisp_Object process, filter;
736 { 736 {
737 struct Lisp_Process *p; 737 struct Lisp_Process *p;
738 738
739 CHECK_PROCESS (process, 0); 739 CHECK_PROCESS (process, 0);
764 p->filter = filter; 764 p->filter = filter;
765 return filter; 765 return filter;
766 } 766 }
767 767
768 DEFUN ("process-filter", Fprocess_filter, Sprocess_filter, 768 DEFUN ("process-filter", Fprocess_filter, Sprocess_filter,
769 1, 1, 0, 769 1, 1, 0,
770 "Returns the filter function of PROCESS; nil if none.\n\ 770 doc: /* Returns the filter function of PROCESS; nil if none.
771 See `set-process-filter' for more info on filter functions.") 771 See `set-process-filter' for more info on filter functions. */)
772 (process) 772 (process)
773 register Lisp_Object process; 773 register Lisp_Object process;
774 { 774 {
775 CHECK_PROCESS (process, 0); 775 CHECK_PROCESS (process, 0);
776 return XPROCESS (process)->filter; 776 return XPROCESS (process)->filter;
777 } 777 }
778 778
779 DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel, 779 DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel,
780 2, 2, 0, 780 2, 2, 0,
781 "Give PROCESS the sentinel SENTINEL; nil for none.\n\ 781 doc: /* Give PROCESS the sentinel SENTINEL; nil for none.
782 The sentinel is called as a function when the process changes state.\n\ 782 The sentinel is called as a function when the process changes state.
783 It gets two arguments: the process, and a string describing the change.") 783 It gets two arguments: the process, and a string describing the change. */)
784 (process, sentinel) 784 (process, sentinel)
785 register Lisp_Object process, sentinel; 785 register Lisp_Object process, sentinel;
786 { 786 {
787 CHECK_PROCESS (process, 0); 787 CHECK_PROCESS (process, 0);
788 XPROCESS (process)->sentinel = sentinel; 788 XPROCESS (process)->sentinel = sentinel;
789 return sentinel; 789 return sentinel;
790 } 790 }
791 791
792 DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel, 792 DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel,
793 1, 1, 0, 793 1, 1, 0,
794 "Return the sentinel of PROCESS; nil if none.\n\ 794 doc: /* Return the sentinel of PROCESS; nil if none.
795 See `set-process-sentinel' for more info on sentinels.") 795 See `set-process-sentinel' for more info on sentinels. */)
796 (process) 796 (process)
797 register Lisp_Object process; 797 register Lisp_Object process;
798 { 798 {
799 CHECK_PROCESS (process, 0); 799 CHECK_PROCESS (process, 0);
800 return XPROCESS (process)->sentinel; 800 return XPROCESS (process)->sentinel;
801 } 801 }
802 802
803 DEFUN ("set-process-window-size", Fset_process_window_size, 803 DEFUN ("set-process-window-size", Fset_process_window_size,
804 Sset_process_window_size, 3, 3, 0, 804 Sset_process_window_size, 3, 3, 0,
805 "Tell PROCESS that it has logical window size HEIGHT and WIDTH.") 805 doc: /* Tell PROCESS that it has logical window size HEIGHT and WIDTH. */)
806 (process, height, width) 806 (process, height, width)
807 register Lisp_Object process, height, width; 807 register Lisp_Object process, height, width;
808 { 808 {
809 CHECK_PROCESS (process, 0); 809 CHECK_PROCESS (process, 0);
810 CHECK_NATNUM (height, 0); 810 CHECK_NATNUM (height, 0);
811 CHECK_NATNUM (width, 0); 811 CHECK_NATNUM (width, 0);
817 else 817 else
818 return Qt; 818 return Qt;
819 } 819 }
820 820
821 DEFUN ("set-process-inherit-coding-system-flag", 821 DEFUN ("set-process-inherit-coding-system-flag",
822 Fset_process_inherit_coding_system_flag, 822 Fset_process_inherit_coding_system_flag,
823 Sset_process_inherit_coding_system_flag, 2, 2, 0, 823 Sset_process_inherit_coding_system_flag, 2, 2, 0,
824 "Determine whether buffer of PROCESS will inherit coding-system.\n\ 824 doc: /* Determine whether buffer of PROCESS will inherit coding-system.
825 If the second argument FLAG is non-nil, then the variable\n\ 825 If the second argument FLAG is non-nil, then the variable
826 `buffer-file-coding-system' of the buffer associated with PROCESS\n\ 826 `buffer-file-coding-system' of the buffer associated with PROCESS
827 will be bound to the value of the coding system used to decode\n\ 827 will be bound to the value of the coding system used to decode
828 the process output.\n\ 828 the process output.
829 \n\ 829
830 This is useful when the coding system specified for the process buffer\n\ 830 This is useful when the coding system specified for the process buffer
831 leaves either the character code conversion or the end-of-line conversion\n\ 831 leaves either the character code conversion or the end-of-line conversion
832 unspecified, or if the coding system used to decode the process output\n\ 832 unspecified, or if the coding system used to decode the process output
833 is more appropriate for saving the process buffer.\n\ 833 is more appropriate for saving the process buffer.
834 \n\ 834
835 Binding the variable `inherit-process-coding-system' to non-nil before\n\ 835 Binding the variable `inherit-process-coding-system' to non-nil before
836 starting the process is an alternative way of setting the inherit flag\n\ 836 starting the process is an alternative way of setting the inherit flag
837 for the process which will run.") 837 for the process which will run. */)
838 (process, flag) 838 (process, flag)
839 register Lisp_Object process, flag; 839 register Lisp_Object process, flag;
840 { 840 {
841 CHECK_PROCESS (process, 0); 841 CHECK_PROCESS (process, 0);
842 XPROCESS (process)->inherit_coding_system_flag = flag; 842 XPROCESS (process)->inherit_coding_system_flag = flag;
843 return flag; 843 return flag;
844 } 844 }
845 845
846 DEFUN ("process-inherit-coding-system-flag", 846 DEFUN ("process-inherit-coding-system-flag",
847 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag, 847 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
848 1, 1, 0, 848 1, 1, 0,
849 "Return the value of inherit-coding-system flag for PROCESS.\n\ 849 doc: /* Return the value of inherit-coding-system flag for PROCESS.
850 If this flag is t, `buffer-file-coding-system' of the buffer\n\ 850 If this flag is t, `buffer-file-coding-system' of the buffer
851 associated with PROCESS will inherit the coding system used to decode\n\ 851 associated with PROCESS will inherit the coding system used to decode
852 the process output.") 852 the process output. */)
853 (process) 853 (process)
854 register Lisp_Object process; 854 register Lisp_Object process;
855 { 855 {
856 CHECK_PROCESS (process, 0); 856 CHECK_PROCESS (process, 0);
857 return XPROCESS (process)->inherit_coding_system_flag; 857 return XPROCESS (process)->inherit_coding_system_flag;
858 } 858 }
859 859
860 DEFUN ("process-kill-without-query", Fprocess_kill_without_query, 860 DEFUN ("process-kill-without-query", Fprocess_kill_without_query,
861 Sprocess_kill_without_query, 1, 2, 0, 861 Sprocess_kill_without_query, 1, 2, 0,
862 "Say no query needed if PROCESS is running when Emacs is exited.\n\ 862 doc: /* Say no query needed if PROCESS is running when Emacs is exited.
863 Optional second argument if non-nil says to require a query.\n\ 863 Optional second argument if non-nil says to require a query.
864 Value is t if a query was formerly required.") 864 Value is t if a query was formerly required. */)
865 (process, value) 865 (process, value)
866 register Lisp_Object process, value; 866 register Lisp_Object process, value;
867 { 867 {
868 Lisp_Object tem; 868 Lisp_Object tem;
869 869
870 CHECK_PROCESS (process, 0); 870 CHECK_PROCESS (process, 0);
873 873
874 return Fnull (tem); 874 return Fnull (tem);
875 } 875 }
876 876
877 DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, 877 DEFUN ("process-contact", Fprocess_contact, Sprocess_contact,
878 1, 1, 0, 878 1, 1, 0,
879 "Return the contact info of PROCESS; t for a real child.\n\ 879 doc: /* Return the contact info of PROCESS; t for a real child.
880 For a net connection, the value is a cons cell of the form (HOST SERVICE).") 880 For a net connection, the value is a cons cell of the form (HOST SERVICE). */)
881 (process) 881 (process)
882 register Lisp_Object process; 882 register Lisp_Object process;
883 { 883 {
884 CHECK_PROCESS (process, 0); 884 CHECK_PROCESS (process, 0);
885 return XPROCESS (process)->childp; 885 return XPROCESS (process)->childp;
886 } 886 }
887 887
888 #if 0 /* Turned off because we don't currently record this info 888 #if 0 /* Turned off because we don't currently record this info
889 in the process. Perhaps add it. */ 889 in the process. Perhaps add it. */
890 DEFUN ("process-connection", Fprocess_connection, Sprocess_connection, 1, 1, 0, 890 DEFUN ("process-connection", Fprocess_connection, Sprocess_connection, 1, 1, 0,
891 "Return the connection type of PROCESS.\n\ 891 doc: /* Return the connection type of PROCESS.
892 The value is nil for a pipe, t or `pty' for a pty, or `stream' for\n\ 892 The value is nil for a pipe, t or `pty' for a pty, or `stream' for
893 a socket connection.") 893 a socket connection. */)
894 (process) 894 (process)
895 Lisp_Object process; 895 Lisp_Object process;
896 { 896 {
897 return XPROCESS (process)->type; 897 return XPROCESS (process)->type;
898 } 898 }
899 #endif 899 #endif
1013 } 1013 }
1014 return Qnil; 1014 return Qnil;
1015 } 1015 }
1016 1016
1017 DEFUN ("list-processes", Flist_processes, Slist_processes, 0, 0, "", 1017 DEFUN ("list-processes", Flist_processes, Slist_processes, 0, 0, "",
1018 "Display a list of all processes.\n\ 1018 doc: /* Display a list of all processes.
1019 Any process listed as exited or signaled is actually eliminated\n\ 1019 Any process listed as exited or signaled is actually eliminated
1020 after the listing is made.") 1020 after the listing is made. */)
1021 () 1021 ()
1022 { 1022 {
1023 internal_with_output_to_temp_buffer ("*Process List*", 1023 internal_with_output_to_temp_buffer ("*Process List*",
1024 list_processes_1, Qnil); 1024 list_processes_1, Qnil);
1025 return Qnil; 1025 return Qnil;
1026 } 1026 }
1027 1027
1028 DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, 1028 DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0,
1029 "Return a list of all processes.") 1029 doc: /* Return a list of all processes. */)
1030 () 1030 ()
1031 { 1031 {
1032 return Fmapcar (Qcdr, Vprocess_alist); 1032 return Fmapcar (Qcdr, Vprocess_alist);
1033 } 1033 }
1034 1034
1035 /* Starting asynchronous inferior processes. */ 1035 /* Starting asynchronous inferior processes. */
1036 1036
1037 static Lisp_Object start_process_unwind (); 1037 static Lisp_Object start_process_unwind ();
1038 1038
1039 DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, 1039 DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0,
1040 "Start a program in a subprocess. Return the process object for it.\n\ 1040 doc: /* Start a program in a subprocess. Return the process object for it.
1041 NAME is name for process. It is modified if necessary to make it unique.\n\ 1041 NAME is name for process. It is modified if necessary to make it unique.
1042 BUFFER is the buffer or (buffer-name) to associate with the process.\n\ 1042 BUFFER is the buffer or (buffer-name) to associate with the process.
1043 Process output goes at end of that buffer, unless you specify\n\ 1043 Process output goes at end of that buffer, unless you specify
1044 an output stream or filter function to handle the output.\n\ 1044 an output stream or filter function to handle the output.
1045 BUFFER may be also nil, meaning that this process is not associated\n\ 1045 BUFFER may be also nil, meaning that this process is not associated
1046 with any buffer.\n\ 1046 with any buffer.
1047 Third arg is program file name. It is searched for in PATH.\n\ 1047 Third arg is program file name. It is searched for in PATH.
1048 Remaining arguments are strings to give program as arguments.") 1048 Remaining arguments are strings to give program as arguments. */)
1049 (nargs, args) 1049 (nargs, args)
1050 int nargs; 1050 int nargs;
1051 register Lisp_Object *args; 1051 register Lisp_Object *args;
1052 { 1052 {
1053 Lisp_Object buffer, name, program, proc, current_dir, tem; 1053 Lisp_Object buffer, name, program, proc, current_dir, tem;
1054 #ifdef VMS 1054 #ifdef VMS
1742 connection has no PID; you cannot signal it. All you can do is 1742 connection has no PID; you cannot signal it. All you can do is
1743 deactivate and close it via delete-process */ 1743 deactivate and close it via delete-process */
1744 1744
1745 DEFUN ("open-network-stream", Fopen_network_stream, Sopen_network_stream, 1745 DEFUN ("open-network-stream", Fopen_network_stream, Sopen_network_stream,
1746 4, 4, 0, 1746 4, 4, 0,
1747 "Open a TCP connection for a service to a host.\n\ 1747 doc: /* Open a TCP connection for a service to a host.
1748 Returns a subprocess-object to represent the connection.\n\ 1748 Returns a subprocess-object to represent the connection.
1749 Input and output work as for subprocesses; `delete-process' closes it.\n\ 1749 Input and output work as for subprocesses; `delete-process' closes it.
1750 Args are NAME BUFFER HOST SERVICE.\n\ 1750 Args are NAME BUFFER HOST SERVICE.
1751 NAME is name for process. It is modified if necessary to make it unique.\n\ 1751 NAME is name for process. It is modified if necessary to make it unique.
1752 BUFFER is the buffer (or buffer-name) to associate with the process.\n\ 1752 BUFFER is the buffer (or buffer-name) to associate with the process.
1753 Process output goes at end of that buffer, unless you specify\n\ 1753 Process output goes at end of that buffer, unless you specify
1754 an output stream or filter function to handle the output.\n\ 1754 an output stream or filter function to handle the output.
1755 BUFFER may be also nil, meaning that this process is not associated\n\ 1755 BUFFER may be also nil, meaning that this process is not associated
1756 with any buffer\n\ 1756 with any buffer
1757 Third arg is name of the host to connect to, or its IP address.\n\ 1757 Third arg is name of the host to connect to, or its IP address.
1758 Fourth arg SERVICE is name of the service desired, or an integer\n\ 1758 Fourth arg SERVICE is name of the service desired, or an integer
1759 specifying a port number to connect to.") 1759 specifying a port number to connect to. */)
1760 (name, buffer, host, service) 1760 (name, buffer, host, service)
1761 Lisp_Object name, buffer, host, service; 1761 Lisp_Object name, buffer, host, service;
1762 { 1762 {
1763 Lisp_Object proc; 1763 Lisp_Object proc;
1764 #ifdef HAVE_GETADDRINFO 1764 #ifdef HAVE_GETADDRINFO
1765 struct addrinfo hints, *res, *lres; 1765 struct addrinfo hints, *res, *lres;
2234 } 2234 }
2235 #endif 2235 #endif
2236 } 2236 }
2237 2237
2238 DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, 2238 DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
2239 0, 3, 0, 2239 0, 3, 0,
2240 "Allow any pending output from subprocesses to be read by Emacs.\n\ 2240 doc: /* Allow any pending output from subprocesses to be read by Emacs.
2241 It is read into the process' buffers or given to their filter functions.\n\ 2241 It is read into the process' buffers or given to their filter functions.
2242 Non-nil arg PROCESS means do not return until some output has been received\n\ 2242 Non-nil arg PROCESS means do not return until some output has been received
2243 from PROCESS.\n\ 2243 from PROCESS.
2244 Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of\n\ 2244 Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of
2245 seconds and microseconds to wait; return after that much time whether\n\ 2245 seconds and microseconds to wait; return after that much time whether
2246 or not there is input.\n\ 2246 or not there is input.
2247 Return non-nil iff we received any output before the timeout expired.") 2247 Return non-nil iff we received any output before the timeout expired. */)
2248 (process, timeout, timeout_msecs) 2248 (process, timeout, timeout_msecs)
2249 register Lisp_Object process, timeout, timeout_msecs; 2249 register Lisp_Object process, timeout, timeout_msecs;
2250 { 2250 {
2251 int seconds; 2251 int seconds;
2252 int useconds; 2252 int useconds;
2253 2253
3208 return nbytes; 3208 return nbytes;
3209 } 3209 }
3210 3210
3211 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, 3211 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,
3212 0, 0, 0, 3212 0, 0, 0,
3213 "Returns non-nil if emacs is waiting for input from the user.\n\ 3213 doc: /* Returns non-nil if emacs is waiting for input from the user.
3214 This is intended for use by asynchronous process output filters and sentinels.") 3214 This is intended for use by asynchronous process output filters and sentinels. */)
3215 () 3215 ()
3216 { 3216 {
3217 return (waiting_for_user_input_p ? Qt : Qnil); 3217 return (waiting_for_user_input_p ? Qt : Qnil);
3218 } 3218 }
3219 3219
3220 /* Sending data to subprocess */ 3220 /* Sending data to subprocess */
3521 3521
3522 UNGCPRO; 3522 UNGCPRO;
3523 } 3523 }
3524 3524
3525 DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, 3525 DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region,
3526 3, 3, 0, 3526 3, 3, 0,
3527 "Send current contents of region as input to PROCESS.\n\ 3527 doc: /* Send current contents of region as input to PROCESS.
3528 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 3528 PROCESS may be a process, a buffer, the name of a process or buffer, or
3529 nil, indicating the current buffer's process.\n\ 3529 nil, indicating the current buffer's process.
3530 Called from program, takes three arguments, PROCESS, START and END.\n\ 3530 Called from program, takes three arguments, PROCESS, START and END.
3531 If the region is more than 500 characters long,\n\ 3531 If the region is more than 500 characters long,
3532 it is sent in several bunches. This may happen even for shorter regions.\n\ 3532 it is sent in several bunches. This may happen even for shorter regions.
3533 Output from processes can arrive in between bunches.") 3533 Output from processes can arrive in between bunches. */)
3534 (process, start, end) 3534 (process, start, end)
3535 Lisp_Object process, start, end; 3535 Lisp_Object process, start, end;
3536 { 3536 {
3537 Lisp_Object proc; 3537 Lisp_Object proc;
3538 int start1, end1; 3538 int start1, end1;
3539 3539
3550 3550
3551 return Qnil; 3551 return Qnil;
3552 } 3552 }
3553 3553
3554 DEFUN ("process-send-string", Fprocess_send_string, Sprocess_send_string, 3554 DEFUN ("process-send-string", Fprocess_send_string, Sprocess_send_string,
3555 2, 2, 0, 3555 2, 2, 0,
3556 "Send PROCESS the contents of STRING as input.\n\ 3556 doc: /* Send PROCESS the contents of STRING as input.
3557 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 3557 PROCESS may be a process, a buffer, the name of a process or buffer, or
3558 nil, indicating the current buffer's process.\n\ 3558 nil, indicating the current buffer's process.
3559 If STRING is more than 500 characters long,\n\ 3559 If STRING is more than 500 characters long,
3560 it is sent in several bunches. This may happen even for shorter strings.\n\ 3560 it is sent in several bunches. This may happen even for shorter strings.
3561 Output from processes can arrive in between bunches.") 3561 Output from processes can arrive in between bunches. */)
3562 (process, string) 3562 (process, string)
3563 Lisp_Object process, string; 3563 Lisp_Object process, string;
3564 { 3564 {
3565 Lisp_Object proc; 3565 Lisp_Object proc;
3566 CHECK_STRING (string, 1); 3566 CHECK_STRING (string, 1);
3567 proc = get_process (process); 3567 proc = get_process (process);
3570 return Qnil; 3570 return Qnil;
3571 } 3571 }
3572 3572
3573 DEFUN ("process-running-child-p", Fprocess_running_child_p, 3573 DEFUN ("process-running-child-p", Fprocess_running_child_p,
3574 Sprocess_running_child_p, 0, 1, 0, 3574 Sprocess_running_child_p, 0, 1, 0,
3575 "Return t if PROCESS has given the terminal to a child.\n\ 3575 doc: /* Return t if PROCESS has given the terminal to a child.
3576 If the operating system does not make it possible to find out,\n\ 3576 If the operating system does not make it possible to find out,
3577 return t unconditionally.") 3577 return t unconditionally. */)
3578 (process) 3578 (process)
3579 Lisp_Object process; 3579 Lisp_Object process;
3580 { 3580 {
3581 /* Initialize in case ioctl doesn't exist or gives an error, 3581 /* Initialize in case ioctl doesn't exist or gives an error,
3582 in a way that will cause returning t. */ 3582 in a way that will cause returning t. */
3583 int gid = 0; 3583 int gid = 0;
3830 EMACS_KILLPG (-gid, signo); 3830 EMACS_KILLPG (-gid, signo);
3831 #endif /* ! defined (TIOCSIGSEND) */ 3831 #endif /* ! defined (TIOCSIGSEND) */
3832 } 3832 }
3833 3833
3834 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, 3834 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0,
3835 "Interrupt process PROCESS.\n\ 3835 doc: /* Interrupt process PROCESS.
3836 PROCESS may be a process, a buffer, or the name of a process or buffer.\n\ 3836 PROCESS may be a process, a buffer, or the name of a process or buffer.
3837 nil or no arg means current buffer's process.\n\ 3837 nil or no arg means current buffer's process.
3838 Second arg CURRENT-GROUP non-nil means send signal to\n\ 3838 Second arg CURRENT-GROUP non-nil means send signal to
3839 the current process-group of the process's controlling terminal\n\ 3839 the current process-group of the process's controlling terminal
3840 rather than to the process's own process group.\n\ 3840 rather than to the process's own process group.
3841 If the process is a shell, this means interrupt current subjob\n\ 3841 If the process is a shell, this means interrupt current subjob
3842 rather than the shell.\n\ 3842 rather than the shell.
3843 \n\ 3843
3844 If CURRENT-GROUP is `lambda', and if the shell owns the terminal,\n\ 3844 If CURRENT-GROUP is `lambda', and if the shell owns the terminal,
3845 don't send the signal.") 3845 don't send the signal. */)
3846 (process, current_group) 3846 (process, current_group)
3847 Lisp_Object process, current_group; 3847 Lisp_Object process, current_group;
3848 { 3848 {
3849 process_send_signal (process, SIGINT, current_group, 0); 3849 process_send_signal (process, SIGINT, current_group, 0);
3850 return process; 3850 return process;
3851 } 3851 }
3852 3852
3853 DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0, 3853 DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0,
3854 "Kill process PROCESS. May be process or name of one.\n\ 3854 doc: /* Kill process PROCESS. May be process or name of one.
3855 See function `interrupt-process' for more details on usage.") 3855 See function `interrupt-process' for more details on usage. */)
3856 (process, current_group) 3856 (process, current_group)
3857 Lisp_Object process, current_group; 3857 Lisp_Object process, current_group;
3858 { 3858 {
3859 process_send_signal (process, SIGKILL, current_group, 0); 3859 process_send_signal (process, SIGKILL, current_group, 0);
3860 return process; 3860 return process;
3861 } 3861 }
3862 3862
3863 DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0, 3863 DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0,
3864 "Send QUIT signal to process PROCESS. May be process or name of one.\n\ 3864 doc: /* Send QUIT signal to process PROCESS. May be process or name of one.
3865 See function `interrupt-process' for more details on usage.") 3865 See function `interrupt-process' for more details on usage. */)
3866 (process, current_group) 3866 (process, current_group)
3867 Lisp_Object process, current_group; 3867 Lisp_Object process, current_group;
3868 { 3868 {
3869 process_send_signal (process, SIGQUIT, current_group, 0); 3869 process_send_signal (process, SIGQUIT, current_group, 0);
3870 return process; 3870 return process;
3871 } 3871 }
3872 3872
3873 DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0, 3873 DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0,
3874 "Stop process PROCESS. May be process or name of one.\n\ 3874 doc: /* Stop process PROCESS. May be process or name of one.
3875 See function `interrupt-process' for more details on usage.") 3875 See function `interrupt-process' for more details on usage. */)
3876 (process, current_group) 3876 (process, current_group)
3877 Lisp_Object process, current_group; 3877 Lisp_Object process, current_group;
3878 { 3878 {
3879 #ifndef SIGTSTP 3879 #ifndef SIGTSTP
3880 error ("no SIGTSTP support"); 3880 error ("no SIGTSTP support");
3881 #else 3881 #else
3883 #endif 3883 #endif
3884 return process; 3884 return process;
3885 } 3885 }
3886 3886
3887 DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0, 3887 DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,
3888 "Continue process PROCESS. May be process or name of one.\n\ 3888 doc: /* Continue process PROCESS. May be process or name of one.
3889 See function `interrupt-process' for more details on usage.") 3889 See function `interrupt-process' for more details on usage. */)
3890 (process, current_group) 3890 (process, current_group)
3891 Lisp_Object process, current_group; 3891 Lisp_Object process, current_group;
3892 { 3892 {
3893 #ifdef SIGCONT 3893 #ifdef SIGCONT
3894 process_send_signal (process, SIGCONT, current_group, 0); 3894 process_send_signal (process, SIGCONT, current_group, 0);
3895 #else 3895 #else
3897 #endif 3897 #endif
3898 return process; 3898 return process;
3899 } 3899 }
3900 3900
3901 DEFUN ("signal-process", Fsignal_process, Ssignal_process, 3901 DEFUN ("signal-process", Fsignal_process, Ssignal_process,
3902 2, 2, "nProcess number: \nnSignal code: ", 3902 2, 2, "nProcess number: \nnSignal code: ",
3903 "Send the process with process id PID the signal with code SIGCODE.\n\ 3903 doc: /* Send the process with process id PID the signal with code SIGCODE.
3904 PID must be an integer. The process need not be a child of this Emacs.\n\ 3904 PID must be an integer. The process need not be a child of this Emacs.
3905 SIGCODE may be an integer, or a symbol whose name is a signal name.") 3905 SIGCODE may be an integer, or a symbol whose name is a signal name. */)
3906 (pid, sigcode) 3906 (pid, sigcode)
3907 Lisp_Object pid, sigcode; 3907 Lisp_Object pid, sigcode;
3908 { 3908 {
3909 CHECK_NUMBER (pid, 0); 3909 CHECK_NUMBER (pid, 0);
3910 3910
3911 #define handle_signal(NAME, VALUE) \ 3911 #define handle_signal(NAME, VALUE) \
4021 4021
4022 return make_number (kill (XINT (pid), XINT (sigcode))); 4022 return make_number (kill (XINT (pid), XINT (sigcode)));
4023 } 4023 }
4024 4024
4025 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, 4025 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
4026 "Make PROCESS see end-of-file in its input.\n\ 4026 doc: /* Make PROCESS see end-of-file in its input.
4027 EOF comes after any text already sent to it.\n\ 4027 EOF comes after any text already sent to it.
4028 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 4028 PROCESS may be a process, a buffer, the name of a process or buffer, or
4029 nil, indicating the current buffer's process.\n\ 4029 nil, indicating the current buffer's process.
4030 If PROCESS is a network connection, or is a process communicating\n\ 4030 If PROCESS is a network connection, or is a process communicating
4031 through a pipe (as opposed to a pty), then you cannot send any more\n\ 4031 through a pipe (as opposed to a pty), then you cannot send any more
4032 text to PROCESS after you call this function.") 4032 text to PROCESS after you call this function. */)
4033 (process) 4033 (process)
4034 Lisp_Object process; 4034 Lisp_Object process;
4035 { 4035 {
4036 Lisp_Object proc; 4036 Lisp_Object proc;
4037 struct coding_system *coding; 4037 struct coding_system *coding;
4038 4038
4508 } 4508 }
4509 4509
4510 4510
4511 DEFUN ("set-process-coding-system", Fset_process_coding_system, 4511 DEFUN ("set-process-coding-system", Fset_process_coding_system,
4512 Sset_process_coding_system, 1, 3, 0, 4512 Sset_process_coding_system, 1, 3, 0,
4513 "Set coding systems of PROCESS to DECODING and ENCODING.\n\ 4513 doc: /* Set coding systems of PROCESS to DECODING and ENCODING.
4514 DECODING will be used to decode subprocess output and ENCODING to\n\ 4514 DECODING will be used to decode subprocess output and ENCODING to
4515 encode subprocess input.") 4515 encode subprocess input. */)
4516 (proc, decoding, encoding) 4516 (proc, decoding, encoding)
4517 register Lisp_Object proc, decoding, encoding; 4517 register Lisp_Object proc, decoding, encoding;
4518 { 4518 {
4519 register struct Lisp_Process *p; 4519 register struct Lisp_Process *p;
4520 4520
4521 CHECK_PROCESS (proc, 0); 4521 CHECK_PROCESS (proc, 0);
4535 return Qnil; 4535 return Qnil;
4536 } 4536 }
4537 4537
4538 DEFUN ("process-coding-system", 4538 DEFUN ("process-coding-system",
4539 Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0, 4539 Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0,
4540 "Return a cons of coding systems for decoding and encoding of PROCESS.") 4540 doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */)
4541 (proc) 4541 (proc)
4542 register Lisp_Object proc; 4542 register Lisp_Object proc;
4543 { 4543 {
4544 CHECK_PROCESS (proc, 0); 4544 CHECK_PROCESS (proc, 0);
4545 return Fcons (XPROCESS (proc)->decode_coding_system, 4545 return Fcons (XPROCESS (proc)->decode_coding_system,
4546 XPROCESS (proc)->encode_coding_system); 4546 XPROCESS (proc)->encode_coding_system);
4658 staticpro (&Qlast_nonmenu_event); 4658 staticpro (&Qlast_nonmenu_event);
4659 4659
4660 staticpro (&Vprocess_alist); 4660 staticpro (&Vprocess_alist);
4661 4661
4662 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, 4662 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
4663 "*Non-nil means delete processes immediately when they exit.\n\ 4663 doc: /* *Non-nil means delete processes immediately when they exit.
4664 nil means don't delete them until `list-processes' is run."); 4664 nil means don't delete them until `list-processes' is run. */);
4665 4665
4666 delete_exited_processes = 1; 4666 delete_exited_processes = 1;
4667 4667
4668 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, 4668 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
4669 "Control type of device used to communicate with subprocesses.\n\ 4669 doc: /* Control type of device used to communicate with subprocesses.
4670 Values are nil to use a pipe, or t or `pty' to use a pty.\n\ 4670 Values are nil to use a pipe, or t or `pty' to use a pty.
4671 The value has no effect if the system has no ptys or if all ptys are busy:\n\ 4671 The value has no effect if the system has no ptys or if all ptys are busy:
4672 then a pipe is used in any case.\n\ 4672 then a pipe is used in any case.
4673 The value takes effect when `start-process' is called."); 4673 The value takes effect when `start-process' is called. */);
4674 Vprocess_connection_type = Qt; 4674 Vprocess_connection_type = Qt;
4675 4675
4676 defsubr (&Sprocessp); 4676 defsubr (&Sprocessp);
4677 defsubr (&Sget_process); 4677 defsubr (&Sget_process);
4678 defsubr (&Sget_buffer_process); 4678 defsubr (&Sget_buffer_process);
4970 4970
4971 4971
4972 /* Don't confuse make-docfile by having two doc strings for this function. 4972 /* Don't confuse make-docfile by having two doc strings for this function.
4973 make-docfile does not pay attention to #if, for good reason! */ 4973 make-docfile does not pay attention to #if, for good reason! */
4974 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, 4974 DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
4975 0) 4975 0)
4976 (name) 4976 (name)
4977 register Lisp_Object name; 4977 register Lisp_Object name;
4978 { 4978 {
4979 return Qnil; 4979 return Qnil;
4980 } 4980 }
4981 4981
4982 /* Don't confuse make-docfile by having two doc strings for this function. 4982 /* Don't confuse make-docfile by having two doc strings for this function.
4983 make-docfile does not pay attention to #if, for good reason! */ 4983 make-docfile does not pay attention to #if, for good reason! */
4984 DEFUN ("process-inherit-coding-system-flag", 4984 DEFUN ("process-inherit-coding-system-flag",
4985 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag, 4985 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
4986 1, 1, 0, 4986 1, 1, 0,
4987 0) 4987 0)
4988 (process) 4988 (process)
4989 register Lisp_Object process; 4989 register Lisp_Object process;
4990 { 4990 {
4991 /* Ignore the argument and return the value of 4991 /* Ignore the argument and return the value of
4992 inherit-process-coding-system. */ 4992 inherit-process-coding-system. */
4993 return inherit_process_coding_system ? Qt : Qnil; 4993 return inherit_process_coding_system ? Qt : Qnil;