/[gcl]/gcl/o/sockets.c
ViewVC logotype

Diff of /gcl/o/sockets.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mjthomas, Fri Jun 7 03:12:10 2002 UTC revision 1.4 by camm, Sat Jul 20 07:10:56 2002 UTC
# Line 99  int w32_socket_exit(void) Line 99  int w32_socket_exit(void)
99  #define BIND_ADDRESS_INCREMENT  16  #define BIND_ADDRESS_INCREMENT  16
100  #define BIND_INITIAL_ADDRESS    5000  #define BIND_INITIAL_ADDRESS    5000
101  #define BIND_LAST_ADDRESS       65534  #define BIND_LAST_ADDRESS       65534
102  static iLastAddressUsed = BIND_INITIAL_ADDRESS;  static unsigned int iLastAddressUsed = BIND_INITIAL_ADDRESS;
103    
104  DEFUN("OPEN-NAMED-SOCKET",object,fSopen_named_socket,SI,1,1,NONE,OI,OO,OO,OO,  DEFUN("OPEN-NAMED-SOCKET",object,fSopen_named_socket,SI,1,1,NONE,OI,OO,OO,OO,
105  "Open a socket on PORT and return (cons fd portname) where file \  "Open a socket on PORT and return (cons fd portname) where file \
# Line 248  sock_hostname_to_hostid_list(host_name) Line 248  sock_hostname_to_hostid_list(host_name)
248                
249    
250  DEFUN("HOSTNAME-TO-HOSTID",object,fShostname_to_hostid,SI,1,1,  DEFUN("HOSTNAME-TO-HOSTID",object,fShostname_to_hostid,SI,1,1,
251        NONE,OO,OO,OO,OO,"")(host)        NONE,OO,OO,OO,OO,"")(object host)
252  {  {
253    struct hostent *h;    struct hostent *h;
254    char buf[300];    char buf[300];
# Line 308  sock_get_name(s) Line 308  sock_get_name(s)
308  #include "comm.c"  #include "comm.c"
309    
310    
311  DEFUN("CONNECTION-STATE-FD",int,fSconnection_state_fd,SI,1,1,NONE,IO,OO,OO,OO,"") (sfd)  DEFUN("CONNECTION-STATE-FD",object,fSconnection_state_fd,SI,1,1,NONE,OO,OO,OO,OO,"") (sfd)
312       object sfd;       object sfd;
313  { return OBJ_TO_CONNECTION_STATE(sfd)->fd;  { return make_fixnum(OBJ_TO_CONNECTION_STATE(sfd)->fd);
314  }  }
315            
316  DEFUN("OUR-WRITE",int,fSour_write,SI,3,3,NONE,IO,OI,OO,OO,"")  DEFUN("OUR-WRITE",object,fSour_write,SI,3,3,NONE,OO,OI,OO,OO,"")
317       (sfd,buffer,nbytes)       (sfd,buffer,nbytes)
318       object buffer;       object buffer;
319       object sfd;       object sfd;
320       int nbytes;       int nbytes;
321  { return write1(OBJ_TO_CONNECTION_STATE(sfd),buffer->ust.ust_self,nbytes);  { return make_fixnum(write1(OBJ_TO_CONNECTION_STATE(sfd),buffer->ust.ust_self,nbytes));
322  }  }
323    
324  DEFUN("OUR-READ-WITH-OFFSET",int,fSour_read_with_offset,SI,5,5,NONE,  DEFUN("OUR-READ-WITH-OFFSET",object,fSour_read_with_offset,SI,5,5,NONE,
325        IO,OI,II,OO,        OO,OI,II,OO,
326        "Read from STATE-FD into string BUFFER putting data at OFFSET and reading NBYTES, waiting for TIMEOUT before failing")        "Read from STATE-FD into string BUFFER putting data at OFFSET and reading NBYTES, waiting for TIMEOUT before failing")
327       (fd,buffer,offset,nbytes,timeout)       (fd,buffer,offset,nbytes,timeout)
328       int offset,nbytes,timeout;       int offset,nbytes,timeout;
329       object buffer,fd;       object buffer,fd;
330  { return read1(OBJ_TO_CONNECTION_STATE(fd),&((buffer)->ust.ust_self[offset]),nbytes,timeout);  { return make_fixnum(read1(OBJ_TO_CONNECTION_STATE(fd),&((buffer)->ust.ust_self[offset]),nbytes,timeout));
331  }  }
332    
333    
# Line 355  enum print_arglist_codes { Line 355  enum print_arglist_codes {
355  #define BEGIN_QUOTE '"'  #define BEGIN_QUOTE '"'
356  #define END_QUOTE '"'  #define END_QUOTE '"'
357    
358  static needs_quoting[256];  static int needs_quoting[256];
359    
360  DEFUN("PRINT-TO-STRING1",object,fSprint_to_string1,SI,3,3,NONE,OO,OO,OO,OO,  DEFUN("PRINT-TO-STRING1",object,fSprint_to_string1,SI,3,3,NONE,OO,OO,OO,OO,
361        "Print to STRING the object X according to CODE.   The string must have \        "Print to STRING the object X according to CODE.   The string must have \
# Line 438  object the_code; Line 438  object the_code;
438       while (--len>=0)       while (--len>=0)
439         { char c = *p++;         { char c = *p++;
440           c=tolower(c);           c=tolower(c);
441           if(needs_quoting[c])           if(needs_quoting[(unsigned char)c])
442             PUSH('\\');             PUSH('\\');
443           PUSH(c);}           PUSH(c);}
444       else       else
445         while (--len>=0)         while (--len>=0)
446         { char c = *p++;         { char c = *p++;
447           if(needs_quoting[c])           if(needs_quoting[(unsigned char)c])
448             PUSH('\\');               PUSH('\\');  
449           PUSH(c);}}           PUSH(c);}}
450     break;     break;
451     case t_fixnum:     case t_fixnum:
452       sprintf(buf,"%d",fix(x));       sprintf(buf,"%ld",fix(x));
453       p = buf;       p = buf;
454       while(*p) {PUSH(*p);p++;}       while(*p) {PUSH(*p);p++;}
455       break;       break;
# Line 488  not_defined_for_os() Line 488  not_defined_for_os()
488  DEFUN("SET-SIGIO-FOR-FD",object,fSset_sigio_for_fd,SI,1,1,NONE,OI,OO,OO,OO,"")  DEFUN("SET-SIGIO-FOR-FD",object,fSset_sigio_for_fd,SI,1,1,NONE,OI,OO,OO,OO,"")
489       (fd)       (fd)
490       int fd;       int fd;
491  { int flags;  {
492    /* for the moment we will use SIGUSR1 to notify, instead of depending on SIGIO,    /* for the moment we will use SIGUSR1 to notify, instead of depending on SIGIO,
493       since LINUX does not support the latter yet...       since LINUX does not support the latter yet...
494       So right  now this does nothing...       So right  now this does nothing...
# Line 527  and positioning the ouput/input to start Line 527  and positioning the ouput/input to start
527    return strm;    return strm;
528  }  }
529    
530  DEFUN("CHECK-STATE-INPUT",int ,fScheck_state_input,SI,2,2,NONE,IO,IO,OO,OO,  DEFUN("CHECK-STATE-INPUT",object,fScheck_state_input,SI,2,2,NONE,OO,IO,OO,OO,
531        "") (osfd,timeout)        "") (osfd,timeout)
532       object osfd;       object osfd;
533       int timeout;       int timeout;
# Line 536  DEFUN("CHECK-STATE-INPUT",int ,fScheck_s Line 536  DEFUN("CHECK-STATE-INPUT",int ,fScheck_s
536    
537  }  }
538    
539  DEFUN("CLEAR-CONNECTION-STATE",int,fSclear_connection_state,  DEFUN("CLEAR-CONNECTION-STATE",object,fSclear_connection_state,
540        SI,1,1,NONE,IO,OO,OO,OO,        SI,1,1,NONE,OO,OO,OO,OO,
541        "Read on FD until nothing left to read.  Return number of bytes read")        "Read on FD until nothing left to read.  Return number of bytes read")
542       (osfd)       (osfd)
543       object osfd;       object osfd;
544  {  {
545    struct connection_state *sfd = OBJ_TO_CONNECTION_STATE(osfd);    struct connection_state *sfd = OBJ_TO_CONNECTION_STATE(osfd);
546   int n=fSclear_connection(sfd->fd);;    int n=fix(fSclear_connection(sfd->fd));
547        
548    sfd->valid_data = sfd->read_buffer;    sfd->valid_data = sfd->read_buffer;
549    sfd->valid_data_size = 0;    sfd->valid_data_size = 0;
550    sfd->bytes_received_not_confirmed += n;    sfd->bytes_received_not_confirmed += n;
551   return n;   return make_fixnum(n);
552  }  }
553    
554  #endif  #endif

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26