Mercurial > hg > xemacs-beta
comparison src/process.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 966663fcf606 |
children | 90d73dddcdc4 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
66 | 66 |
67 /* a process object is a network connection when its pid field a cons | 67 /* a process object is a network connection when its pid field a cons |
68 (name of name of port we are connected to . foreign host name) */ | 68 (name of name of port we are connected to . foreign host name) */ |
69 | 69 |
70 /* Valid values of process->status_symbol */ | 70 /* Valid values of process->status_symbol */ |
71 Lisp_Object Qrun, Qstop; /* Qexit from eval.c, Qsignal from data.c. */ | 71 Lisp_Object Qrun, Qstop; |
72 /* Qrun => Qopen, Qexit => Qclosed for "network connection" processes */ | 72 /* Qrun => Qopen, Qexit => Qclosed for "network connection" processes */ |
73 Lisp_Object Qopen, Qclosed; | 73 Lisp_Object Qopen, Qclosed; |
74 /* Protocol families */ | 74 /* Protocol families */ |
75 Lisp_Object Qtcpip; | 75 Lisp_Object Qtcpip; |
76 | 76 |
103 | 103 |
104 /* List of process objects. */ | 104 /* List of process objects. */ |
105 Lisp_Object Vprocess_list; | 105 Lisp_Object Vprocess_list; |
106 | 106 |
107 | 107 |
108 static Lisp_Object mark_process (Lisp_Object, void (*) (Lisp_Object)); | |
109 static void print_process (Lisp_Object, Lisp_Object, int); | |
110 static void finalize_process (void *, int); | |
111 DEFINE_LRECORD_IMPLEMENTATION ("process", process, | |
112 mark_process, print_process, finalize_process, | |
113 0, 0, struct Lisp_Process); | |
114 | 108 |
115 static Lisp_Object | 109 static Lisp_Object |
116 mark_process (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 110 mark_process (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
117 { | 111 { |
118 struct Lisp_Process *proc = XPROCESS (obj); | 112 struct Lisp_Process *proc = XPROCESS (obj); |
184 if (!for_disksave) | 178 if (!for_disksave) |
185 xfree (p->process_data); | 179 xfree (p->process_data); |
186 } | 180 } |
187 } | 181 } |
188 | 182 |
183 DEFINE_LRECORD_IMPLEMENTATION ("process", process, | |
184 mark_process, print_process, finalize_process, | |
185 0, 0, struct Lisp_Process); | |
189 | 186 |
190 /************************************************************************/ | 187 /************************************************************************/ |
191 /* basic process accessors */ | 188 /* basic process accessors */ |
192 /************************************************************************/ | 189 /************************************************************************/ |
193 | 190 |
469 &p->pipe_instream, &p->pipe_outstream, | 466 &p->pipe_instream, &p->pipe_outstream, |
470 flags); | 467 flags); |
471 | 468 |
472 if (usid == USID_ERROR) | 469 if (usid == USID_ERROR) |
473 report_file_error ("Setting up communication with subprocess", Qnil); | 470 report_file_error ("Setting up communication with subprocess", Qnil); |
474 | 471 |
475 if (usid != USID_DONTHASH) | 472 if (usid != USID_DONTHASH) |
476 { | 473 { |
477 Lisp_Object proc = Qnil; | 474 Lisp_Object proc = Qnil; |
478 XSETPROCESS (proc, p); | 475 XSETPROCESS (proc, p); |
479 puthash ((CONST void*)usid, LISP_TO_VOID (proc), usid_to_process); | 476 puthash ((CONST void*)usid, LISP_TO_VOID (proc), usid_to_process); |
655 It must accept a property list describing the connection. The current | 652 It must accept a property list describing the connection. The current |
656 functions must then go to lisp and provide a suitable list for the | 653 functions must then go to lisp and provide a suitable list for the |
657 generalized connection function. | 654 generalized connection function. |
658 | 655 |
659 Both UNIX ans Win32 support BSD sockets, and there are many extensions | 656 Both UNIX ans Win32 support BSD sockets, and there are many extensions |
660 availalble (Sockets 2 spec). | 657 availalble (Sockets 2 spec). |
661 | 658 |
662 A todo is define a consistent set of properties abstracting a | 659 A todo is define a consistent set of properties abstracting a |
663 network connection. -kkm | 660 network connection. -kkm |
664 */ | 661 */ |
665 | 662 |
683 with any buffer. | 680 with any buffer. |
684 Third arg is name of the host to connect to, or its IP address. | 681 Third arg is name of the host to connect to, or its IP address. |
685 Fourth arg SERVICE is name of the service desired, or an integer | 682 Fourth arg SERVICE is name of the service desired, or an integer |
686 specifying a port number to connect to. | 683 specifying a port number to connect to. |
687 Fifth argument FAMILY is a protocol family. When omitted, 'tcp/ip | 684 Fifth argument FAMILY is a protocol family. When omitted, 'tcp/ip |
688 (Internet protocol family TCP/IP) is assumed. | 685 \(Internet protocol family TCP/IP) is assumed. |
689 */ | 686 */ |
690 (name, buffer, host, service, family)) | 687 (name, buffer, host, service, family)) |
691 { | 688 { |
692 /* !!#### This function has not been Mule-ized */ | 689 /* !!#### This function has not been Mule-ized */ |
693 /* This function can GC */ | 690 /* This function can GC */ |
705 | 702 |
706 /* Since this code is inside HAVE_SOCKETS, existence of | 703 /* Since this code is inside HAVE_SOCKETS, existence of |
707 open_network_stream is mandatory */ | 704 open_network_stream is mandatory */ |
708 PROCMETH (open_network_stream, (name, host, service, family, | 705 PROCMETH (open_network_stream, (name, host, service, family, |
709 &inch, &outch)); | 706 &inch, &outch)); |
710 | 707 |
711 if (!NILP (buffer)) | 708 if (!NILP (buffer)) |
712 buffer = Fget_buffer_create (buffer); | 709 buffer = Fget_buffer_create (buffer); |
713 proc = make_process_internal (name); | 710 proc = make_process_internal (name); |
714 NGCPRO1 (proc); | 711 NGCPRO1 (proc); |
715 | 712 |
754 | 751 |
755 /* Since this code is inside HAVE_MULTICAST, existence of | 752 /* Since this code is inside HAVE_MULTICAST, existence of |
756 open_network_stream is mandatory */ | 753 open_network_stream is mandatory */ |
757 PROCMETH (open_multicast_group, (name, dest, port, ttl, | 754 PROCMETH (open_multicast_group, (name, dest, port, ttl, |
758 &inch, &outch)); | 755 &inch, &outch)); |
759 | 756 |
760 if (!NILP (buffer)) | 757 if (!NILP (buffer)) |
761 buffer = Fget_buffer_create (buffer); | 758 buffer = Fget_buffer_create (buffer); |
762 | 759 |
763 proc = make_process_internal (name); | 760 proc = make_process_internal (name); |
764 GCPRO1 (proc); | 761 GCPRO1 (proc); |
765 | 762 |
766 XPROCESS (proc)->pid = Fcons (port, dest); | 763 XPROCESS (proc)->pid = Fcons (port, dest); |
767 XPROCESS (proc)->buffer = buffer; | 764 XPROCESS (proc)->buffer = buffer; |
768 init_process_io_handles (XPROCESS (proc), (void*)inch, (void*)outch, 0); | 765 init_process_io_handles (XPROCESS (proc), (void*)inch, (void*)outch, 0); |
769 | 766 |
770 event_stream_select_process (XPROCESS (proc)); | 767 event_stream_select_process (XPROCESS (proc)); |
771 | 768 |
772 UNGCPRO; | 769 UNGCPRO; |
773 return proc; | 770 return proc; |
774 } | 771 } |
775 #endif /* HAVE_MULTICAST */ | 772 #endif /* HAVE_MULTICAST */ |
776 | 773 |
1927 syms_of_process (void) | 1924 syms_of_process (void) |
1928 { | 1925 { |
1929 defsymbol (&Qprocessp, "processp"); | 1926 defsymbol (&Qprocessp, "processp"); |
1930 defsymbol (&Qrun, "run"); | 1927 defsymbol (&Qrun, "run"); |
1931 defsymbol (&Qstop, "stop"); | 1928 defsymbol (&Qstop, "stop"); |
1932 defsymbol (&Qsignal, "signal"); | |
1933 /* Qexit is already defined by syms_of_eval | |
1934 * defsymbol (&Qexit, "exit"); | |
1935 */ | |
1936 defsymbol (&Qopen, "open"); | 1929 defsymbol (&Qopen, "open"); |
1937 defsymbol (&Qclosed, "closed"); | 1930 defsymbol (&Qclosed, "closed"); |
1938 | 1931 |
1939 defsymbol (&Qtcpip, "tcp/ip"); | 1932 defsymbol (&Qtcpip, "tcp/ip"); |
1940 | 1933 |