comparison src/process.c @ 863:42375619fa45

[xemacs-hg @ 2002-06-04 06:03:59 by andyp] merge 21.4 windows changes, minimally tested
author andyp
date Tue, 04 Jun 2002 06:05:53 +0000
parents 278c743f1578
children 804517e16990
comparison
equal deleted inserted replaced
862:278c743f1578 863:42375619fa45
61 #include "syssignal.h" 61 #include "syssignal.h"
62 #include "systime.h" 62 #include "systime.h"
63 #include "systty.h" 63 #include "systty.h"
64 #include "syswait.h" 64 #include "syswait.h"
65 65
66 Lisp_Object Qprocessp, Qprocess_live_p; 66 Lisp_Object Qprocessp, Qprocess_live_p, Qprocess_readable_p;
67 67
68 /* Process methods */ 68 /* Process methods */
69 struct process_methods the_process_methods; 69 struct process_methods the_process_methods;
70 70
71 /* a process object is a network connection when its pid field a cons 71 /* a process object is a network connection when its pid field a cons
297 (object)) 297 (object))
298 { 298 {
299 return PROCESSP (object) && PROCESS_LIVE_P (XPROCESS (object)) 299 return PROCESSP (object) && PROCESS_LIVE_P (XPROCESS (object))
300 ? Qt : Qnil; 300 ? Qt : Qnil;
301 } 301 }
302
303 #if 0
304 /* This is a reasonable definition for this new primitive. Kyle sez:
305
306 "The patch looks OK to me except for the creation and exporting of the
307 Fprocess_readable_p function. I don't think a new Lisp function
308 should be created until we know something actually needs it. If
309 we later want to give process-readable-p different semantics it
310 may be hard to do it and stay compatible with what we hastily
311 create today."
312
313 He's right, not yet. Let's discuss the semantics on XEmacs Design
314 before enabling this.
315 */
316 DEFUN ("process-readable-p", Fprocess_readable_p, 1, 1, 0, /*
317 Return t if OBJECT is a process from which input may be available.
318 */
319 (object))
320 {
321 return PROCESSP (object) && PROCESS_READABLE_P (XPROCESS (object))
322 ? Qt : Qnil;
323 }
324 #endif
302 325
303 DEFUN ("process-list", Fprocess_list, 0, 0, 0, /* 326 DEFUN ("process-list", Fprocess_list, 0, 0, 0, /*
304 Return a list of all processes. 327 Return a list of all processes.
305 */ 328 */
306 ()) 329 ())
614 637
615 pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir, 638 pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir,
616 separate_err)); 639 separate_err));
617 640
618 p->pid = make_int (pid); 641 p->pid = make_int (pid);
619 if (PROCESS_LIVE_P (p)) 642 if (PROCESS_READABLE_P (p))
620 event_stream_select_process (p, 1, 1); 643 event_stream_select_process (p, 1, 1);
621 } 644 }
622 645
623 /* This function is the unwind_protect form for Fstart_process_internal. If 646 /* This function is the unwind_protect form for Fstart_process_internal. If
624 PROCESS doesn't have its pid set, then we know someone has signalled 647 PROCESS doesn't have its pid set, then we know someone has signalled
1042 calls set the filter to t, we have to stop now. Return -1 rather 1065 calls set the filter to t, we have to stop now. Return -1 rather
1043 than 0 so execute_internal_event() doesn't close the process. 1066 than 0 so execute_internal_event() doesn't close the process.
1044 Really, the loop in execute_internal_event() should check itself 1067 Really, the loop in execute_internal_event() should check itself
1045 for a process-filter change, like in status_notify(); but the 1068 for a process-filter change, like in status_notify(); but the
1046 struct Lisp_Process is not exported outside of this file. */ 1069 struct Lisp_Process is not exported outside of this file. */
1047 if (!PROCESS_LIVE_P (p)) 1070 if (!PROCESS_READABLE_P (p))
1048 { 1071 {
1049 errno = 0; 1072 errno = 0;
1050 return -1; /* already closed */ 1073 return -1; /* already closed */
1051 } 1074 }
1052 1075
1272 int filter_does_read, int set_stderr) 1295 int filter_does_read, int set_stderr)
1273 { 1296 {
1274 CHECK_PROCESS (process); 1297 CHECK_PROCESS (process);
1275 if (set_stderr && !XPROCESS (process)->separate_stderr) 1298 if (set_stderr && !XPROCESS (process)->separate_stderr)
1276 invalid_change ("stdout and stderr not separate", process); 1299 invalid_change ("stdout and stderr not separate", process);
1277 if (PROCESS_LIVE_P (XPROCESS (process))) 1300 if (PROCESS_READABLE_P (XPROCESS (process)))
1278 { 1301 {
1279 if (EQ (filter, Qt)) 1302 if (EQ (filter, Qt))
1280 event_stream_unselect_process (XPROCESS (process), !set_stderr, 1303 event_stream_unselect_process (XPROCESS (process), !set_stderr,
1281 set_stderr); 1304 set_stderr);
1282 else 1305 else
1395 Return PROCESS's input coding system. 1418 Return PROCESS's input coding system.
1396 */ 1419 */
1397 (process)) 1420 (process))
1398 { 1421 {
1399 process = get_process (process); 1422 process = get_process (process);
1400 CHECK_LIVE_PROCESS (process); 1423 CHECK_READABLE_PROCESS (process);
1401 return (coding_stream_detected_coding_system 1424 return (coding_stream_detected_coding_system
1402 (XLSTREAM (XPROCESS (process)->coding_instream))); 1425 (XLSTREAM (XPROCESS (process)->coding_instream)));
1403 } 1426 }
1404 1427
1405 DEFUN ("process-output-coding-system", Fprocess_output_coding_system, 1, 1, 0, /* 1428 DEFUN ("process-output-coding-system", Fprocess_output_coding_system, 1, 1, 0, /*
1417 Return a pair of coding-system for decoding and encoding of PROCESS. 1440 Return a pair of coding-system for decoding and encoding of PROCESS.
1418 */ 1441 */
1419 (process)) 1442 (process))
1420 { 1443 {
1421 process = get_process (process); 1444 process = get_process (process);
1422 CHECK_LIVE_PROCESS (process); 1445 CHECK_READABLE_PROCESS (process);
1423 return Fcons (coding_stream_detected_coding_system 1446 return Fcons (coding_stream_detected_coding_system
1424 (XLSTREAM (XPROCESS (process)->coding_instream)), 1447 (XLSTREAM (XPROCESS (process)->coding_instream)),
1425 coding_stream_coding_system 1448 coding_stream_coding_system
1426 (XLSTREAM (XPROCESS (process)->coding_outstream))); 1449 (XLSTREAM (XPROCESS (process)->coding_outstream)));
1427 } 1450 }
1433 */ 1456 */
1434 (process, codesys)) 1457 (process, codesys))
1435 { 1458 {
1436 codesys = get_coding_system_for_text_file (codesys, 1); 1459 codesys = get_coding_system_for_text_file (codesys, 1);
1437 process = get_process (process); 1460 process = get_process (process);
1438 CHECK_LIVE_PROCESS (process); 1461 CHECK_READABLE_PROCESS (process);
1439 1462
1440 set_coding_stream_coding_system 1463 set_coding_stream_coding_system
1441 (XLSTREAM (XPROCESS (process)->coding_instream), codesys); 1464 (XLSTREAM (XPROCESS (process)->coding_instream), codesys);
1442 return Qnil; 1465 return Qnil;
1443 } 1466 }
2494 DEFSYMBOL (Qprocess_live_p); 2517 DEFSYMBOL (Qprocess_live_p);
2495 DEFSYMBOL (Qrun); 2518 DEFSYMBOL (Qrun);
2496 DEFSYMBOL (Qstop); 2519 DEFSYMBOL (Qstop);
2497 DEFSYMBOL (Qopen); 2520 DEFSYMBOL (Qopen);
2498 DEFSYMBOL (Qclosed); 2521 DEFSYMBOL (Qclosed);
2499 2522 #if 0
2523 /* see comment at Fprocess_readable_p */
2524 DEFSYMBOL (&Qprocess_readable_p);
2525 #endif
2500 DEFSYMBOL (Qtcp); 2526 DEFSYMBOL (Qtcp);
2501 DEFSYMBOL (Qudp); 2527 DEFSYMBOL (Qudp);
2502 2528
2503 #ifdef HAVE_MULTICAST 2529 #ifdef HAVE_MULTICAST
2504 DEFSYMBOL (Qmulticast); /* Used for occasional warnings */ 2530 DEFSYMBOL (Qmulticast); /* Used for occasional warnings */
2507 DEFERROR_STANDARD (Qprocess_error, Qio_error); 2533 DEFERROR_STANDARD (Qprocess_error, Qio_error);
2508 DEFERROR_STANDARD (Qnetwork_error, Qio_error); 2534 DEFERROR_STANDARD (Qnetwork_error, Qio_error);
2509 2535
2510 DEFSUBR (Fprocessp); 2536 DEFSUBR (Fprocessp);
2511 DEFSUBR (Fprocess_live_p); 2537 DEFSUBR (Fprocess_live_p);
2538 #if 0
2539 /* see comment at Fprocess_readable_p */
2540 DEFSUBR (Fprocess_readable_p);
2541 #endif
2512 DEFSUBR (Fget_process); 2542 DEFSUBR (Fget_process);
2513 DEFSUBR (Fget_buffer_process); 2543 DEFSUBR (Fget_buffer_process);
2514 DEFSUBR (Fdelete_process); 2544 DEFSUBR (Fdelete_process);
2515 DEFSUBR (Fprocess_status); 2545 DEFSUBR (Fprocess_status);
2516 DEFSUBR (Fprocess_exit_status); 2546 DEFSUBR (Fprocess_exit_status);