Ruby  2.0.0p247(2013-06-27revision41674)
include/ruby/missing.h
Go to the documentation of this file.
00001 /************************************************
00002 
00003   missing.h - prototype for *.c in ./missing, and
00004               for missing timeval struct
00005 
00006   $Author: nagachika $
00007   created at: Sat May 11 23:46:03 JST 2002
00008 
00009 ************************************************/
00010 
00011 #ifndef RUBY_MISSING_H
00012 #define RUBY_MISSING_H 1
00013 
00014 #if defined(__cplusplus)
00015 extern "C" {
00016 #if 0
00017 } /* satisfy cc-mode */
00018 #endif
00019 #endif
00020 
00021 #include "ruby/config.h"
00022 #include <stddef.h>
00023 #include <math.h> /* for INFINITY and NAN */
00024 #ifdef RUBY_EXTCONF_H
00025 #include RUBY_EXTCONF_H
00026 #endif
00027 
00028 #if !defined(HAVE_STRUCT_TIMEVAL) || !defined(HAVE_STRUCT_TIMESPEC)
00029 #if defined(HAVE_TIME_H)
00030 # include <time.h>
00031 #endif
00032 #if defined(HAVE_SYS_TIME_H)
00033 # include <sys/time.h>
00034 #endif
00035 #endif
00036 
00037 #if !defined(HAVE_STRUCT_TIMEVAL)
00038 struct timeval {
00039     time_t tv_sec;      /* seconds */
00040     long tv_usec;       /* microseconds */
00041 };
00042 #endif /* HAVE_STRUCT_TIMEVAL */
00043 
00044 #if !defined(HAVE_STRUCT_TIMESPEC)
00045 struct timespec {
00046     time_t tv_sec;      /* seconds */
00047     long tv_nsec;       /* nanoseconds */
00048 };
00049 #endif
00050 
00051 #if !defined(HAVE_STRUCT_TIMEZONE)
00052 struct timezone {
00053     int tz_minuteswest;
00054     int tz_dsttime;
00055 };
00056 #endif
00057 
00058 #ifdef RUBY_EXPORT
00059 #undef RUBY_EXTERN
00060 #endif
00061 #ifndef RUBY_EXTERN
00062 #define RUBY_EXTERN extern
00063 #endif
00064 
00065 #if defined __GNUC__ && __GNUC__ >= 4
00066 #pragma GCC visibility push(default)
00067 #endif
00068 
00069 #ifndef HAVE_ACOSH
00070 RUBY_EXTERN double acosh(double);
00071 RUBY_EXTERN double asinh(double);
00072 RUBY_EXTERN double atanh(double);
00073 #endif
00074 
00075 #ifndef HAVE_CRYPT
00076 RUBY_EXTERN char *crypt(const char *, const char *);
00077 #endif
00078 
00079 #ifndef HAVE_DUP2
00080 RUBY_EXTERN int dup2(int, int);
00081 #endif
00082 
00083 #ifndef HAVE_EACCESS
00084 RUBY_EXTERN int eaccess(const char*, int);
00085 #endif
00086 
00087 #ifndef HAVE_ROUND
00088 RUBY_EXTERN double round(double);       /* numeric.c */
00089 #endif
00090 
00091 #ifndef HAVE_FINITE
00092 RUBY_EXTERN int finite(double);
00093 #endif
00094 
00095 #ifndef HAVE_FLOCK
00096 RUBY_EXTERN int flock(int, int);
00097 #endif
00098 
00099 /*
00100 #ifndef HAVE_FREXP
00101 RUBY_EXTERN double frexp(double, int *);
00102 #endif
00103 */
00104 
00105 #ifndef HAVE_HYPOT
00106 RUBY_EXTERN double hypot(double, double);
00107 #endif
00108 
00109 #ifndef HAVE_ERF
00110 RUBY_EXTERN double erf(double);
00111 RUBY_EXTERN double erfc(double);
00112 #endif
00113 
00114 #ifndef HAVE_TGAMMA
00115 RUBY_EXTERN double tgamma(double);
00116 #endif
00117 
00118 #ifndef HAVE_LGAMMA_R
00119 RUBY_EXTERN double lgamma_r(double, int *);
00120 #endif
00121 
00122 #ifndef HAVE_CBRT
00123 RUBY_EXTERN double cbrt(double);
00124 #endif
00125 
00126 #if !defined(INFINITY) || !defined(NAN)
00127 union bytesequence4_or_float {
00128   unsigned char bytesequence[4];
00129   float float_value;
00130 };
00131 #endif
00132 
00133 #ifdef INFINITY
00134 # define HAVE_INFINITY
00135 #else
00136 
00137 RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
00138 # define INFINITY (rb_infinity.float_value)
00139 #endif
00140 
00141 #ifdef NAN
00142 # define HAVE_NAN
00143 #else
00144 
00145 RUBY_EXTERN const union bytesequence4_or_float rb_nan;
00146 # define NAN (rb_nan.float_value)
00147 #endif
00148 
00149 #ifndef isinf
00150 # ifndef HAVE_ISINF
00151 #  if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
00152 #    ifdef HAVE_IEEEFP_H
00153 #    include <ieeefp.h>
00154 #    endif
00155 #  define isinf(x) (!finite(x) && !isnan(x))
00156 #  else
00157 RUBY_EXTERN int isinf(double);
00158 #  endif
00159 # endif
00160 #endif
00161 
00162 #ifndef isnan
00163 # ifndef HAVE_ISNAN
00164 RUBY_EXTERN int isnan(double);
00165 # endif
00166 #endif
00167 
00168 /*
00169 #ifndef HAVE_MEMCMP
00170 RUBY_EXTERN int memcmp(const void *, const void *, size_t);
00171 #endif
00172 */
00173 
00174 #ifndef HAVE_MEMMOVE
00175 RUBY_EXTERN void *memmove(void *, const void *, size_t);
00176 #endif
00177 
00178 /*
00179 #ifndef HAVE_MODF
00180 RUBY_EXTERN double modf(double, double *);
00181 #endif
00182 */
00183 
00184 #ifndef HAVE_STRCHR
00185 RUBY_EXTERN char *strchr(const char *, int);
00186 RUBY_EXTERN char *strrchr(const char *, int);
00187 #endif
00188 
00189 #ifndef HAVE_STRERROR
00190 RUBY_EXTERN char *strerror(int);
00191 #endif
00192 
00193 #ifndef HAVE_STRSTR
00194 RUBY_EXTERN char *strstr(const char *, const char *);
00195 #endif
00196 
00197 /*
00198 #ifndef HAVE_STRTOL
00199 RUBY_EXTERN long strtol(const char *, char **, int);
00200 #endif
00201 */
00202 
00203 #ifndef HAVE_STRLCPY
00204 RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
00205 #endif
00206 
00207 #ifndef HAVE_STRLCAT
00208 RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
00209 #endif
00210 
00211 #ifndef HAVE_SIGNBIT
00212 RUBY_EXTERN int signbit(double x);
00213 #endif
00214 
00215 #ifndef HAVE_FFS
00216 RUBY_EXTERN int ffs(int);
00217 #endif
00218 
00219 #ifdef BROKEN_CLOSE
00220 #include <sys/types.h>
00221 #include <sys/socket.h>
00222 RUBY_EXTERN int ruby_getpeername(int, struct sockaddr *, socklen_t *);
00223 RUBY_EXTERN int ruby_getsockname(int, struct sockaddr *, socklen_t *);
00224 RUBY_EXTERN int ruby_shutdown(int, int);
00225 RUBY_EXTERN int ruby_close(int);
00226 #endif
00227 
00228 #ifndef HAVE_SETPROCTITLE
00229 RUBY_EXTERN void setproctitle(const char *fmt, ...);
00230 #endif
00231 
00232 #if defined __GNUC__ && __GNUC__ >= 4
00233 #pragma GCC visibility pop
00234 #endif
00235 
00236 #if defined(__cplusplus)
00237 #if 0
00238 { /* satisfy cc-mode */
00239 #endif
00240 }  /* extern "C" { */
00241 #endif
00242 
00243 #endif /* RUBY_MISSING_H */
00244