emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/process.c


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/src/process.c
Date: Thu, 21 Mar 2002 07:20:24 -0500

Index: emacs/src/process.c
diff -c emacs/src/process.c:1.361 emacs/src/process.c:1.362
*** emacs/src/process.c:1.361   Wed Mar 20 15:37:41 2002
--- emacs/src/process.c Thu Mar 21 07:20:24 2002
***************
*** 125,135 ****
  Lisp_Object Qprocessp;
  Lisp_Object Qrun, Qstop, Qsignal;
  Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
! Lisp_Object Qlocal;
! Lisp_Object QCname, QCbuffer, QChost, QCservice;
  Lisp_Object QClocal, QCremote, QCcoding;
! Lisp_Object QCserver, QCdatagram, QCnowait, QCnoquery, QCstop;
! Lisp_Object QCsentinel, QClog, QCoptions, QCfeature;
  Lisp_Object Qlast_nonmenu_event;
  /* QCfamily is declared and initialized in xfaces.c,
     QCfilter in keyboard.c.  */
--- 125,135 ----
  Lisp_Object Qprocessp;
  Lisp_Object Qrun, Qstop, Qsignal;
  Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
! Lisp_Object Qlocal, Qdatagram;
! Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
  Lisp_Object QClocal, QCremote, QCcoding;
! Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
! Lisp_Object QCsentinel, QClog, QCoptions;
  Lisp_Object Qlast_nonmenu_event;
  /* QCfamily is declared and initialized in xfaces.c,
     QCfilter in keyboard.c.  */
***************
*** 2380,2473 ****
    return process;
  }
  
- /* Check whether a given KEY VALUE pair is supported on this system.  */
- 
- static int
- network_process_featurep (key, value)
-        Lisp_Object key, value;
- {
- 
-   if (EQ (key, QCnowait))
-     {
- #ifdef NON_BLOCKING_CONNECT
-       return 1;
- #else
-       return NILP (value);
- #endif
-     }
- 
-   if (EQ (key, QCdatagram))
-     {
- #ifdef DATAGRAM_SOCKETS
-       return 1;
- #else
-       return NILP (value);
- #endif
-     }
- 
-   if (EQ (key, QCfamily))
-     {
-       if (NILP (value))
-       return 1;
- #ifdef HAVE_LOCAL_SOCKETS
-       if (EQ (key, Qlocal))
-       return 1;
- #endif
-       return 0;
-     }
- 
-   if (EQ (key, QCname))
-     return STRINGP (value);
- 
-   if (EQ (key, QCbuffer))
-     return (NILP (value) || STRINGP (value) || BUFFERP (value));
- 
-   if (EQ (key, QClocal) || EQ (key, QCremote))
-     {
-       int family;
-       return get_lisp_to_sockaddr_size (value, &family);
-     }
- 
-   if (EQ (key, QChost))
-     return (NILP (value) || STRINGP (value));
- 
-   if (EQ (key, QCservice))
-     {
- #ifdef HAVE_GETSOCKNAME
-       if (EQ (value, Qt))
-       return 1;
- #endif
-       return (INTEGERP (value) || STRINGP (value));
-     }
- 
-   if (EQ (key, QCserver))
-     {
- #ifndef TERM
-       return 1;
- #else
-       return NILP (value);
- #endif
-     }
- 
-   if (EQ (key, QCoptions))
-     return set_socket_options (-1, value, 0);
- 
-   if (EQ (key, QCcoding))
-     return 1;
-   if (EQ (key, QCsentinel))
-     return 1;
-   if (EQ (key, QCfilter))
-     return 1;
-   if (EQ (key, QClog))
-     return 1;
-   if (EQ (key, QCnoquery))
-     return 1;
-   if (EQ (key, QCstop))
-     return 1;
- 
-   return 0;
- }
- 
  /* A version of request_sigio suitable for a record_unwind_protect.  */
  
  Lisp_Object
