iselect.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * 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
  19. * 02110-1301 USA
  20. */
  21. #include "libguile/__scm.h"
  22. /* Needed for FD_SET on some systems. */
  23. #include <sys/types.h>
  24. #if SCM_HAVE_SYS_SELECT_H
  25. # include <sys/select.h>
  26. #endif
  27. #if SCM_HAVE_WINSOCK2_H
  28. # include <winsock2.h>
  29. #endif
  30. #ifdef FD_SET
  31. #define SELECT_TYPE fd_set
  32. #define SELECT_SET_SIZE FD_SETSIZE
  33. #else /* no FD_SET */
  34. /* Define the macros to access a single-int bitmap of descriptors. */
  35. #define SELECT_SET_SIZE 32
  36. #define SELECT_TYPE int
  37. #define FD_SET(n, p) (*(p) |= (1 << (n)))
  38. #define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
  39. #define FD_ISSET(n, p) (*(p) & (1 << (n)))
  40. #define FD_ZERO(p) (*(p) = 0)
  41. #endif /* no FD_SET */
  42. SCM_API int scm_std_select (int fds,
  43. SELECT_TYPE *rfds,
  44. SELECT_TYPE *wfds,
  45. SELECT_TYPE *efds,
  46. struct timeval *timeout);
  47. #endif /* SCM_ISELECT_H */
  48. /*
  49. Local Variables:
  50. c-file-style: "gnu"
  51. End:
  52. */