Ruby  2.5.0dev(2017-10-22revision60238)
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$
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_ALTERNATIVE_MALLOC_HEADER
25 # include RUBY_ALTERNATIVE_MALLOC_HEADER
26 #endif
27 #ifdef RUBY_EXTCONF_H
28 #include RUBY_EXTCONF_H
29 #endif
30 
31 #if !defined(HAVE_STRUCT_TIMEVAL) || !defined(HAVE_STRUCT_TIMESPEC)
32 #if defined(HAVE_TIME_H)
33 # include <time.h>
34 #endif
35 #if defined(HAVE_SYS_TIME_H)
36 # include <sys/time.h>
37 #endif
38 #endif
39 
40 #ifndef M_PI
41 # define M_PI 3.14159265358979323846
42 #endif
43 #ifndef M_PI_2
44 # define M_PI_2 (M_PI/2)
45 #endif
46 
47 #ifndef RUBY_SYMBOL_EXPORT_BEGIN
48 # define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
49 # define RUBY_SYMBOL_EXPORT_END /* end */
50 #endif
51 
52 #if !defined(HAVE_STRUCT_TIMEVAL)
53 struct timeval {
54  time_t tv_sec; /* seconds */
55  long tv_usec; /* microseconds */
56 };
57 #endif /* HAVE_STRUCT_TIMEVAL */
58 
59 #if !defined(HAVE_STRUCT_TIMESPEC)
60 struct timespec {
61  time_t tv_sec; /* seconds */
62  long tv_nsec; /* nanoseconds */
63 };
64 #endif
65 
66 #if !defined(HAVE_STRUCT_TIMEZONE)
67 struct timezone {
70 };
71 #endif
72 
73 #ifdef RUBY_EXPORT
74 #undef RUBY_EXTERN
75 #endif
76 #ifndef RUBY_EXTERN
77 #define RUBY_EXTERN extern
78 #endif
79 
81 
82 #ifndef HAVE_ACOSH
83 RUBY_EXTERN double acosh(double);
84 RUBY_EXTERN double asinh(double);
85 RUBY_EXTERN double atanh(double);
86 #endif
87 
88 #ifndef HAVE_CRYPT
89 RUBY_EXTERN char *crypt(const char *, const char *);
90 #endif
91 
92 #ifndef HAVE_DUP2
93 RUBY_EXTERN int dup2(int, int);
94 #endif
95 
96 #ifndef HAVE_EACCESS
97 RUBY_EXTERN int eaccess(const char*, int);
98 #endif
99 
100 #ifndef HAVE_ROUND
101 RUBY_EXTERN double round(double); /* numeric.c */
102 #endif
103 
104 #ifndef HAVE_FINITE
105 RUBY_EXTERN int finite(double);
106 #endif
107 
108 #ifndef HAVE_FLOCK
109 RUBY_EXTERN int flock(int, int);
110 #endif
111 
112 /*
113 #ifndef HAVE_FREXP
114 RUBY_EXTERN double frexp(double, int *);
115 #endif
116 */
117 
118 #ifndef HAVE_HYPOT
119 RUBY_EXTERN double hypot(double, double);
120 #endif
121 
122 #ifndef HAVE_ERF
123 RUBY_EXTERN double erf(double);
124 RUBY_EXTERN double erfc(double);
125 #endif
126 
127 #ifndef HAVE_TGAMMA
128 RUBY_EXTERN double tgamma(double);
129 #endif
130 
131 #ifndef HAVE_LGAMMA_R
132 RUBY_EXTERN double lgamma_r(double, int *);
133 #endif
134 
135 #ifndef HAVE_CBRT
136 RUBY_EXTERN double cbrt(double);
137 #endif
138 
139 #if !defined(HAVE_INFINITY) || !defined(HAVE_NAN)
141  unsigned char bytesequence[4];
142  float float_value;
143 };
144 #endif
145 
146 #ifndef INFINITY
147 
149 # define INFINITY (rb_infinity.float_value)
150 #endif
151 
152 #ifndef NAN
153 
155 # define NAN (rb_nan.float_value)
156 #endif
157 
158 #ifndef isinf
159 # ifndef HAVE_ISINF
160 # if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
161 # ifdef HAVE_IEEEFP_H
162 # include <ieeefp.h>
163 # endif
164 # define isinf(x) (!finite(x) && !isnan(x))
165 # else
166 RUBY_EXTERN int isinf(double);
167 # endif
168 # endif
169 #endif
170 
171 #ifndef isnan
172 # ifndef HAVE_ISNAN
173 RUBY_EXTERN int isnan(double);
174 # endif
175 #endif
176 
177 #ifndef isfinite
178 # ifndef HAVE_ISFINITE
179 # define HAVE_ISFINITE 1
180 # define isfinite(x) finite(x)
181 # endif
182 #endif
183 
184 #ifndef HAVE_NEXTAFTER
185 RUBY_EXTERN double nextafter(double x, double y);
186 #endif
187 
188 /*
189 #ifndef HAVE_MEMCMP
190 RUBY_EXTERN int memcmp(const void *, const void *, size_t);
191 #endif
192 */
193 
194 #ifndef HAVE_MEMMOVE
195 RUBY_EXTERN void *memmove(void *, const void *, size_t);
196 #endif
197 
198 /*
199 #ifndef HAVE_MODF
200 RUBY_EXTERN double modf(double, double *);
201 #endif
202 */
203 
204 #ifndef HAVE_STRCHR
205 RUBY_EXTERN char *strchr(const char *, int);
206 RUBY_EXTERN char *strrchr(const char *, int);
207 #endif
208 
209 #ifndef HAVE_STRERROR
210 RUBY_EXTERN char *strerror(int);
211 #endif
212 
213 #ifndef HAVE_STRSTR
214 RUBY_EXTERN char *strstr(const char *, const char *);
215 #endif
216 
217 #ifndef HAVE_STRLCPY
218 RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
219 #endif
220 
221 #ifndef HAVE_STRLCAT
222 RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
223 #endif
224 
225 #ifndef HAVE_SIGNBIT
226 RUBY_EXTERN int signbit(double x);
227 #endif
228 
229 #ifndef HAVE_FFS
230 RUBY_EXTERN int ffs(int);
231 #endif
232 
233 #ifdef BROKEN_CLOSE
234 #include <sys/types.h>
235 #include <sys/socket.h>
236 RUBY_EXTERN int ruby_getpeername(int, struct sockaddr *, socklen_t *);
237 RUBY_EXTERN int ruby_getsockname(int, struct sockaddr *, socklen_t *);
238 RUBY_EXTERN int ruby_shutdown(int, int);
239 RUBY_EXTERN int ruby_close(int);
240 #endif
241 
242 #ifndef HAVE_SETPROCTITLE
243 RUBY_EXTERN void setproctitle(const char *fmt, ...);
244 #endif
245 
246 #ifndef HAVE_EXPLICIT_BZERO
247 RUBY_EXTERN void explicit_bzero(void *b, size_t len);
248 # if defined SecureZeroMemory
249 # define explicit_bzero(b, len) SecureZeroMemory(b, len)
250 # endif
251 #endif
252 
254 
255 #if defined(__cplusplus)
256 #if 0
257 { /* satisfy cc-mode */
258 #endif
259 } /* extern "C" { */
260 #endif
261 
262 #endif /* RUBY_MISSING_H */
int tz_dsttime
Definition: missing.h:69
RUBY_EXTERN double cbrt(double)
Definition: cbrt.c:4
int ruby_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
Definition: close.c:10
RUBY_EXTERN int signbit(double x)
Definition: signbit.c:5
RUBY_EXTERN const union bytesequence4_or_float rb_infinity
Definition: missing.h:148
int ruby_getsockname(int s, struct sockaddr *name, socklen_t *namelen)
Definition: close.c:27
RUBY_EXTERN char * crypt(const char *, const char *)
RUBY_EXTERN int eaccess(const char *, int)
Definition: file.c:1336
time_t tv_sec
Definition: missing.h:54
RUBY_EXTERN int finite(double)
Definition: finite.c:6
RUBY_EXTERN void explicit_bzero(void *b, size_t len)
RUBY_EXTERN double tgamma(double)
Definition: tgamma.c:66
RUBY_EXTERN void * memmove(void *, const void *, size_t)
Definition: memmove.c:7
time_t tv_sec
Definition: missing.h:61
RUBY_EXTERN double lgamma_r(double, int *)
Definition: lgamma_r.c:63
long tv_usec
Definition: missing.h:55
RUBY_EXTERN char * strstr(const char *, const char *)
Definition: strstr.c:8
RUBY_EXTERN int flock(int, int)
Definition: flock.c:125
long tv_nsec
Definition: missing.h:62
RUBY_EXTERN char * strrchr(const char *, int)
Definition: strchr.c:20
RUBY_SYMBOL_EXPORT_BEGIN RUBY_EXTERN double acosh(double)
Definition: acosh.c:36
RUBY_EXTERN double erfc(double)
Definition: erf.c:81
RUBY_EXTERN int isinf(double)
Definition: isinf.c:56
RUBY_EXTERN const union bytesequence4_or_float rb_nan
Definition: missing.h:154
RUBY_EXTERN double atanh(double)
Definition: acosh.c:75
int socklen_t
Definition: getaddrinfo.c:83
#define RUBY_EXTERN
Definition: missing.h:77
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
RUBY_EXTERN double hypot(double, double)
Definition: hypot.c:6
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
RUBY_EXTERN double asinh(double)
Definition: acosh.c:52
RUBY_EXTERN size_t strlcpy(char *, const char *, size_t)
Definition: strlcpy.c:29
RUBY_EXTERN char * strchr(const char *, int)
Definition: strchr.c:8
register unsigned int len
Definition: zonetab.h:51
int ruby_shutdown(int s, int how)
Definition: close.c:44
RUBY_EXTERN int ffs(int)
Definition: ffs.c:6
RUBY_EXTERN double round(double)
Definition: numeric.c:79
int ruby_close(int s)
Definition: close.c:60
RUBY_EXTERN char * strerror(int)
Definition: strerror.c:11
RUBY_EXTERN double nextafter(double x, double y)
Definition: nextafter.c:9
RUBY_EXTERN size_t strlcat(char *, const char *, size_t)
Definition: strlcat.c:31
RUBY_EXTERN int dup2(int, int)
Definition: dup2.c:27
RUBY_EXTERN int isnan(double)
Definition: isnan.c:22
RUBY_EXTERN void setproctitle(const char *fmt,...)
Definition: setproctitle.c:139
RUBY_EXTERN double erf(double)
Definition: erf.c:71
int tz_minuteswest
Definition: missing.h:68