--- 2380,2385 ----
***************
*** 2516,2521 ****
--- 2428,2436 ----
  integer specifying a port number to connect to.  If SERVICE is t,
  a random port number is selected for the server.
  
+ :type TYPE -- TYPE is the type of connection.  The default (nil) is a
+ stream type connection, `datagram' creates a datagram type connection.
+ 
  :family FAMILY -- FAMILY is the address (and protocol) family for the
  service specified by HOST and SERVICE.  The default address family is
  Inet (or IPv4) for the host and port number specified by HOST and
***************
*** 2545,2553 ****
  
  :coding CODING -- CODING is coding system for this process.
  
- :datagram BOOL -- Create a datagram type connection if BOOL is
- non-nil.  Default is a stream type connection.
- 
  :options OPTIONS -- Set the specified options for the network process.
  See `set-process-options' for details.
  
--- 2460,2465 ----
***************
*** 2600,2609 ****
  of the accepted (and failed) connections may be recorded in the server
  process' buffer.
  
- The following special call returns t iff a given KEY VALUE
- pair is supported on this system:
-   (make-network-process :feature KEY VALUE)
- 
  usage: (make-network-process &rest ARGS)  */)
       (nargs, args)
       int nargs;
--- 2512,2517 ----
***************
*** 2645,2664 ****
    Lisp_Object filter, sentinel;
    int is_non_blocking_client = 0;
    int is_server = 0;
!   int socktype = SOCK_STREAM;
    int family = -1;
  
    if (nargs == 0)
      return Qnil;
  
-   /* Handle :feature KEY VALUE query.  */
-   if (EQ (args[0], QCfeature))
-     {
-       if (nargs != 3)
-       return Qnil;
-       return network_process_featurep (args[1], args[2]) ? Qt : Qnil;
-     }
- 
    /* Save arguments for process-contact and clone-process.  */
    contact = Flist (nargs, args);
    GCPRO1 (contact);
--- 2553,2564 ----
    Lisp_Object filter, sentinel;
    int is_non_blocking_client = 0;
    int is_server = 0;
!   int socktype;
    int family = -1;
  
    if (nargs == 0)
      return Qnil;
  
    /* Save arguments for process-contact and clone-process.  */
    contact = Flist (nargs, args);
    GCPRO1 (contact);
***************
*** 2668,2683 ****
    init_winsock (TRUE);
  #endif
  
!   /* :datagram BOOL */
!   tem = Fplist_get (contact, QCdatagram);
!   if (!NILP (tem))
!     {
! #ifndef DATAGRAM_SOCKETS
!       error ("Datagram connections not supported");
! #else
!       socktype = SOCK_DGRAM;
  #endif
!     }
  
    /* :server BOOL */
    tem = Fplist_get (contact, QCserver);
--- 2568,2583 ----
    init_winsock (TRUE);
  #endif
  
!   /* :type TYPE  (nil: stream, datagram */
!   tem = Fplist_get (contact, QCtype);
!   if (NILP (tem))
!     socktype = SOCK_STREAM;
! #ifdef DATAGRAM_SOCKETS
!   else if (EQ (tem, Qdatagram))
!     socktype = SOCK_DGRAM;
  #endif
!   else
!     error ("Unsupported connection type");
  
    /* :server BOOL */
    tem = Fplist_get (contact, QCserver);
