]> git.donarmstrong.com Git - lilypond.git/blob - guile18/libguile/iselect.h
New upstream version 2.19.65
[lilypond.git] / guile18 / 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
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but 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 02110-1301 USA
21  */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 /* Needed for FD_SET on some systems.  */
28 #include <sys/types.h>
29
30 #if SCM_HAVE_SYS_SELECT_H
31 # include <sys/select.h>
32 #endif
33
34 #if SCM_HAVE_WINSOCK2_H
35 # include <winsock2.h>
36 #endif
37
38 #ifdef FD_SET
39
40 #define SELECT_TYPE fd_set
41 #if defined(__INTERIX) && FD_SETSIZE == 4096
42 /* Interix defines FD_SETSIZE 4096 but select rejects that. */
43 #define SELECT_SET_SIZE 1024
44 #else
45 #define SELECT_SET_SIZE FD_SETSIZE
46 #endif
47
48 #else /* no FD_SET */
49
50 /* Define the macros to access a single-int bitmap of descriptors.  */
51 #define SELECT_SET_SIZE 32
52 #define SELECT_TYPE int
53 #define FD_SET(n, p) (*(p) |= (1 << (n)))
54 #define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
55 #define FD_ISSET(n, p) (*(p) & (1 << (n)))
56 #define FD_ZERO(p) (*(p) = 0)
57
58 #endif /* no FD_SET */
59
60 SCM_API int scm_std_select (int fds,
61                             SELECT_TYPE *rfds,
62                             SELECT_TYPE *wfds,
63                             SELECT_TYPE *efds,
64                             struct timeval *timeout);
65
66 #endif  /* SCM_ISELECT_H */
67
68 /*
69   Local Variables:
70   c-file-style: "gnu"
71   End:
72 */