iselect.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* classes: h_files */
  2. #ifndef SCM_ISELECT_H
  3. #define SCM_ISELECT_H
  4. /* Copyright (C) 1997,1998,2000,2001, 2002, 2006 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libguile/__scm.h"
  21. /* Needed for FD_SET on some systems. */
  22. #include <sys/types.h>
  23. #if SCM_HAVE_SYS_SELECT_H
  24. # include <sys/select.h>
  25. #endif
  26. #if SCM_HAVE_WINSOCK2_H
  27. # include <winsock2.h>
  28. #endif
  29. #ifdef FD_SET
  30. #define SELECT_TYPE fd_set
  31. #define SELECT_SET_SIZE FD_SETSIZE
  32. #else /* no FD_SET */
  33. /* Define the macros to access a single-int bitmap of descriptors. */
  34. #define SELECT_SET_SIZE 32
  35. #define SELECT_TYPE int
  36. #define FD_SET(n, p) (*(p) |= (1 << (n)))
  37. #define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
  38. #define FD_ISSET(n, p) (*(p) & (1 << (n)))
  39. #define FD_ZERO(p) (*(p) = 0)
  40. #endif /* no FD_SET */
  41. SCM_API int scm_std_select (int fds,
  42. SELECT_TYPE *rfds,
  43. SELECT_TYPE *wfds,
  44. SELECT_TYPE *efds,
  45. struct timeval *timeout);
  46. #endif /* SCM_ISELECT_H */
  47. /*
  48. Local Variables:
  49. c-file-style: "gnu"
  50. End:
  51. */