Ruby
2.0.0p247(2013-06-27revision41674)
|
00001 /************************************************ 00002 00003 defines.h - 00004 00005 $Author: ngoto $ 00006 created at: Wed May 18 00:21:44 JST 1994 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 } /* satisfy cc-mode */ 00017 #endif 00018 #endif 00019 00020 #include "ruby/config.h" 00021 #ifdef RUBY_EXTCONF_H 00022 #include RUBY_EXTCONF_H 00023 #endif 00024 00025 #define RUBY 00026 00027 # include <stddef.h> 00028 #ifdef HAVE_STDLIB_H 00029 # include <stdlib.h> 00030 #endif 00031 #ifdef __cplusplus 00032 # ifndef HAVE_PROTOTYPES 00033 # define HAVE_PROTOTYPES 1 00034 # endif 00035 # ifndef HAVE_STDARG_PROTOTYPES 00036 # define HAVE_STDARG_PROTOTYPES 1 00037 # endif 00038 #endif 00039 00040 #undef _ 00041 #ifdef HAVE_PROTOTYPES 00042 # define _(args) args 00043 #else 00044 # define _(args) () 00045 #endif 00046 00047 #undef __ 00048 #ifdef HAVE_STDARG_PROTOTYPES 00049 # define __(args) args 00050 #else 00051 # define __(args) () 00052 #endif 00053 00054 #ifdef __cplusplus 00055 #define ANYARGS ... 00056 #else 00057 #define ANYARGS 00058 #endif 00059 00060 #if defined __GNUC__ && __GNUC__ >= 4 00061 #pragma GCC visibility push(default) 00062 #endif 00063 00064 #define xmalloc ruby_xmalloc 00065 #define xmalloc2 ruby_xmalloc2 00066 #define xcalloc ruby_xcalloc 00067 #define xrealloc ruby_xrealloc 00068 #define xrealloc2 ruby_xrealloc2 00069 #define xfree ruby_xfree 00070 00071 void *xmalloc(size_t); 00072 void *xmalloc2(size_t,size_t); 00073 void *xcalloc(size_t,size_t); 00074 void *xrealloc(void*,size_t); 00075 void *xrealloc2(void*,size_t,size_t); 00076 void xfree(void*); 00077 00078 #define STRINGIZE(expr) STRINGIZE0(expr) 00079 #ifndef STRINGIZE0 00080 #define STRINGIZE0(expr) #expr 00081 #endif 00082 00083 #if SIZEOF_LONG_LONG > 0 00084 # define LONG_LONG long long 00085 #elif SIZEOF___INT64 > 0 00086 # define HAVE_LONG_LONG 1 00087 # define LONG_LONG __int64 00088 # undef SIZEOF_LONG_LONG 00089 # define SIZEOF_LONG_LONG SIZEOF___INT64 00090 #endif 00091 00092 #if SIZEOF_INT*2 <= SIZEOF_LONG_LONG 00093 # define BDIGIT unsigned int 00094 # define SIZEOF_BDIGITS SIZEOF_INT 00095 # define BDIGIT_DBL unsigned LONG_LONG 00096 # define BDIGIT_DBL_SIGNED LONG_LONG 00097 # define PRI_BDIGIT_PREFIX "" 00098 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX 00099 #elif SIZEOF_INT*2 <= SIZEOF_LONG 00100 # define BDIGIT unsigned int 00101 # define SIZEOF_BDIGITS SIZEOF_INT 00102 # define BDIGIT_DBL unsigned long 00103 # define BDIGIT_DBL_SIGNED long 00104 # define PRI_BDIGIT_PREFIX "" 00105 # define PRI_BDIGIT_DBL_PREFIX "l" 00106 #elif SIZEOF_SHORT*2 <= SIZEOF_LONG 00107 # define BDIGIT unsigned short 00108 # define SIZEOF_BDIGITS SIZEOF_SHORT 00109 # define BDIGIT_DBL unsigned long 00110 # define BDIGIT_DBL_SIGNED long 00111 # define PRI_BDIGIT_PREFIX "h" 00112 # define PRI_BDIGIT_DBL_PREFIX "l" 00113 #else 00114 # define BDIGIT unsigned short 00115 # define SIZEOF_BDIGITS (SIZEOF_LONG/2) 00116 # define BDIGIT_DBL unsigned long 00117 # define BDIGIT_DBL_SIGNED long 00118 # define PRI_BDIGIT_PREFIX "h" 00119 # define PRI_BDIGIT_DBL_PREFIX "l" 00120 #endif 00121 00122 #define PRIdBDIGIT PRI_BDIGIT_PREFIX"d" 00123 #define PRIiBDIGIT PRI_BDIGIT_PREFIX"i" 00124 #define PRIoBDIGIT PRI_BDIGIT_PREFIX"o" 00125 #define PRIuBDIGIT PRI_BDIGIT_PREFIX"u" 00126 #define PRIxBDIGIT PRI_BDIGIT_PREFIX"x" 00127 #define PRIXBDIGIT PRI_BDIGIT_PREFIX"X" 00128 00129 #define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d" 00130 #define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i" 00131 #define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o" 00132 #define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u" 00133 #define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x" 00134 #define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X" 00135 00136 #ifdef __CYGWIN__ 00137 #undef _WIN32 00138 #endif 00139 00140 #if defined(_WIN32) || defined(__EMX__) 00141 #define DOSISH 1 00142 # define DOSISH_DRIVE_LETTER 00143 #endif 00144 00145 #ifdef AC_APPLE_UNIVERSAL_BUILD 00146 #undef WORDS_BIGENDIAN 00147 #ifdef __BIG_ENDIAN__ 00148 #define WORDS_BIGENDIAN 00149 #endif 00150 #endif 00151 00152 #ifdef _WIN32 00153 #include "ruby/win32.h" 00154 #endif 00155 00156 #if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE) 00157 #include <net/socket.h> /* intern.h needs fd_set definition */ 00158 #elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H) 00159 # include <sys/select.h> 00160 #endif 00161 00162 #ifdef __SYMBIAN32__ 00163 # define FALSE 0 00164 # define TRUE 1 00165 #endif 00166 00167 #ifdef RUBY_EXPORT 00168 #undef RUBY_EXTERN 00169 00170 #ifndef FALSE 00171 # define FALSE 0 00172 #elif FALSE 00173 # error FALSE must be false 00174 #endif 00175 #ifndef TRUE 00176 # define TRUE 1 00177 #elif !TRUE 00178 # error TRUE must be true 00179 #endif 00180 00181 #endif 00182 00183 #ifndef RUBY_FUNC_EXPORTED 00184 #define RUBY_FUNC_EXPORTED 00185 #endif 00186 00187 #ifndef RUBY_EXTERN 00188 #define RUBY_EXTERN extern 00189 #endif 00190 00191 #ifndef EXTERN 00192 #define EXTERN RUBY_EXTERN /* deprecated */ 00193 #endif 00194 00195 #ifndef RUBY_MBCHAR_MAXSIZE 00196 #define RUBY_MBCHAR_MAXSIZE INT_MAX 00197 /* MB_CUR_MAX will not work well in C locale */ 00198 #endif 00199 00200 #if defined(__sparc) 00201 void rb_sparc_flush_register_windows(void); 00202 # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows() 00203 #elif defined(__ia64) 00204 void *rb_ia64_bsp(void); 00205 void rb_ia64_flushrs(void); 00206 # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs() 00207 #else 00208 # define FLUSH_REGISTER_WINDOWS ((void)0) 00209 #endif 00210 00211 #if defined(DOSISH) 00212 #define PATH_SEP ";" 00213 #else 00214 #define PATH_SEP ":" 00215 #endif 00216 #define PATH_SEP_CHAR PATH_SEP[0] 00217 00218 #define PATH_ENV "PATH" 00219 00220 #if defined(DOSISH) && !defined(__EMX__) 00221 #define ENV_IGNORECASE 00222 #endif 00223 00224 #ifndef CASEFOLD_FILESYSTEM 00225 # if defined DOSISH 00226 # define CASEFOLD_FILESYSTEM 1 00227 # else 00228 # define CASEFOLD_FILESYSTEM 0 00229 # endif 00230 #endif 00231 00232 #ifndef DLEXT_MAXLEN 00233 #define DLEXT_MAXLEN 4 00234 #endif 00235 00236 #ifndef RUBY_PLATFORM 00237 #define RUBY_PLATFORM "unknown-unknown" 00238 #endif 00239 00240 #ifndef RUBY_ALIAS_FUNCTION_TYPE 00241 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \ 00242 type prot {return name args;} 00243 #endif 00244 #ifndef RUBY_ALIAS_FUNCTION_VOID 00245 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \ 00246 void prot {name args;} 00247 #endif 00248 #ifndef RUBY_ALIAS_FUNCTION 00249 #define RUBY_ALIAS_FUNCTION(prot, name, args) \ 00250 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args) 00251 #endif 00252 00253 #if defined __GNUC__ && __GNUC__ >= 4 00254 #pragma GCC visibility pop 00255 #endif 00256 00257 #if defined(__cplusplus) 00258 #if 0 00259 { /* satisfy cc-mode */ 00260 #endif 00261 } /* extern "C" { */ 00262 #endif 00263 00264 #endif /* RUBY_DEFINES_H */ 00265