10 #ifndef RUBY_DEFINES_H
11 #define RUBY_DEFINES_H 1
13 #if defined(__cplusplus)
20 #include "ruby/config.h"
22 #include RUBY_EXTCONF_H
32 # ifndef HAVE_PROTOTYPES
33 # define HAVE_PROTOTYPES 1
35 # ifndef HAVE_STDARG_PROTOTYPES
36 # define HAVE_STDARG_PROTOTYPES 1
41 #ifdef HAVE_PROTOTYPES
48 #ifdef HAVE_STDARG_PROTOTYPES
49 # define __(args) args
60 #if defined __GNUC__ && __GNUC__ >= 4
61 #pragma GCC visibility push(default)
64 #define xmalloc ruby_xmalloc
65 #define xmalloc2 ruby_xmalloc2
66 #define xcalloc ruby_xcalloc
67 #define xrealloc ruby_xrealloc
68 #define xrealloc2 ruby_xrealloc2
69 #define xfree ruby_xfree
78 #define STRINGIZE(expr) STRINGIZE0(expr)
80 #define STRINGIZE0(expr) #expr
83 #if SIZEOF_LONG_LONG > 0
84 # define LONG_LONG long long
85 #elif SIZEOF___INT64 > 0
86 # define HAVE_LONG_LONG 1
87 # define LONG_LONG __int64
88 # undef SIZEOF_LONG_LONG
89 # define SIZEOF_LONG_LONG SIZEOF___INT64
92 #if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
93 # define BDIGIT unsigned int
94 # define SIZEOF_BDIGITS SIZEOF_INT
95 # define BDIGIT_DBL unsigned LONG_LONG
96 # define BDIGIT_DBL_SIGNED LONG_LONG
97 # define PRI_BDIGIT_PREFIX ""
98 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
99 #elif SIZEOF_INT*2 <= SIZEOF_LONG
100 # define BDIGIT unsigned int
101 # define SIZEOF_BDIGITS SIZEOF_INT
102 # define BDIGIT_DBL unsigned long
103 # define BDIGIT_DBL_SIGNED long
104 # define PRI_BDIGIT_PREFIX ""
105 # define PRI_BDIGIT_DBL_PREFIX "l"
106 #elif SIZEOF_SHORT*2 <= SIZEOF_LONG
107 # define BDIGIT unsigned short
108 # define SIZEOF_BDIGITS SIZEOF_SHORT
109 # define BDIGIT_DBL unsigned long
110 # define BDIGIT_DBL_SIGNED long
111 # define PRI_BDIGIT_PREFIX "h"
112 # define PRI_BDIGIT_DBL_PREFIX "l"
114 # define BDIGIT unsigned short
115 # define SIZEOF_BDIGITS (SIZEOF_LONG/2)
116 # define BDIGIT_DBL unsigned long
117 # define BDIGIT_DBL_SIGNED long
118 # define PRI_BDIGIT_PREFIX "h"
119 # define PRI_BDIGIT_DBL_PREFIX "l"
122 #define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
123 #define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
124 #define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
125 #define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
126 #define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
127 #define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
129 #define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
130 #define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
131 #define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
132 #define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
133 #define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
134 #define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
140 #if defined(_WIN32) || defined(__EMX__)
142 # define DOSISH_DRIVE_LETTER
145 #ifdef AC_APPLE_UNIVERSAL_BUILD
146 #undef WORDS_BIGENDIAN
147 #ifdef __BIG_ENDIAN__
148 #define WORDS_BIGENDIAN
155 #define S_IRUSR 0000400
158 #define S_IRGRP 0000040
161 #define S_IROTH 0000004
164 #define S_IWUSR 0000200
167 #define S_IWGRP 0000020
170 #define S_IWOTH 0000002
173 #define S_IXUSR 0000100
176 #define S_IXGRP 0000010
179 #define S_IXOTH 0000001
182 #define S_IRWXU 0000700
185 #define S_IRWXG 0000070
188 #define S_IRWXO 0000007
191 #define S_ISBLK(mode) (((mode) & (0170000)) == (0060000))
194 #define S_ISCHR(mode) (((mode) & (0170000)) == (0020000))
197 #define S_ISDIR(mode) (((mode) & (0170000)) == (0040000))
200 #define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
203 #define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
208 #define GETPGRP_VOID 1
226 #if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
227 #include <net/socket.h>
228 #elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H)
229 # include <sys/select.h>
243 # error FALSE must be false
248 # error TRUE must be true
253 #ifndef RUBY_FUNC_EXPORTED
254 #define RUBY_FUNC_EXPORTED
258 #define RUBY_EXTERN extern
262 #define EXTERN RUBY_EXTERN
265 #ifndef RUBY_MBCHAR_MAXSIZE
266 #define RUBY_MBCHAR_MAXSIZE INT_MAX
270 #if defined(sparc) || defined(__sparc__)
272 # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
273 #elif defined(__ia64)
274 void *rb_ia64_bsp(
void);
275 void rb_ia64_flushrs(
void);
276 # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
278 # define FLUSH_REGISTER_WINDOWS ((void)0)
286 #define PATH_SEP_CHAR PATH_SEP[0]
288 #define PATH_ENV "PATH"
290 #if defined(DOSISH) && !defined(__EMX__)
291 #define ENV_IGNORECASE
294 #ifndef CASEFOLD_FILESYSTEM
296 # define CASEFOLD_FILESYSTEM 1
298 # define CASEFOLD_FILESYSTEM 0
303 #define DLEXT_MAXLEN 4
306 #ifndef RUBY_PLATFORM
307 #define RUBY_PLATFORM "unknown-unknown"
310 #ifndef RUBY_ALIAS_FUNCTION_TYPE
311 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
312 type prot {return name args;}
314 #ifndef RUBY_ALIAS_FUNCTION_VOID
315 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
316 void prot {name args;}
318 #ifndef RUBY_ALIAS_FUNCTION
319 #define RUBY_ALIAS_FUNCTION(prot, name, args) \
320 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
323 #if defined __GNUC__ && __GNUC__ >= 4
324 #pragma GCC visibility pop
327 #if defined(__cplusplus)
void rb_sparc_flush_register_windows(void)