2002-05-11 15:31:18 -04:00
|
|
|
/************************************************
|
|
|
|
|
2002-09-17 09:52:45 -04:00
|
|
|
missing.h - prototype for *.c in ./missing, and
|
|
|
|
for missing timeval struct
|
2002-05-11 15:31:18 -04:00
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Sat May 11 23:46:03 JST 2002
|
|
|
|
|
|
|
|
************************************************/
|
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#ifndef RUBY_MISSING_H
|
|
|
|
#define RUBY_MISSING_H 1
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#if 0
|
|
|
|
} /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
#endif
|
2002-05-11 15:31:18 -04:00
|
|
|
|
2002-09-17 09:52:45 -04:00
|
|
|
#if defined(HAVE_SYS_TIME_H)
|
|
|
|
# include <sys/time.h>
|
* configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
ext/socket/getnameinfo.c, ext/socket/socket.c,
ext/tcltklib/stubs.c
: replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-14 22:18:08 -05:00
|
|
|
#elif !defined(_WIN32)
|
2002-09-17 09:52:45 -04:00
|
|
|
# define time_t long
|
|
|
|
struct timeval {
|
|
|
|
time_t tv_sec; /* seconds */
|
* configure.in: check struct timespec, clock_gettime, utimensat,
struct stat.st_atim,
struct stat.st_atimespec,
struct stat.st_atimensec,
struct stat.st_mtim,
struct stat.st_mtimespec,
struct stat.st_mtimensec,
struct stat.st_ctim,
struct stat.st_ctimespec,
struct stat.st_ctimensec.
* include/ruby/missing.h: provide struct timespec if not available.
* time.c: support nanosecond-resolution using struct timespec.
* include/ruby/intern.h: provide rb_time_nano_new.
* file.c (utime_internal): use utimensat if available.
(rb_file_s_utime): refactored.
(rb_f_test): use stat_atime, stat_mtime, stat_ctime.
(rb_stat_cmp): check tv_nsec.
(stat_atimespec): new function.
(stat_atime): ditto.
(stat_mtimespec): ditto.
(stat_mtime): ditto.
(stat_ctimespec): ditto.
(stat_ctime): ditto.
(rb_stat_atime): use stat_atime.
(rb_file_s_atime): ditto.
(rb_file_atime): ditto.
(rb_stat_mtime): use stat_mtime.
(rb_file_s_mtime): ditto.
(rb_file_mtime): ditto.
(rb_file_ctime): use stat_ctime.
(rb_file_s_ctime): ditto.
(rb_stat_ctime): ditto.
* variable.c (rb_copy_generic_ivar): clear clone's instance variables
if obj has no instance variable.
* marshal.c (w_object): dump instance variables of generated string
for TYPE_USERDEF, even if original object has instance variables.
* lib/time.rb (Time#xmlschema): use nsec instead of usec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 04:09:38 -05:00
|
|
|
long tv_usec; /* microseconds */
|
2002-09-17 09:52:45 -04:00
|
|
|
};
|
|
|
|
#endif
|
2005-06-10 09:56:08 -04:00
|
|
|
#if defined(HAVE_SYS_TYPES_H)
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
2002-09-17 09:52:45 -04:00
|
|
|
|
* configure.in: check struct timespec, clock_gettime, utimensat,
struct stat.st_atim,
struct stat.st_atimespec,
struct stat.st_atimensec,
struct stat.st_mtim,
struct stat.st_mtimespec,
struct stat.st_mtimensec,
struct stat.st_ctim,
struct stat.st_ctimespec,
struct stat.st_ctimensec.
* include/ruby/missing.h: provide struct timespec if not available.
* time.c: support nanosecond-resolution using struct timespec.
* include/ruby/intern.h: provide rb_time_nano_new.
* file.c (utime_internal): use utimensat if available.
(rb_file_s_utime): refactored.
(rb_f_test): use stat_atime, stat_mtime, stat_ctime.
(rb_stat_cmp): check tv_nsec.
(stat_atimespec): new function.
(stat_atime): ditto.
(stat_mtimespec): ditto.
(stat_mtime): ditto.
(stat_ctimespec): ditto.
(stat_ctime): ditto.
(rb_stat_atime): use stat_atime.
(rb_file_s_atime): ditto.
(rb_file_atime): ditto.
(rb_stat_mtime): use stat_mtime.
(rb_file_s_mtime): ditto.
(rb_file_mtime): ditto.
(rb_file_ctime): use stat_ctime.
(rb_file_s_ctime): ditto.
(rb_stat_ctime): ditto.
* variable.c (rb_copy_generic_ivar): clear clone's instance variables
if obj has no instance variable.
* marshal.c (w_object): dump instance variables of generated string
for TYPE_USERDEF, even if original object has instance variables.
* lib/time.rb (Time#xmlschema): use nsec instead of usec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 04:09:38 -05:00
|
|
|
#if !defined(HAVE_STRUCT_TIMESPEC)
|
|
|
|
struct timespec {
|
|
|
|
time_t tv_sec; /* seconds */
|
|
|
|
long tv_nsec; /* nanoseconds */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-01-12 16:54:47 -05:00
|
|
|
#if !defined(HAVE_STRUCT_TIMEZONE)
|
|
|
|
struct timezone {
|
|
|
|
int tz_minuteswest;
|
|
|
|
int tz_dsttime;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2008-11-03 02:32:57 -05:00
|
|
|
#ifndef RUBY_EXTERN
|
|
|
|
#define RUBY_EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2002-05-11 15:31:18 -04:00
|
|
|
#ifndef HAVE_ACOSH
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double acosh(double);
|
|
|
|
RUBY_EXTERN double asinh(double);
|
|
|
|
RUBY_EXTERN double atanh(double);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_CRYPT
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN char *crypt(const char *, const char *);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_DUP2
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int dup2(int, int);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
2006-01-25 08:30:11 -05:00
|
|
|
#ifndef HAVE_EACCESS
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int eaccess(const char*, int);
|
2006-01-25 08:30:11 -05:00
|
|
|
#endif
|
|
|
|
|
2002-05-11 15:31:18 -04:00
|
|
|
#ifndef HAVE_FINITE
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int finite(double);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_FLOCK
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int flock(int, int);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef HAVE_FREXP
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double frexp(double, int *);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_HYPOT
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double hypot(double, double);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
2003-06-05 02:40:42 -04:00
|
|
|
#ifndef HAVE_ERF
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double erf(double);
|
|
|
|
RUBY_EXTERN double erfc(double);
|
2003-06-05 02:40:42 -04:00
|
|
|
#endif
|
|
|
|
|
2008-02-06 20:43:43 -05:00
|
|
|
#ifndef HAVE_TGAMMA
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double tgamma(double);
|
2008-02-06 20:43:43 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_LGAMMA_R
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double lgamma_r(double, int *);
|
2008-02-06 20:43:43 -05:00
|
|
|
#endif
|
|
|
|
|
2008-03-06 00:06:30 -05:00
|
|
|
#ifndef HAVE_CBRT
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double cbrt(double);
|
2008-03-06 00:06:30 -05:00
|
|
|
#endif
|
|
|
|
|
2006-01-01 01:34:48 -05:00
|
|
|
#ifndef isinf
|
|
|
|
# ifndef HAVE_ISINF
|
|
|
|
# if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
|
|
|
|
# define isinf(x) (!finite(x) && !isnan(x))
|
|
|
|
# else
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int isinf(double);
|
2006-01-01 01:34:48 -05:00
|
|
|
# endif
|
2003-12-22 03:23:55 -05:00
|
|
|
# endif
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
2010-06-11 10:00:35 -04:00
|
|
|
#ifndef isnan
|
|
|
|
# ifndef HAVE_ISNAN
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int isnan(double);
|
2010-06-11 10:00:35 -04:00
|
|
|
# endif
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef HAVE_MEMCMP
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN int memcmp(const void *, const void *, size_t);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_MEMMOVE
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN void *memmove(void *, const void *, size_t);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef HAVE_MODF
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN double modf(double, double *);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_STRCHR
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN char *strchr(const char *, int);
|
|
|
|
RUBY_EXTERN char *strrchr(const char *, int);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRERROR
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN char *strerror(int);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRSTR
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN char *strstr(const char *, const char *);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef HAVE_STRTOL
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN long strtol(const char *, char **, int);
|
2002-05-11 15:31:18 -04:00
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
2007-03-19 04:01:40 -04:00
|
|
|
#ifndef HAVE_STRLCPY
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
|
2007-03-19 04:01:40 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRLCAT
|
2008-11-03 02:32:57 -05:00
|
|
|
RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
|
2007-03-19 04:01:40 -04:00
|
|
|
#endif
|
|
|
|
|
2010-05-15 22:39:18 -04:00
|
|
|
#ifndef HAVE_SIGNBIT
|
|
|
|
RUBY_EXTERN int signbit(double x);
|
|
|
|
#endif
|
|
|
|
|
2010-05-12 09:23:20 -04:00
|
|
|
#ifndef HAVE_FFS
|
|
|
|
RUBY_EXTERN int ffs(int);
|
|
|
|
#endif
|
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
#if 0
|
|
|
|
{ /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
} /* extern "C" { */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* RUBY_MISSING_H */
|