Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef RUBY_DEFINES_H
00011 #define RUBY_DEFINES_H 1
00012
00013 #if defined(__cplusplus)
00014 extern "C" {
00015 #if 0
00016 }
00017 #endif
00018 #endif
00019
00020 #define RUBY
00021
00022 #include <stdlib.h>
00023 #ifdef __cplusplus
00024 # ifndef HAVE_PROTOTYPES
00025 # define HAVE_PROTOTYPES 1
00026 # endif
00027 # ifndef HAVE_STDARG_PROTOTYPES
00028 # define HAVE_STDARG_PROTOTYPES 1
00029 # endif
00030 #endif
00031
00032 #undef _
00033 #ifdef HAVE_PROTOTYPES
00034 # define _(args) args
00035 #else
00036 # define _(args) ()
00037 #endif
00038
00039 #undef __
00040 #ifdef HAVE_STDARG_PROTOTYPES
00041 # define __(args) args
00042 #else
00043 # define __(args) ()
00044 #endif
00045
00046 #ifdef __cplusplus
00047 #define ANYARGS ...
00048 #else
00049 #define ANYARGS
00050 #endif
00051
00052 #define xmalloc ruby_xmalloc
00053 #define xmalloc2 ruby_xmalloc2
00054 #define xcalloc ruby_xcalloc
00055 #define xrealloc ruby_xrealloc
00056 #define xrealloc2 ruby_xrealloc2
00057 #define xfree ruby_xfree
00058
00059 void *xmalloc(size_t);
00060 void *xmalloc2(size_t,size_t);
00061 void *xcalloc(size_t,size_t);
00062 void *xrealloc(void*,size_t);
00063 void *xrealloc2(void*,size_t,size_t);
00064 void xfree(void*);
00065
00066 #define STRINGIZE(expr) STRINGIZE0(expr)
00067 #ifndef STRINGIZE0
00068 #define STRINGIZE0(expr) #expr
00069 #endif
00070
00071 #if SIZEOF_LONG_LONG > 0
00072 # define LONG_LONG long long
00073 #elif SIZEOF___INT64 > 0
00074 # define HAVE_LONG_LONG 1
00075 # define LONG_LONG __int64
00076 # undef SIZEOF_LONG_LONG
00077 # define SIZEOF_LONG_LONG SIZEOF___INT64
00078 #endif
00079
00080 #if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
00081 # define BDIGIT unsigned int
00082 # define SIZEOF_BDIGITS SIZEOF_INT
00083 # define BDIGIT_DBL unsigned LONG_LONG
00084 # define BDIGIT_DBL_SIGNED LONG_LONG
00085 #elif SIZEOF_INT*2 <= SIZEOF_LONG
00086 # define BDIGIT unsigned int
00087 # define SIZEOF_BDIGITS SIZEOF_INT
00088 # define BDIGIT_DBL unsigned long
00089 # define BDIGIT_DBL_SIGNED long
00090 #elif SIZEOF_SHORT*2 <= SIZEOF_LONG
00091 # define BDIGIT unsigned short
00092 # define SIZEOF_BDIGITS SIZEOF_SHORT
00093 # define BDIGIT_DBL unsigned long
00094 # define BDIGIT_DBL_SIGNED long
00095 #else
00096 # define BDIGIT unsigned short
00097 # define SIZEOF_BDIGITS (SIZEOF_LONG/2)
00098 # define BDIGIT_DBL unsigned long
00099 # define BDIGIT_DBL_SIGNED long
00100 #endif
00101
00102 #ifdef INFINITY
00103 # define HAVE_INFINITY
00104 #else
00105
00106 extern const unsigned char rb_infinity[];
00107 # define INFINITY (*(float *)rb_infinity)
00108 #endif
00109
00110 #ifdef NAN
00111 # define HAVE_NAN
00112 #else
00113
00114 extern const unsigned char rb_nan[];
00115 # define NAN (*(float *)rb_nan)
00116 #endif
00117
00118 #ifdef __CYGWIN__
00119 #undef _WIN32
00120 #endif
00121
00122 #if defined(_WIN32) || defined(__EMX__)
00123 #define DOSISH 1
00124 # define DOSISH_DRIVE_LETTER
00125 #endif
00126
00127 #ifdef AC_APPLE_UNIVERSAL_BUILD
00128 #undef WORDS_BIGENDIAN
00129 #ifdef __BIG_ENDIAN__
00130 #define WORDS_BIGENDIAN
00131 #endif
00132 #endif
00133
00134 #ifdef __NeXT__
00135
00136 #ifndef S_IRUSR
00137 #define S_IRUSR 0000400
00138 #endif
00139 #ifndef S_IRGRP
00140 #define S_IRGRP 0000040
00141 #endif
00142 #ifndef S_IROTH
00143 #define S_IROTH 0000004
00144 #endif
00145 #ifndef S_IWUSR
00146 #define S_IWUSR 0000200
00147 #endif
00148 #ifndef S_IWGRP
00149 #define S_IWGRP 0000020
00150 #endif
00151 #ifndef S_IWOTH
00152 #define S_IWOTH 0000002
00153 #endif
00154 #ifndef S_IXUSR
00155 #define S_IXUSR 0000100
00156 #endif
00157 #ifndef S_IXGRP
00158 #define S_IXGRP 0000010
00159 #endif
00160 #ifndef S_IXOTH
00161 #define S_IXOTH 0000001
00162 #endif
00163 #ifndef S_IRWXU
00164 #define S_IRWXU 0000700
00165 #endif
00166 #ifndef S_IRWXG
00167 #define S_IRWXG 0000070
00168 #endif
00169 #ifndef S_IRWXO
00170 #define S_IRWXO 0000007
00171 #endif
00172 #ifndef S_ISBLK
00173 #define S_ISBLK(mode) (((mode) & (0170000)) == (0060000))
00174 #endif
00175 #ifndef S_ISCHR
00176 #define S_ISCHR(mode) (((mode) & (0170000)) == (0020000))
00177 #endif
00178 #ifndef S_ISDIR
00179 #define S_ISDIR(mode) (((mode) & (0170000)) == (0040000))
00180 #endif
00181 #ifndef S_ISFIFO
00182 #define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
00183 #endif
00184 #ifndef S_ISREG
00185 #define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
00186 #endif
00187 #ifndef __APPLE__
00188
00189 #ifndef GETPGRP_VOID
00190 #define GETPGRP_VOID 1
00191 #endif
00192 #ifndef WNOHANG
00193 #define WNOHANG 01
00194 #endif
00195 #ifndef WUNTRACED
00196 #define WUNTRACED 02
00197 #endif
00198 #ifndef X_OK
00199 #define X_OK 1
00200 #endif
00201 #endif
00202 #endif
00203
00204 #ifdef _WIN32
00205 #include "ruby/win32.h"
00206 #endif
00207
00208 #if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
00209 #include <net/socket.h>
00210 #elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H)
00211 # include <sys/select.h>
00212 #endif
00213
00214 #ifdef __SYMBIAN32__
00215 # define FALSE 0
00216 # define TRUE 1
00217 #endif
00218
00219 #ifdef RUBY_EXPORT
00220 #undef RUBY_EXTERN
00221
00222 #ifndef FALSE
00223 # define FALSE 0
00224 #elif FALSE
00225 # error FALSE must be false
00226 #endif
00227 #ifndef TRUE
00228 # define TRUE 1
00229 #elif !TRUE
00230 # error TRUE must be true
00231 #endif
00232
00233 #endif
00234
00235 #ifndef RUBY_EXTERN
00236 #define RUBY_EXTERN extern
00237 #endif
00238
00239 #ifndef EXTERN
00240 #define EXTERN RUBY_EXTERN
00241 #endif
00242
00243 #ifndef RUBY_MBCHAR_MAXSIZE
00244 #define RUBY_MBCHAR_MAXSIZE INT_MAX
00245
00246 #endif
00247
00248 #if defined(sparc) || defined(__sparc__)
00249 static inline void
00250 flush_register_windows(void)
00251 {
00252 asm
00253 #ifdef __GNUC__
00254 volatile
00255 #endif
00256 # if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
00257 ("flushw")
00258 # else
00259 ("ta 0x03")
00260 # endif
00261 ;
00262 }
00263 # define FLUSH_REGISTER_WINDOWS flush_register_windows()
00264 #elif defined(__ia64)
00265 void *rb_ia64_bsp(void);
00266 void rb_ia64_flushrs(void);
00267 # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
00268 #else
00269 # define FLUSH_REGISTER_WINDOWS ((void)0)
00270 #endif
00271
00272 #if defined(DOSISH)
00273 #define PATH_SEP ";"
00274 #else
00275 #define PATH_SEP ":"
00276 #endif
00277 #define PATH_SEP_CHAR PATH_SEP[0]
00278
00279 #define PATH_ENV "PATH"
00280
00281 #if defined(DOSISH) && !defined(__EMX__)
00282 #define ENV_IGNORECASE
00283 #endif
00284
00285 #ifndef CASEFOLD_FILESYSTEM
00286 # if defined DOSISH
00287 # define CASEFOLD_FILESYSTEM 1
00288 # else
00289 # define CASEFOLD_FILESYSTEM 0
00290 # endif
00291 #endif
00292
00293 #ifndef DLEXT_MAXLEN
00294 #define DLEXT_MAXLEN 4
00295 #endif
00296
00297 #ifndef RUBY_PLATFORM
00298 #define RUBY_PLATFORM "unknown-unknown"
00299 #endif
00300
00301 #ifndef RUBY_ALIAS_FUNCTION_TYPE
00302 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
00303 type prot {return name args;}
00304 #endif
00305 #ifndef RUBY_ALIAS_FUNCTION_VOID
00306 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
00307 void prot {name args;}
00308 #endif
00309 #ifndef RUBY_ALIAS_FUNCTION
00310 #define RUBY_ALIAS_FUNCTION(prot, name, args) \
00311 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
00312 #endif
00313
00314 #if defined(__cplusplus)
00315 #if 0
00316 {
00317 #endif
00318 }
00319 #endif
00320
00321 #endif
00322