Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

missing.h
Go to the documentation of this file.
1 /************************************************
2
3 missing.h - prototype for *.c in ./missing, and
4 for missing timeval struct
5
6 $Author: nagachika $
7 created at: Sat May 11 23:46:03 JST 2002
8
9 ************************************************/
10
11 #ifndef RUBY_MISSING_H
12 #define RUBY_MISSING_H 1
13
14 #if defined(__cplusplus)
15 extern "C" {
16 #if 0
17 } /* satisfy cc-mode */
18 #endif
19 #endif
20
21 #include "ruby/config.h"
22 #include <stddef.h>
23 #include <math.h> /* for INFINITY and NAN */
24 #ifdef RUBY_EXTCONF_H
25 #include RUBY_EXTCONF_H
26 #endif
27
28 #if !defined(HAVE_STRUCT_TIMEVAL) || !defined(HAVE_STRUCT_TIMESPEC)
29 #if defined(HAVE_TIME_H)
30 # include <time.h>
31 #endif
32 #if defined(HAVE_SYS_TIME_H)
33 # include <sys/time.h>
34 #endif
35 #endif
36
37 #if !defined(HAVE_STRUCT_TIMEVAL)
38 struct timeval {
39 time_t tv_sec; /* seconds */
40 long tv_usec; /* microseconds */
41 };
42 #endif /* HAVE_STRUCT_TIMEVAL */
43
44 #if !defined(HAVE_STRUCT_TIMESPEC)
45 struct timespec {
46 time_t tv_sec; /* seconds */
47 long tv_nsec; /* nanoseconds */
48 };
49 #endif
50
51 #if !defined(HAVE_STRUCT_TIMEZONE)
52 struct timezone {
53 int tz_minuteswest;
54 int tz_dsttime;
55 };
56 #endif
57
58 #ifdef RUBY_EXPORT
59 #undef RUBY_EXTERN
60 #endif
61 #ifndef RUBY_EXTERN
62 #define RUBY_EXTERN extern
63 #endif
64
65 #if defined __GNUC__ && __GNUC__ >= 4
66 #pragma GCC visibility push(default)
67 #endif
68
69 #ifndef HAVE_ACOSH
70 RUBY_EXTERN double acosh(double);
71 RUBY_EXTERN double asinh(double);
72 RUBY_EXTERN double atanh(double);
73 #endif
74
75 #ifndef HAVE_CRYPT
76 RUBY_EXTERN char *crypt(const char *, const char *);
77 #endif
78
79 #ifndef HAVE_DUP2
80 RUBY_EXTERN int dup2(int, int);
81 #endif
82
83 #ifndef HAVE_EACCESS
84 RUBY_EXTERN int eaccess(const char*, int);
85 #endif
86
87 #ifndef HAVE_ROUND
88 RUBY_EXTERN double round(double); /* numeric.c */
89 #endif
90
91 #ifndef HAVE_FINITE
92 RUBY_EXTERN int finite(double);
93 #endif
94
95 #ifndef HAVE_FLOCK
96 RUBY_EXTERN int flock(int, int);
97 #endif
98
99 /*
100 #ifndef HAVE_FREXP
101 RUBY_EXTERN double frexp(double, int *);
102 #endif
103 */
104
105 #ifndef HAVE_HYPOT
106 RUBY_EXTERN double hypot(double, double);
107 #endif
108
109 #ifndef HAVE_ERF
110 RUBY_EXTERN double erf(double);
111 RUBY_EXTERN double erfc(double);
112 #endif
113
114 #ifndef HAVE_TGAMMA
115 RUBY_EXTERN double tgamma(double);
116 #endif
117
118 #ifndef HAVE_LGAMMA_R
119 RUBY_EXTERN double lgamma_r(double, int *);
120 #endif
121
122 #ifndef HAVE_CBRT
123 RUBY_EXTERN double cbrt(double);
124 #endif
125
126 #if !defined(INFINITY) || !defined(NAN)
127 union bytesequence4_or_float {
128 unsigned char bytesequence[4];
129 float float_value;
130 };
131 #endif
132
133 #ifdef INFINITY
134 # define HAVE_INFINITY
135 #else
136
137 RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
138 # define INFINITY (rb_infinity.float_value)
139 #endif
140
141 #ifdef NAN
142 # define HAVE_NAN
143 #else
144
145 RUBY_EXTERN const union bytesequence4_or_float rb_nan;
146 # define NAN (rb_nan.float_value)
147 #endif
148
149 #ifndef isinf
150 # ifndef HAVE_ISINF
151 # if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
152 # ifdef HAVE_IEEEFP_H
153 # include <ieeefp.h>
154 # endif
155 # define isinf(x) (!finite(x) && !isnan(x))
156 # else
157 RUBY_EXTERN int isinf(double);
158 # endif
159 # endif
160 #endif
161
162 #ifndef isnan
163 # ifndef HAVE_ISNAN
164 RUBY_EXTERN int isnan(double);
165 # endif
166 #endif
167
168 /*
169 #ifndef HAVE_MEMCMP
170 RUBY_EXTERN int memcmp(const void *, const void *, size_t);
171 #endif
172 */
173
174 #ifndef HAVE_MEMMOVE
175 RUBY_EXTERN void *memmove(void *, const void *, size_t);
176 #endif
177
178 /*
179 #ifndef HAVE_MODF
180 RUBY_EXTERN double modf(double, double *);
181 #endif
182 */
183
184 #ifndef HAVE_STRCHR
185 RUBY_EXTERN char *strchr(const char *, int);
186 RUBY_EXTERN char *strrchr(const char *, int);
187 #endif
188
189 #ifndef HAVE_STRERROR
190 RUBY_EXTERN char *strerror(int);
191 #endif
192
193 #ifndef HAVE_STRSTR
194 RUBY_EXTERN char *strstr(const char *, const char *);
195 #endif
196
197 /*
198 #ifndef HAVE_STRTOL
199 RUBY_EXTERN long strtol(const char *, char **, int);
200 #endif
201 */
202
203 #ifndef HAVE_STRLCPY
204 RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
205 #endif
206
207 #ifndef HAVE_STRLCAT
208 RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
209 #endif
210
211 #ifndef HAVE_SIGNBIT
212 RUBY_EXTERN int signbit(double x);
213 #endif
214
215 #ifndef HAVE_FFS
216 RUBY_EXTERN int ffs(int);
217 #endif
218
219 #ifdef BROKEN_CLOSE
220 #include <sys/types.h>
221 #include <sys/socket.h>
222 RUBY_EXTERN int ruby_getpeername(int, struct sockaddr *, socklen_t *);
223 RUBY_EXTERN int ruby_getsockname(int, struct sockaddr *, socklen_t *);
224 RUBY_EXTERN int ruby_shutdown(int, int);
225 RUBY_EXTERN int ruby_close(int);
226 #endif
227
228 #ifndef HAVE_SETPROCTITLE
229 RUBY_EXTERN void setproctitle(const char *fmt, ...);
230 #endif
231
232 #if defined __GNUC__ && __GNUC__ >= 4
233 #pragma GCC visibility pop
234 #endif
235
236 #if defined(__cplusplus)
237 #if 0
238 { /* satisfy cc-mode */
239 #endif
240 } /* extern "C" { */
241 #endif
242
243 #endif /* RUBY_MISSING_H */
244