00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef DEFINES_H
00011 #define DEFINES_H
00012
00013 #define RUBY
00014
00015 #ifdef __cplusplus
00016 # ifndef HAVE_PROTOTYPES
00017 # define HAVE_PROTOTYPES 1
00018 # endif
00019 # ifndef HAVE_STDARG_PROTOTYPES
00020 # define HAVE_STDARG_PROTOTYPES 1
00021 # endif
00022 #endif
00023
00024 #undef _
00025 #ifdef HAVE_PROTOTYPES
00026 # define args args
00027 #else
00028 # define args ()
00029 #endif
00030
00031 #undef __
00032 #ifdef HAVE_STDARG_PROTOTYPES
00033 # define args args
00034 #else
00035 # define args ()
00036 #endif
00037
00038 #ifdef __cplusplus
00039 #define ANYARGS ...
00040 #else
00041 #define ANYARGS
00042 #endif
00043
00044 #define xmalloc ruby_xmalloc
00045 #define xcalloc ruby_xcalloc
00046 #define xrealloc ruby_xrealloc
00047 #define xfree ruby_xfree
00048
00049 void *xmalloc (long);
00050 void *xcalloc (long,long);
00051 void *xrealloc (void*,long);
00052 void xfree (void*);
00053
00054 #if SIZEOF_LONG_LONG > 0
00055 # define LONG_LONG long long
00056 #elif SIZEOF___INT64 > 0
00057 # define HAVE_LONG_LONG 1
00058 # define LONG_LONG __int64
00059 # undef SIZEOF_LONG_LONG
00060 # define SIZEOF_LONG_LONG SIZEOF___INT64
00061 #endif
00062
00063 #if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
00064 # define BDIGIT unsigned int
00065 # define SIZEOF_BDIGITS SIZEOF_INT
00066 # define BDIGIT_DBL unsigned LONG_LONG
00067 # define BDIGIT_DBL_SIGNED LONG_LONG
00068 #elif SIZEOF_INT*2 <= SIZEOF_LONG
00069 # define BDIGIT unsigned int
00070 # define SIZEOF_BDIGITS SIZEOF_INT
00071 # define BDIGIT_DBL unsigned long
00072 # define BDIGIT_DBL_SIGNED long
00073 #elif SIZEOF_SHORT*2 <= SIZEOF_LONG
00074 # define BDIGIT unsigned short
00075 # define SIZEOF_BDIGITS SIZEOF_SHORT
00076 # define BDIGIT_DBL unsigned long
00077 # define BDIGIT_DBL_SIGNED long
00078 #else
00079 # define BDIGIT unsigned short
00080 # define SIZEOF_BDIGITS (SIZEOF_LONG/2)
00081 # define BDIGIT_DBL unsigned long
00082 # define BDIGIT_DBL_SIGNED long
00083 #endif
00084
00085 #ifdef __CYGWIN__
00086 #undef _WIN32
00087 #endif
00088
00089 #if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__)
00090 #define DOSISH 1
00091 #ifndef _WIN32_WCE
00092 # define DOSISH_DRIVE_LETTER
00093 #endif
00094 #endif
00095
00096
00097 #ifndef DEFAULT_KCODE
00098 #if defined(DOSISH) || defined(__CYGWIN__) || defined(__MACOS__) || defined(OS2)
00099 #define DEFAULT_KCODE KCODE_SJIS
00100 #else
00101 #define DEFAULT_KCODE KCODE_EUC
00102 #endif
00103 #endif
00104
00105 #ifdef __NeXT__
00106
00107 #ifndef S_IRUSR
00108 #define S_IRUSR 0000400
00109 #endif
00110 #ifndef S_IRGRP
00111 #define S_IRGRP 0000040
00112 #endif
00113 #ifndef S_IROTH
00114 #define S_IROTH 0000004
00115 #endif
00116 #ifndef S_IWUSR
00117 #define S_IWUSR 0000200
00118 #endif
00119 #ifndef S_IWGRP
00120 #define S_IWGRP 0000020
00121 #endif
00122 #ifndef S_IWOTH
00123 #define S_IWOTH 0000002
00124 #endif
00125 #ifndef S_IXUSR
00126 #define S_IXUSR 0000100
00127 #endif
00128 #ifndef S_IXGRP
00129 #define S_IXGRP 0000010
00130 #endif
00131 #ifndef S_IXOTH
00132 #define S_IXOTH 0000001
00133 #endif
00134 #ifndef S_IRWXU
00135 #define S_IRWXU 0000700
00136 #endif
00137 #ifndef S_IRWXG
00138 #define S_IRWXG 0000070
00139 #endif
00140 #ifndef S_IRWXO
00141 #define S_IRWXO 0000007
00142 #endif
00143 #ifndef S_ISBLK
00144 #define S_ISBLK(mode) (((mode) & (0170000)) == (0060000))
00145 #endif
00146 #ifndef S_ISCHR
00147 #define S_ISCHR(mode) (((mode) & (0170000)) == (0020000))
00148 #endif
00149 #ifndef S_ISDIR
00150 #define S_ISDIR(mode) (((mode) & (0170000)) == (0040000))
00151 #endif
00152 #ifndef S_ISFIFO
00153 #define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
00154 #endif
00155 #ifndef S_ISREG
00156 #define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
00157 #endif
00158
00159
00160
00161 #undef WORDS_BIGENDIAN
00162 #ifdef __BIG_ENDIAN__
00163 #define WORDS_BIGENDIAN
00164 #endif
00165 #ifndef __APPLE__
00166
00167 #ifndef GETPGRP_VOID
00168 #define GETPGRP_VOID 1
00169 #endif
00170 #ifndef WNOHANG
00171 #define WNOHANG 01
00172 #endif
00173 #ifndef WUNTRACED
00174 #define WUNTRACED 02
00175 #endif
00176 #ifndef X_OK
00177 #define X_OK 1
00178 #endif
00179 #endif
00180 #endif
00181
00182 #ifdef _WIN32
00183 #include "win32/win32.h"
00184 #endif
00185
00186 #if defined(__VMS)
00187 #include "vms.h"
00188 #endif
00189
00190 #if defined(__BEOS__)
00191 #include <net/socket.h>
00192 #endif
00193
00194 #ifdef RUBY_EXPORT
00195 #undef RUBY_EXTERN
00196 #endif
00197
00198 #ifndef RUBY_EXTERN
00199 #define RUBY_EXTERN extern
00200 #endif
00201
00202 #ifndef EXTERN
00203 #define EXTERN RUBY_EXTERN
00204 #endif
00205
00206 #if defined(sparc) || defined(__sparc__)
00207 static inline void
00208 flush_register_windows(void)
00209 {
00210 asm
00211 #ifdef __GNUC__
00212 volatile
00213 #endif
00214 # if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
00215 ("flushw")
00216 # elif defined(linux) || defined(__linux__)
00217 ("ta 0x83")
00218 # else
00219 ("ta 0x03")
00220 # endif
00221 ;
00222 }
00223 # define FLUSH_REGISTER_WINDOWS flush_register_windows()
00224 #elif defined(__ia64__)
00225 void flush_register_windows(void)
00226 # if defined(__GNUC__) && (( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3)
00227 __attribute__ ((noinline))
00228 # endif
00229 ;
00230 # define FLUSH_REGISTER_WINDOWS flush_register_windows()
00231 #else
00232 # define FLUSH_REGISTER_WINDOWS ((void)0)
00233 #endif
00234
00235 #if defined(DOSISH)
00236 #define PATH_SEP ";"
00237 #elif defined(riscos)
00238 #define PATH_SEP ","
00239 #else
00240 #define PATH_SEP ":"
00241 #endif
00242 #define PATH_SEP_CHAR PATH_SEP[0]
00243
00244 #if defined(__human68k__)
00245 #define PATH_ENV "path"
00246 #else
00247 #define PATH_ENV "PATH"
00248 #endif
00249
00250 #if defined(DOSISH) && !defined(__human68k__) && !defined(__EMX__)
00251 #define ENV_IGNORECASE
00252 #endif
00253
00254 #ifndef RUBY_PLATFORM
00255 #define RUBY_PLATFORM "unknown-unknown"
00256 #endif
00257
00258 #endif
00259