Mercurial > hg > xemacs-beta
comparison src/process.c @ 136:b980b6286996 r20-2b2
Import from CVS: tag r20-2b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:31:12 +0200 |
parents | cca96a509cfe |
children | 538048ae2ab8 |
comparison
equal
deleted
inserted
replaced
135:4636a6841cd6 | 136:b980b6286996 |
---|---|
442 current buffer. */ | 442 current buffer. */ |
443 | 443 |
444 static Lisp_Object | 444 static Lisp_Object |
445 get_process (Lisp_Object name) | 445 get_process (Lisp_Object name) |
446 { | 446 { |
447 Lisp_Object proc; | 447 Lisp_Object proc, obj; |
448 | 448 |
449 #ifdef I18N3 | 449 #ifdef I18N3 |
450 /* #### Look more closely into translating process names. */ | 450 /* #### Look more closely into translating process names. */ |
451 #endif | 451 #endif |
452 | 452 |
453 /* This may be called during a GC from process_send_signal() from | 453 /* This may be called during a GC from process_send_signal() from |
454 kill_buffer_processes() if emacs decides to abort(). */ | 454 kill_buffer_processes() if emacs decides to abort(). */ |
455 if (GC_PROCESSP (name)) | 455 if (GC_PROCESSP (name)) |
456 return name; | 456 return name; |
457 | 457 |
458 if (GC_NILP (name)) | 458 if (GC_STRINGP (name)) |
459 proc = Fget_buffer_process (Fcurrent_buffer ()); | 459 { |
460 obj = Fget_process (name); | |
461 if (GC_NILP (obj)) | |
462 obj = Fget_buffer (name); | |
463 if (GC_NILP (obj)) | |
464 error ("Process %s does not exist", XSTRING_DATA (name)); | |
465 } | |
466 else if (GC_NILP (name)) | |
467 obj = Fcurrent_buffer (); | |
460 else | 468 else |
461 { | 469 obj = name; |
462 proc = Fget_process (name); | 470 |
471 /* Now obj should be either a buffer object or a process object. | |
472 */ | |
473 if (GC_BUFFERP (obj)) | |
474 { | |
475 proc = Fget_buffer_process (obj); | |
463 if (GC_NILP (proc)) | 476 if (GC_NILP (proc)) |
464 proc = Fget_buffer_process (Fget_buffer (name)); | 477 error ("Buffer %s has no process", XSTRING_DATA (XBUFFER(obj)->name)); |
465 } | 478 } |
466 | |
467 if (!GC_NILP (proc)) | |
468 return proc; | |
469 | |
470 if (GC_NILP (name)) | |
471 error ("Current buffer has no process"); | |
472 else | 479 else |
473 error ("Process %s does not exist", XSTRING_DATA (name)); | 480 { |
474 /* NOTREACHED */ | 481 /* fsf: CHECK_PROCESS (obj, 0); */ |
475 return Qnil; /* warning suppression */ | 482 proc = obj; |
483 } | |
484 return proc; | |
476 } | 485 } |
477 | 486 |
478 DEFUN ("process-id", Fprocess_id, 1, 1, 0, /* | 487 DEFUN ("process-id", Fprocess_id, 1, 1, 0, /* |
479 Return the process id of PROCESS. | 488 Return the process id of PROCESS. |
480 This is the pid of the Unix process which PROCESS uses or talks to. | 489 This is the pid of the Unix process which PROCESS uses or talks to. |