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 #include "ruby/config.h"
00021 #ifdef RUBY_EXTCONF_H
00022 #include RUBY_EXTCONF_H
00023 #endif
00024
00025
00026 #include <stdio.h>
00027 #ifdef HAVE_SYS_TYPES_H
00028 # include <sys/types.h>
00029 #endif
00030 #ifdef HAVE_SYS_STAT_H
00031 # include <sys/stat.h>
00032 #endif
00033 #ifdef STDC_HEADERS
00034 # include <stdlib.h>
00035 # include <stddef.h>
00036 #else
00037 # ifdef HAVE_STDLIB_H
00038 # include <stdlib.h>
00039 # endif
00040 #endif
00041 #ifdef HAVE_STRING_H
00042 # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
00043 # include <memory.h>
00044 # endif
00045 # include <string.h>
00046 #endif
00047 #ifdef HAVE_STRINGS_H
00048 # include <strings.h>
00049 #endif
00050 #ifdef HAVE_INTTYPES_H
00051 # include <inttypes.h>
00052 #endif
00053 #ifdef HAVE_STDINT_H
00054 # include <stdint.h>
00055 #endif
00056 #ifdef HAVE_UNISTD_H
00057 # include <unistd.h>
00058 #endif
00059
00060 #ifdef HAVE_SYS_SELECT_H
00061 # include <sys/select.h>
00062 #endif
00063
00064 #if defined HAVE_SETJMPEX_H && defined HAVE__SETJMPEX
00065 #include <setjmpex.h>
00066 #endif
00067
00068 #include "ruby/missing.h"
00069
00070 #define RUBY
00071
00072 #ifdef __cplusplus
00073 # ifndef HAVE_PROTOTYPES
00074 # define HAVE_PROTOTYPES 1
00075 # endif
00076 # ifndef HAVE_STDARG_PROTOTYPES
00077 # define HAVE_STDARG_PROTOTYPES 1
00078 # endif
00079 #endif
00080
00081 #undef _
00082 #ifdef HAVE_PROTOTYPES
00083 # define _(args) args
00084 #else
00085 # define _(args) ()
00086 #endif
00087
00088 #undef __
00089 #ifdef HAVE_STDARG_PROTOTYPES
00090 # define __(args) args
00091 #else
00092 # define __(args) ()
00093 #endif
00094
00095 #ifdef __cplusplus
00096 #define ANYARGS ...
00097 #else
00098 #define ANYARGS
00099 #endif
00100
00101 #ifndef RUBY_SYMBOL_EXPORT_BEGIN
00102 # define RUBY_SYMBOL_EXPORT_BEGIN
00103 # define RUBY_SYMBOL_EXPORT_END
00104 #endif
00105
00106 RUBY_SYMBOL_EXPORT_BEGIN
00107
00108 #define xmalloc ruby_xmalloc
00109 #define xmalloc2 ruby_xmalloc2
00110 #define xcalloc ruby_xcalloc
00111 #define xrealloc ruby_xrealloc
00112 #define xrealloc2 ruby_xrealloc2
00113 #define xfree ruby_xfree
00114
00115 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
00116 # define RUBY_ATTR_ALLOC_SIZE(params) __attribute__ ((__alloc_size__ params))
00117 #else
00118 # define RUBY_ATTR_ALLOC_SIZE(params)
00119 #endif
00120
00121 void *xmalloc(size_t) RUBY_ATTR_ALLOC_SIZE((1));
00122 void *xmalloc2(size_t,size_t) RUBY_ATTR_ALLOC_SIZE((1,2));
00123 void *xcalloc(size_t,size_t) RUBY_ATTR_ALLOC_SIZE((1,2));
00124 void *xrealloc(void*,size_t) RUBY_ATTR_ALLOC_SIZE((2));
00125 void *xrealloc2(void*,size_t,size_t) RUBY_ATTR_ALLOC_SIZE((2,3));
00126 void xfree(void*);
00127
00128 #define STRINGIZE(expr) STRINGIZE0(expr)
00129 #ifndef STRINGIZE0
00130 #define STRINGIZE0(expr) #expr
00131 #endif
00132
00133 #ifdef HAVE_LONG_LONG
00134 # define HAVE_TRUE_LONG_LONG 1
00135 #endif
00136
00137 #if SIZEOF_LONG_LONG > 0
00138 # define LONG_LONG long long
00139 #elif SIZEOF___INT64 > 0
00140 # define HAVE_LONG_LONG 1
00141 # define LONG_LONG __int64
00142 # undef SIZEOF_LONG_LONG
00143 # define SIZEOF_LONG_LONG SIZEOF___INT64
00144 #endif
00145
00146 #ifndef BDIGIT
00147 # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
00148 # define BDIGIT unsigned int
00149 # define SIZEOF_BDIGITS SIZEOF_INT
00150 # define BDIGIT_DBL unsigned LONG_LONG
00151 # define BDIGIT_DBL_SIGNED LONG_LONG
00152 # define PRI_BDIGIT_PREFIX ""
00153 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
00154 # elif SIZEOF_INT*2 <= SIZEOF_LONG
00155 # define BDIGIT unsigned int
00156 # define SIZEOF_BDIGITS SIZEOF_INT
00157 # define BDIGIT_DBL unsigned long
00158 # define BDIGIT_DBL_SIGNED long
00159 # define PRI_BDIGIT_PREFIX ""
00160 # define PRI_BDIGIT_DBL_PREFIX "l"
00161 # elif SIZEOF_SHORT*2 <= SIZEOF_LONG
00162 # define BDIGIT unsigned short
00163 # define SIZEOF_BDIGITS SIZEOF_SHORT
00164 # define BDIGIT_DBL unsigned long
00165 # define BDIGIT_DBL_SIGNED long
00166 # define PRI_BDIGIT_PREFIX "h"
00167 # define PRI_BDIGIT_DBL_PREFIX "l"
00168 # else
00169 # define BDIGIT unsigned short
00170 # define SIZEOF_BDIGITS (SIZEOF_LONG/2)
00171 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
00172 # define BDIGIT_DBL unsigned long
00173 # define BDIGIT_DBL_SIGNED long
00174 # define PRI_BDIGIT_PREFIX "h"
00175 # define PRI_BDIGIT_DBL_PREFIX "l"
00176 # endif
00177 #endif
00178 #ifndef SIZEOF_ACTUAL_BDIGIT
00179 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGITS
00180 #endif
00181
00182 #ifdef PRI_BDIGIT_PREFIX
00183 # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
00184 # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
00185 # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
00186 # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
00187 # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
00188 # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
00189 #endif
00190
00191 #ifdef PRI_BDIGIT_DBL_PREFIX
00192 # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
00193 # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
00194 # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
00195 # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
00196 # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
00197 # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
00198 #endif
00199
00200 #ifdef __CYGWIN__
00201 #undef _WIN32
00202 #endif
00203
00204 #if defined(_WIN32) || defined(__EMX__)
00205 #define DOSISH 1
00206 # define DOSISH_DRIVE_LETTER
00207 #endif
00208
00209 #ifdef AC_APPLE_UNIVERSAL_BUILD
00210 #undef WORDS_BIGENDIAN
00211 #ifdef __BIG_ENDIAN__
00212 #define WORDS_BIGENDIAN
00213 #endif
00214 #endif
00215
00216 #ifdef _WIN32
00217 #include "ruby/win32.h"
00218 #endif
00219
00220 #if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
00221 #include <net/socket.h>
00222 #endif
00223
00224 #ifdef __SYMBIAN32__
00225 # define FALSE 0
00226 # define TRUE 1
00227 #endif
00228
00229 #ifdef RUBY_EXPORT
00230 #undef RUBY_EXTERN
00231
00232 #ifndef FALSE
00233 # define FALSE 0
00234 #elif FALSE
00235 # error FALSE must be false
00236 #endif
00237 #ifndef TRUE
00238 # define TRUE 1
00239 #elif !TRUE
00240 # error TRUE must be true
00241 #endif
00242
00243 #endif
00244
00245 #ifndef RUBY_FUNC_EXPORTED
00246 #define RUBY_FUNC_EXPORTED
00247 #endif
00248
00249 #ifndef RUBY_EXTERN
00250 #define RUBY_EXTERN extern
00251 #endif
00252
00253 #ifndef EXTERN
00254 #define EXTERN RUBY_EXTERN
00255 #endif
00256
00257 #ifndef RUBY_MBCHAR_MAXSIZE
00258 #define RUBY_MBCHAR_MAXSIZE INT_MAX
00259
00260 #endif
00261
00262 #if defined(__sparc)
00263 void rb_sparc_flush_register_windows(void);
00264 # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
00265 #elif defined(__ia64)
00266 void *rb_ia64_bsp(void);
00267 void rb_ia64_flushrs(void);
00268 # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
00269 #else
00270 # define FLUSH_REGISTER_WINDOWS ((void)0)
00271 #endif
00272
00273 #if defined(DOSISH)
00274 #define PATH_SEP ";"
00275 #else
00276 #define PATH_SEP ":"
00277 #endif
00278 #define PATH_SEP_CHAR PATH_SEP[0]
00279
00280 #define PATH_ENV "PATH"
00281
00282 #if defined(DOSISH) && !defined(__EMX__)
00283 #define ENV_IGNORECASE
00284 #endif
00285
00286 #ifndef CASEFOLD_FILESYSTEM
00287 # if defined DOSISH
00288 # define CASEFOLD_FILESYSTEM 1
00289 # else
00290 # define CASEFOLD_FILESYSTEM 0
00291 # endif
00292 #endif
00293
00294 #ifndef DLEXT_MAXLEN
00295 #define DLEXT_MAXLEN 4
00296 #endif
00297
00298 #ifndef RUBY_PLATFORM
00299 #define RUBY_PLATFORM "unknown-unknown"
00300 #endif
00301
00302 #ifndef RUBY_ALIAS_FUNCTION_TYPE
00303 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
00304 type prot {return name args;}
00305 #endif
00306 #ifndef RUBY_ALIAS_FUNCTION_VOID
00307 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
00308 void prot {name args;}
00309 #endif
00310 #ifndef RUBY_ALIAS_FUNCTION
00311 #define RUBY_ALIAS_FUNCTION(prot, name, args) \
00312 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
00313 #endif
00314
00315 RUBY_SYMBOL_EXPORT_END
00316
00317 #if defined(__cplusplus)
00318 #if 0
00319 {
00320 #endif
00321 }
00322 #endif
00323
00324 #endif
00325