Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

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 {
68 int tz_minuteswest;
69 int tz_dsttime;
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
80 RUBY_SYMBOL_EXPORT_BEGIN
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(INFINITY) || !defined(NAN)
140 union bytesequence4_or_float {
141 unsigned char bytesequence[4];
142 float float_value;
143 };
144 #endif
145
146 #ifndef INFINITY
147
148 RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
149 # define INFINITY (rb_infinity.float_value)
150 # define USE_RB_INFINITY 1
151 #endif
152
153 #ifndef NAN
154
155 RUBY_EXTERN const union bytesequence4_or_float rb_nan;
156 # define NAN (rb_nan.float_value)
157 # define USE_RB_NAN 1
158 #endif
159
160 #ifndef HUGE_VAL
161 # define HUGE_VAL ((double)INFINITY)
162 #endif
163
164 #ifndef isinf
165 # ifndef HAVE_ISINF
166 # if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
167 # ifdef HAVE_IEEEFP_H
168 # include <ieeefp.h>
169 # endif
170 # define isinf(x) (!finite(x) && !isnan(x))
171 # elif defined(__cplusplus) && __cplusplus >= 201103L
172 # include <cmath> // it must include constexpr bool isinf(double);
173 # else
174 RUBY_EXTERN int isinf(double);
175 # endif
176 # endif
177 #endif
178
179 #ifndef isnan
180 # ifndef HAVE_ISNAN
181 # if defined(__cplusplus) && __cplusplus >= 201103L
182 # include <cmath> // it must include constexpr bool isnan(double);
183 # else
184 RUBY_EXTERN int isnan(double);
185 # endif
186 # endif
187 #endif
188
189 #ifndef isfinite
190 # ifndef HAVE_ISFINITE
191 # define HAVE_ISFINITE 1
192 # define isfinite(x) finite(x)
193 # endif
194 #endif
195
196 #ifndef HAVE_NAN
197 RUBY_EXTERN double nan(const char *);
198 #endif
199
200 #ifndef HAVE_NEXTAFTER
201 RUBY_EXTERN double nextafter(double x, double y);
202 #endif
203
204 /*
205 #ifndef HAVE_MEMCMP
206 RUBY_EXTERN int memcmp(const void *, const void *, size_t);
207 #endif
208 */
209
210 #ifndef HAVE_MEMMOVE
211 RUBY_EXTERN void *memmove(void *, const void *, size_t);
212 #endif
213
214 /*
215 #ifndef HAVE_MODF
216 RUBY_EXTERN double modf(double, double *);
217 #endif
218 */
219
220 #ifndef HAVE_STRCHR
221 RUBY_EXTERN char *strchr(const char *, int);
222 RUBY_EXTERN char *strrchr(const char *, int);
223 #endif
224
225 #ifndef HAVE_STRERROR
226 RUBY_EXTERN char *strerror(int);
227 #endif
228
229 #ifndef HAVE_STRSTR
230 RUBY_EXTERN char *strstr(const char *, const char *);
231 #endif
232
233 #ifndef HAVE_STRLCPY
234 RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
235 #endif
236
237 #ifndef HAVE_STRLCAT
238 RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
239 #endif
240
241 #ifndef HAVE_SIGNBIT
242 RUBY_EXTERN int signbit(double x);
243 #endif
244
245 #ifndef HAVE_FFS
246 RUBY_EXTERN int ffs(int);
247 #endif
248
249 #ifdef BROKEN_CLOSE
250 #include <sys/types.h>
251 #include <sys/socket.h>
252 RUBY_EXTERN int ruby_getpeername(int, struct sockaddr *, socklen_t *);
253 RUBY_EXTERN int ruby_getsockname(int, struct sockaddr *, socklen_t *);
254 RUBY_EXTERN int ruby_shutdown(int, int);
255 RUBY_EXTERN int ruby_close(int);
256 #endif
257
258 #ifndef HAVE_SETPROCTITLE
259 RUBY_EXTERN void setproctitle(const char *fmt, ...);
260 #endif
261
262 #ifndef HAVE_EXPLICIT_BZERO
263 RUBY_EXTERN void explicit_bzero(void *b, size_t len);
264 # if defined SecureZeroMemory
265 # define explicit_bzero(b, len) SecureZeroMemory(b, len)
266 # endif
267 #endif
268
269 RUBY_SYMBOL_EXPORT_END
270
271 #if defined(__cplusplus)
272 #if 0
273 { /* satisfy cc-mode */
274 #endif
275 } /* extern "C" { */
276 #endif
277
278 #endif /* RUBY_MISSING_H */
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
rb_nan
RUBY_EXTERN const union bytesequence4_or_float rb_nan
Definition: missing.h:155
isinf
RUBY_EXTERN int isinf(double)
Definition: isinf.c:56
strlcat
RUBY_EXTERN size_t strlcat(char *, const char *, size_t)
Definition: strlcat.c:31
time_t
long time_t
Definition: rb_mjit_min_header-2.7.0.h:1236
strstr
RUBY_EXTERN char * strstr(const char *, const char *)
Definition: strstr.c:8
timezone
Definition: missing.h:67
explicit_bzero
RUBY_EXTERN void explicit_bzero(void *b, size_t len)
Definition: explicit_bzero.c:77
ruby_getpeername
int ruby_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
Definition: close.c:10
bytesequence4_or_float
Definition: missing.h:140
rb_infinity
RUBY_EXTERN const union bytesequence4_or_float rb_infinity
Definition: missing.h:148
signbit
RUBY_EXTERN int signbit(double x)
Definition: signbit.c:5
bytesequence4_or_float::float_value
float float_value
Definition: missing.h:142
eaccess
RUBY_EXTERN int eaccess(const char *, int)
Definition: file.c:1460
socklen_t
int socklen_t
Definition: getaddrinfo.c:83
timespec::tv_nsec
long tv_nsec
Definition: missing.h:62
erfc
RUBY_EXTERN double erfc(double)
Definition: erf.c:81
crypt
RUBY_EXTERN char * crypt(const char *, const char *)
round
RUBY_EXTERN double round(double)
Definition: numeric.c:80
strerror
RUBY_EXTERN char * strerror(int)
Definition: strerror.c:11
timespec::tv_sec
time_t tv_sec
Definition: missing.h:61
memmove
RUBY_EXTERN void * memmove(void *, const void *, size_t)
Definition: memmove.c:7
ruby_shutdown
int ruby_shutdown(int s, int how)
Definition: close.c:44
nan
RUBY_EXTERN double nan(const char *)
Definition: nan.c:7
strrchr
RUBY_EXTERN char * strrchr(const char *, int)
Definition: strchr.c:20
lgamma_r
RUBY_EXTERN double lgamma_r(double, int *)
Definition: lgamma_r.c:63
strlcpy
RUBY_EXTERN size_t strlcpy(char *, const char *, size_t)
Definition: strlcpy.c:29
setproctitle
RUBY_EXTERN void setproctitle(const char *fmt,...)
Definition: setproctitle.c:139
erf
RUBY_EXTERN double erf(double)
Definition: erf.c:71
timeval::tv_sec
time_t tv_sec
Definition: missing.h:54
fmt
const VALUE int int int int int int VALUE char * fmt
Definition: rb_mjit_min_header-2.7.0.h:6462
dup2
RUBY_EXTERN int dup2(int, int)
Definition: dup2.c:27
timezone::tz_dsttime
int tz_dsttime
Definition: missing.h:69
hypot
RUBY_EXTERN double hypot(double, double)
Definition: hypot.c:6
timeval::tv_usec
long tv_usec
Definition: missing.h:55
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
finite
RUBY_EXTERN int finite(double)
Definition: finite.c:6
timeval
Definition: missing.h:53
strchr
RUBY_EXTERN char * strchr(const char *, int)
Definition: strchr.c:8
ffs
RUBY_EXTERN int ffs(int)
Definition: ffs.c:6
RUBY_EXTERN
#define RUBY_EXTERN
Definition: missing.h:77
acosh
RUBY_SYMBOL_EXPORT_BEGIN RUBY_EXTERN double acosh(double)
Definition: acosh.c:36
len
uint8_t len
Definition: escape.c:17
ruby_getsockname
int ruby_getsockname(int s, struct sockaddr *name, socklen_t *namelen)
Definition: close.c:27
bytesequence4_or_float::bytesequence
unsigned char bytesequence[4]
Definition: missing.h:141
timespec
Definition: missing.h:60
ruby_close
int ruby_close(int s)
Definition: close.c:60
asinh
RUBY_EXTERN double asinh(double)
Definition: acosh.c:52
timezone::tz_minuteswest
int tz_minuteswest
Definition: missing.h:68
cbrt
RUBY_EXTERN double cbrt(double)
Definition: cbrt.c:4
atanh
RUBY_EXTERN double atanh(double)
Definition: acosh.c:75
nextafter
RUBY_EXTERN double nextafter(double x, double y)
Definition: nextafter.c:9
tgamma
RUBY_EXTERN double tgamma(double)
Definition: tgamma.c:66
flock
RUBY_EXTERN int flock(int, int)
Definition: flock.c:125
isnan
RUBY_EXTERN int isnan(double)
Definition: isnan.c:22