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