Mercurial > emacs
comparison src/process.c @ 9115:59bc2d010b5f
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 27 Sep 1994 01:53:42 +0000 |
parents | d6d1afc8685f |
children | 21f6120be5ba |
comparison
equal
deleted
inserted
replaced
9114:9853955949cf | 9115:59bc2d010b5f |
---|---|
305 int *code; | 305 int *code; |
306 int *coredump; | 306 int *coredump; |
307 { | 307 { |
308 Lisp_Object tem; | 308 Lisp_Object tem; |
309 | 309 |
310 if (XTYPE (l) == Lisp_Symbol) | 310 if (SYMBOLP (l)) |
311 { | 311 { |
312 *symbol = l; | 312 *symbol = l; |
313 *code = 0; | 313 *code = 0; |
314 *coredump = 0; | 314 *coredump = 0; |
315 } | 315 } |
511 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, | 511 DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, |
512 "Return t if OBJECT is a process.") | 512 "Return t if OBJECT is a process.") |
513 (obj) | 513 (obj) |
514 Lisp_Object obj; | 514 Lisp_Object obj; |
515 { | 515 { |
516 return XTYPE (obj) == Lisp_Process ? Qt : Qnil; | 516 return PROCESSP (obj) ? Qt : Qnil; |
517 } | 517 } |
518 | 518 |
519 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, | 519 DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, |
520 "Return the process named NAME, or nil if there is none.") | 520 "Return the process named NAME, or nil if there is none.") |
521 (name) | 521 (name) |
522 register Lisp_Object name; | 522 register Lisp_Object name; |
523 { | 523 { |
524 if (XTYPE (name) == Lisp_Process) | 524 if (PROCESSP (name)) |
525 return name; | 525 return name; |
526 CHECK_STRING (name, 0); | 526 CHECK_STRING (name, 0); |
527 return Fcdr (Fassoc (name, Vprocess_alist)); | 527 return Fcdr (Fassoc (name, Vprocess_alist)); |
528 } | 528 } |
529 | 529 |
540 if (NILP (buf)) return Qnil; | 540 if (NILP (buf)) return Qnil; |
541 | 541 |
542 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) | 542 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) |
543 { | 543 { |
544 proc = Fcdr (Fcar (tail)); | 544 proc = Fcdr (Fcar (tail)); |
545 if (XTYPE (proc) == Lisp_Process && EQ (XPROCESS (proc)->buffer, buf)) | 545 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf)) |
546 return proc; | 546 return proc; |
547 } | 547 } |
548 return Qnil; | 548 return Qnil; |
549 } | 549 } |
550 | 550 |
642 | 642 |
643 p = XPROCESS (proc); | 643 p = XPROCESS (proc); |
644 if (!NILP (p->raw_status_low)) | 644 if (!NILP (p->raw_status_low)) |
645 update_status (p); | 645 update_status (p); |
646 status = p->status; | 646 status = p->status; |
647 if (XTYPE (status) == Lisp_Cons) | 647 if (CONSP (status)) |
648 status = XCONS (status)->car; | 648 status = XCONS (status)->car; |
649 if (NETCONN_P (proc)) | 649 if (NETCONN_P (proc)) |
650 { | 650 { |
651 if (EQ (status, Qrun)) | 651 if (EQ (status, Qrun)) |
652 status = Qopen; | 652 status = Qopen; |
664 register Lisp_Object proc; | 664 register Lisp_Object proc; |
665 { | 665 { |
666 CHECK_PROCESS (proc, 0); | 666 CHECK_PROCESS (proc, 0); |
667 if (!NILP (XPROCESS (proc)->raw_status_low)) | 667 if (!NILP (XPROCESS (proc)->raw_status_low)) |
668 update_status (XPROCESS (proc)); | 668 update_status (XPROCESS (proc)); |
669 if (XTYPE (XPROCESS (proc)->status) == Lisp_Cons) | 669 if (CONSP (XPROCESS (proc)->status)) |
670 return XCONS (XCONS (XPROCESS (proc)->status)->cdr)->car; | 670 return XCONS (XCONS (XPROCESS (proc)->status)->cdr)->car; |
671 return make_number (0); | 671 return make_number (0); |
672 } | 672 } |
673 | 673 |
674 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, | 674 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, |
886 Findent_to (make_number (13), minspace); | 886 Findent_to (make_number (13), minspace); |
887 | 887 |
888 if (!NILP (p->raw_status_low)) | 888 if (!NILP (p->raw_status_low)) |
889 update_status (p); | 889 update_status (p); |
890 symbol = p->status; | 890 symbol = p->status; |
891 if (XTYPE (p->status) == Lisp_Cons) | 891 if (CONSP (p->status)) |
892 symbol = XCONS (p->status)->car; | 892 symbol = XCONS (p->status)->car; |
893 | 893 |
894 | 894 |
895 if (EQ (symbol, Qsignal)) | 895 if (EQ (symbol, Qsignal)) |
896 { | 896 { |
1121 remove it from the process list. */ | 1121 remove it from the process list. */ |
1122 static Lisp_Object | 1122 static Lisp_Object |
1123 start_process_unwind (proc) | 1123 start_process_unwind (proc) |
1124 Lisp_Object proc; | 1124 Lisp_Object proc; |
1125 { | 1125 { |
1126 if (XTYPE (proc) != Lisp_Process) | 1126 if (!PROCESSP (proc)) |
1127 abort (); | 1127 abort (); |
1128 | 1128 |
1129 /* Was PROC started successfully? */ | 1129 /* Was PROC started successfully? */ |
1130 if (XINT (XPROCESS (proc)->pid) <= 0) | 1130 if (XINT (XPROCESS (proc)->pid) <= 0) |
1131 remove_process (proc); | 1131 remove_process (proc); |
1520 int count = specpdl_ptr - specpdl; | 1520 int count = specpdl_ptr - specpdl; |
1521 | 1521 |
1522 GCPRO4 (name, buffer, host, service); | 1522 GCPRO4 (name, buffer, host, service); |
1523 CHECK_STRING (name, 0); | 1523 CHECK_STRING (name, 0); |
1524 CHECK_STRING (host, 0); | 1524 CHECK_STRING (host, 0); |
1525 if (XTYPE (service) == Lisp_Int) | 1525 if (INTEGERP (service)) |
1526 port = htons ((unsigned short) XINT (service)); | 1526 port = htons ((unsigned short) XINT (service)); |
1527 else | 1527 else |
1528 { | 1528 { |
1529 CHECK_STRING (service, 0); | 1529 CHECK_STRING (service, 0); |
1530 svc_info = getservbyname (XSTRING (service)->data, "tcp"); | 1530 svc_info = getservbyname (XSTRING (service)->data, "tcp"); |
1756 | 1756 |
1757 if (! NILP (timeout_msecs)) | 1757 if (! NILP (timeout_msecs)) |
1758 { | 1758 { |
1759 CHECK_NUMBER (timeout_msecs, 2); | 1759 CHECK_NUMBER (timeout_msecs, 2); |
1760 useconds = XINT (timeout_msecs); | 1760 useconds = XINT (timeout_msecs); |
1761 if (XTYPE (timeout) != Lisp_Int) | 1761 if (!INTEGERP (timeout)) |
1762 XSET (timeout, Lisp_Int, 0); | 1762 XSET (timeout, Lisp_Int, 0); |
1763 | 1763 |
1764 { | 1764 { |
1765 int carry = useconds / 1000000; | 1765 int carry = useconds / 1000000; |
1766 | 1766 |
1864 | 1864 |
1865 FD_ZERO (&Available); | 1865 FD_ZERO (&Available); |
1866 | 1866 |
1867 /* If read_kbd is a process to watch, set wait_proc and wait_channel | 1867 /* If read_kbd is a process to watch, set wait_proc and wait_channel |
1868 accordingly. */ | 1868 accordingly. */ |
1869 if (XTYPE (read_kbd) == Lisp_Process) | 1869 if (PROCESSP (read_kbd)) |
1870 { | 1870 { |
1871 wait_proc = XPROCESS (read_kbd); | 1871 wait_proc = XPROCESS (read_kbd); |
1872 wait_channel = XINT (wait_proc->infd); | 1872 wait_channel = XINT (wait_proc->infd); |
1873 XFASTINT (read_kbd) = 0; | 1873 XFASTINT (read_kbd) = 0; |
1874 } | 1874 } |
1875 | 1875 |
1876 /* If waiting for non-nil in a cell, record where. */ | 1876 /* If waiting for non-nil in a cell, record where. */ |
1877 if (XTYPE (read_kbd) == Lisp_Cons) | 1877 if (CONSP (read_kbd)) |
1878 { | 1878 { |
1879 wait_for_cell = &XCONS (read_kbd)->car; | 1879 wait_for_cell = &XCONS (read_kbd)->car; |
1880 XFASTINT (read_kbd) = 0; | 1880 XFASTINT (read_kbd) = 0; |
1881 } | 1881 } |
1882 | 1882 |
3038 if (p == 0) | 3038 if (p == 0) |
3039 for (tail = Vprocess_alist; XSYMBOL (tail) != XSYMBOL (Qnil); tail = XCONS (tail)->cdr) | 3039 for (tail = Vprocess_alist; XSYMBOL (tail) != XSYMBOL (Qnil); tail = XCONS (tail)->cdr) |
3040 { | 3040 { |
3041 proc = XCONS (XCONS (tail)->car)->cdr; | 3041 proc = XCONS (XCONS (tail)->car)->cdr; |
3042 p = XPROCESS (proc); | 3042 p = XPROCESS (proc); |
3043 if (XTYPE (p->pid) == Lisp_Int && XINT (p->pid) == -1) | 3043 if (INTEGERP (p->pid) && XINT (p->pid) == -1) |
3044 break; | 3044 break; |
3045 p = 0; | 3045 p = 0; |
3046 } | 3046 } |
3047 | 3047 |
3048 /* Change the status of the process that was found. */ | 3048 /* Change the status of the process that was found. */ |
3213 update_status (p); | 3213 update_status (p); |
3214 msg = status_message (p->status); | 3214 msg = status_message (p->status); |
3215 | 3215 |
3216 /* If process is terminated, deactivate it or delete it. */ | 3216 /* If process is terminated, deactivate it or delete it. */ |
3217 symbol = p->status; | 3217 symbol = p->status; |
3218 if (XTYPE (p->status) == Lisp_Cons) | 3218 if (CONSP (p->status)) |
3219 symbol = XCONS (p->status)->car; | 3219 symbol = XCONS (p->status)->car; |
3220 | 3220 |
3221 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) | 3221 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) |
3222 || EQ (symbol, Qclosed)) | 3222 || EQ (symbol, Qclosed)) |
3223 { | 3223 { |