The 0.5 release happened on 2/15, not on 2/14. :-)
[python/dscho.git] / Include / myselect.h
blob1b3a8348736472f41888f4e2c8d65c44fc132646
1 #ifndef Py_MYSELECT_H
2 #define Py_MYSELECT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
9 The Netherlands.
11 All Rights Reserved
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI or Corporation for National Research Initiatives or
19 CNRI not be used in advertising or publicity pertaining to
20 distribution of the software without specific, written prior
21 permission.
23 While CWI is the initial source for this software, a modified version
24 is made available by the Corporation for National Research Initiatives
25 (CNRI) at the Internet address ftp://ftp.python.org.
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34 PERFORMANCE OF THIS SOFTWARE.
36 ******************************************************************/
38 /* Include file for users of select() */
40 /* NB caller must include <sys/types.h> */
42 #ifdef HAVE_SYS_SELECT_H
44 #ifdef SYS_SELECT_WITH_SYS_TIME
45 #include "mytime.h"
46 #else /* !SYS_SELECT_WITH_SYS_TIME */
47 #include <time.h>
48 #endif /* !SYS_SELECT_WITH_SYS_TIME */
50 #include <sys/select.h>
52 #else /* !HAVE_SYS_SELECT_H */
54 #ifdef USE_GUSI
55 /* If we don't have sys/select the definition may be in unistd.h */
56 #include <GUSI.h>
57 #endif
59 #include "mytime.h"
61 #endif /* !HAVE_SYS_SELECT_H */
63 /* If the fd manipulation macros aren't defined,
64 here is a set that should do the job */
66 #ifndef FD_SETSIZE
67 #define FD_SETSIZE 256
68 #endif
70 #ifndef FD_SET
72 typedef long fd_mask;
74 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
75 #ifndef howmany
76 #define howmany(x, y) (((x)+((y)-1))/(y))
77 #endif /* howmany */
79 typedef struct fd_set {
80 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
81 } fd_set;
83 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
84 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
85 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
86 #define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p)))
88 #endif /* FD_SET */
90 #ifdef __cplusplus
92 #endif
93 #endif /* !Py_MYSELECT_H */