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