***************
*** 6111,6116 ****
--- 6011,6017 ----
  init_process ()
  {
    register int i;
+   Lisp_Object subfeatures;
  
  #ifdef SIGCHLD
  #ifndef CANNOT_DUMP
***************
*** 6137,6142 ****
--- 6038,6088 ----
  #ifdef DATAGRAM_SOCKETS
    bzero (datagram_address, sizeof datagram_address);
  #endif
+ 
+ #define ADD_SUBFEATURE(key, val) \
+   subfeatures = Fcons (Fcons (key, Fcons (val, Qnil)), subfeatures)
+ 
+   subfeatures = Qnil;
+ #ifdef NON_BLOCKING_CONNECT
+   ADD_SUBFEATURE (QCnowait, Qt);
+ #endif
+ #ifdef DATAGRAM_SOCKETS
+   ADD_SUBFEATURE (QCtype, Qdatagram);
+ #endif
+ #ifdef HAVE_LOCAL_SOCKETS
+   ADD_SUBFEATURE (QCfamily, Qlocal);
+ #endif
+ #ifdef HAVE_GETSOCKNAME
+   ADD_SUBFEATURE (QCservice, Qt);
+ #endif
+ #ifndef TERM
+   ADD_SUBFEATURE (QCserver, Qt);
+ #endif
+ #ifdef SO_BINDTODEVICE
+   ADD_SUBFEATURE (QCoptions, intern ("bindtodevice"));
+ #endif
+ #ifdef SO_BROADCAST
+   ADD_SUBFEATURE (QCoptions, intern ("broadcast"));
+ #endif
+ #ifdef SO_DONTROUTE
+   ADD_SUBFEATURE (QCoptions, intern ("dontroute"));
+ #endif
+ #ifdef SO_KEEPALIVE
+   ADD_SUBFEATURE (QCoptions, intern ("keepalive"));
+ #endif
+ #ifdef SO_LINGER
+   ADD_SUBFEATURE (QCoptions, intern ("linger"));
+ #endif
+ #ifdef SO_OOBINLINE
+   ADD_SUBFEATURE (QCoptions, intern ("oobinline"));
+ #endif
+ #ifdef SO_PRIORITY
+   ADD_SUBFEATURE (QCoptions, intern ("priority"));
+ #endif
+ #ifdef SO_REUSEADDR
+   ADD_SUBFEATURE (QCoptions, intern ("reuseaddr"));
+ #endif
+   Fprovide (intern ("make-network-process"), subfeatures);
  }
  
  void
***************
*** 6169,6174 ****
--- 6115,6122 ----
    staticpro (&Qlisten);
    Qlocal = intern ("local");
    staticpro (&Qlocal);
+   Qdatagram = intern ("datagram");
+   staticpro (&Qdatagram);
  
    QCname = intern (":name");
    staticpro (&QCname);
***************
*** 6178,6183 ****
--- 6126,6133 ----
    staticpro (&QChost);
    QCservice = intern (":service");
    staticpro (&QCservice);
+   QCtype = intern (":type");
+   staticpro (&QCtype);
    QClocal = intern (":local");
    staticpro (&QClocal);
    QCremote = intern (":remote");
***************
*** 6186,6193 ****
    staticpro (&QCcoding);
    QCserver = intern (":server");
    staticpro (&QCserver);
-   QCdatagram = intern (":datagram");
-   staticpro (&QCdatagram);
    QCnowait = intern (":nowait");
    staticpro (&QCnowait);
    QCsentinel = intern (":sentinel");
--- 6136,6141 ----
***************
*** 6200,6207 ****
    staticpro (&QCstop);
    QCoptions = intern (":options");
    staticpro (&QCoptions);
-   QCfeature = intern (":feature");
-   staticpro (&QCfeature);
      
    Qlast_nonmenu_event = intern ("last-nonmenu-event");
    staticpro (&Qlast_nonmenu_event);
--- 6148,6153 ----
***************
*** 6291,6296 ****
--- 6237,6244 ----
  extern EMACS_TIME timer_check ();
  extern int timers_run;
  
+ Lisp_Object QCtype;
+ 
  /* As described above, except assuming that there are no subprocesses:
  
     Wait for timeout to elapse and/or keyboard input to be available.
***************
*** 6566,6571 ****
--- 6514,6522 ----
  void
  syms_of_process ()
  {
+   QCtype = intern (":type");
+   staticpro (&QCtype);
+ 
    defsubr (&Sget_buffer_process);
    defsubr (&Sprocess_inherit_coding_system_flag);
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]