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