~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to include/ruby/defines.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************
 
2
 
 
3
  defines.h -
 
4
 
 
5
  $Author: matz $
 
6
  $Date: 2007-08-29 11:15:03 +0900 (水, 29  8月 2007) $
 
7
  created at: Wed May 18 00:21:44 JST 1994
 
8
 
 
9
************************************************/
 
10
 
 
11
#ifndef RUBY_DEFINES_H
 
12
#define RUBY_DEFINES_H 1
 
13
 
 
14
#if defined(__cplusplus)
 
15
extern "C" {
 
16
#if 0
 
17
} /* satisfy cc-mode */
 
18
#endif
 
19
#endif
 
20
 
 
21
#define RUBY
 
22
 
 
23
#include <stdlib.h>
 
24
#ifdef __cplusplus
 
25
# ifndef  HAVE_PROTOTYPES
 
26
#  define HAVE_PROTOTYPES 1
 
27
# endif
 
28
# ifndef  HAVE_STDARG_PROTOTYPES
 
29
#  define HAVE_STDARG_PROTOTYPES 1
 
30
# endif
 
31
#endif
 
32
 
 
33
#undef _
 
34
#ifdef HAVE_PROTOTYPES
 
35
# define _(args) args
 
36
#else
 
37
# define _(args) ()
 
38
#endif
 
39
 
 
40
#undef __
 
41
#ifdef HAVE_STDARG_PROTOTYPES
 
42
# define __(args) args
 
43
#else
 
44
# define __(args) ()
 
45
#endif
 
46
 
 
47
#ifdef __cplusplus
 
48
#define ANYARGS ...
 
49
#else
 
50
#define ANYARGS
 
51
#endif
 
52
 
 
53
#define xmalloc ruby_xmalloc
 
54
#define xmalloc2 ruby_xmalloc2
 
55
#define xcalloc ruby_xcalloc
 
56
#define xrealloc ruby_xrealloc
 
57
#define xrealloc2 ruby_xrealloc2
 
58
#define xfree ruby_xfree
 
59
 
 
60
void *xmalloc(size_t);
 
61
void *xmalloc2(size_t,size_t);
 
62
void *xcalloc(size_t,size_t);
 
63
void *xrealloc(void*,size_t);
 
64
void *xrealloc2(void*,size_t,size_t);
 
65
void xfree(void*);
 
66
 
 
67
#if SIZEOF_LONG_LONG > 0
 
68
# define LONG_LONG long long
 
69
#elif SIZEOF___INT64 > 0
 
70
# define HAVE_LONG_LONG 1
 
71
# define LONG_LONG __int64
 
72
# undef SIZEOF_LONG_LONG
 
73
# define SIZEOF_LONG_LONG SIZEOF___INT64
 
74
#endif
 
75
 
 
76
#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
 
77
# define BDIGIT unsigned int
 
78
# define SIZEOF_BDIGITS SIZEOF_INT
 
79
# define BDIGIT_DBL unsigned LONG_LONG
 
80
# define BDIGIT_DBL_SIGNED LONG_LONG
 
81
#elif SIZEOF_INT*2 <= SIZEOF_LONG
 
82
# define BDIGIT unsigned int
 
83
# define SIZEOF_BDIGITS SIZEOF_INT
 
84
# define BDIGIT_DBL unsigned long
 
85
# define BDIGIT_DBL_SIGNED long
 
86
#elif SIZEOF_SHORT*2 <= SIZEOF_LONG
 
87
# define BDIGIT unsigned short
 
88
# define SIZEOF_BDIGITS SIZEOF_SHORT
 
89
# define BDIGIT_DBL unsigned long
 
90
# define BDIGIT_DBL_SIGNED long
 
91
#else
 
92
# define BDIGIT unsigned short
 
93
# define SIZEOF_BDIGITS (SIZEOF_LONG/2)
 
94
# define BDIGIT_DBL unsigned long
 
95
# define BDIGIT_DBL_SIGNED long
 
96
#endif
 
97
 
 
98
#ifdef __CYGWIN__
 
99
#undef _WIN32
 
100
#endif
 
101
 
 
102
#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__)
 
103
#define DOSISH 1
 
104
#ifndef _WIN32_WCE
 
105
# define DOSISH_DRIVE_LETTER
 
106
#endif
 
107
#endif
 
108
 
 
109
/* define RUBY_USE_EUC/SJIS for default kanji-code */
 
110
#ifndef DEFAULT_KCODE
 
111
#if defined(DOSISH) || defined(__CYGWIN__) || defined(__MACOS__) || defined(OS2)
 
112
#define DEFAULT_KCODE KCODE_SJIS
 
113
#else
 
114
#define DEFAULT_KCODE KCODE_EUC
 
115
#endif
 
116
#endif
 
117
 
 
118
#ifdef __NeXT__
 
119
/* NextStep, OpenStep, Rhapsody */
 
120
#ifndef S_IRUSR
 
121
#define S_IRUSR 0000400        /* read permission, owner */
 
122
#endif
 
123
#ifndef S_IRGRP
 
124
#define S_IRGRP 0000040        /* read permission, group */
 
125
#endif
 
126
#ifndef S_IROTH
 
127
#define S_IROTH 0000004        /* read permission, other */
 
128
#endif
 
129
#ifndef S_IWUSR
 
130
#define S_IWUSR 0000200        /* write permission, owner */
 
131
#endif
 
132
#ifndef S_IWGRP
 
133
#define S_IWGRP 0000020        /* write permission, group */
 
134
#endif
 
135
#ifndef S_IWOTH
 
136
#define S_IWOTH 0000002        /* write permission, other */
 
137
#endif
 
138
#ifndef S_IXUSR
 
139
#define S_IXUSR 0000100        /* execute/search permission, owner */
 
140
#endif
 
141
#ifndef S_IXGRP
 
142
#define S_IXGRP 0000010        /* execute/search permission, group */
 
143
#endif
 
144
#ifndef S_IXOTH
 
145
#define S_IXOTH 0000001        /* execute/search permission, other */
 
146
#endif
 
147
#ifndef S_IRWXU
 
148
#define S_IRWXU 0000700        /* read, write, execute permissions, owner */
 
149
#endif
 
150
#ifndef S_IRWXG
 
151
#define S_IRWXG 0000070        /* read, write, execute permissions, group */
 
152
#endif
 
153
#ifndef S_IRWXO
 
154
#define S_IRWXO 0000007        /* read, write, execute permissions, other */
 
155
#endif
 
156
#ifndef S_ISBLK
 
157
#define S_ISBLK(mode)  (((mode) & (0170000)) == (0060000))
 
158
#endif
 
159
#ifndef S_ISCHR
 
160
#define S_ISCHR(mode)  (((mode) & (0170000)) == (0020000))
 
161
#endif
 
162
#ifndef S_ISDIR
 
163
#define S_ISDIR(mode)  (((mode) & (0170000)) == (0040000))
 
164
#endif
 
165
#ifndef S_ISFIFO
 
166
#define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
 
167
#endif
 
168
#ifndef S_ISREG
 
169
#define S_ISREG(mode)  (((mode) & (0170000)) == (0100000))
 
170
#endif
 
171
/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
 
172
   result in a different endian.  Instead trust __BIG_ENDIAN__ and
 
173
   __LITTLE_ENDIAN__ which are set correctly by -arch. */
 
174
#undef WORDS_BIGENDIAN
 
175
#ifdef __BIG_ENDIAN__
 
176
#define WORDS_BIGENDIAN
 
177
#endif
 
178
#ifndef __APPLE__
 
179
/* NextStep, OpenStep (but not Rhapsody) */
 
180
#ifndef GETPGRP_VOID
 
181
#define GETPGRP_VOID 1
 
182
#endif
 
183
#ifndef WNOHANG
 
184
#define WNOHANG 01
 
185
#endif
 
186
#ifndef WUNTRACED
 
187
#define WUNTRACED 02
 
188
#endif
 
189
#ifndef X_OK
 
190
#define X_OK 1
 
191
#endif
 
192
#endif /* __APPLE__ */
 
193
#endif /* NeXT */
 
194
 
 
195
#ifdef _WIN32
 
196
#include "ruby/win32.h"
 
197
#endif
 
198
 
 
199
#if defined(__VMS)
 
200
#include "vms/vms.h"
 
201
#endif
 
202
 
 
203
#if defined(__BEOS__)
 
204
#include <net/socket.h> /* intern.h needs fd_set definition */
 
205
#endif
 
206
 
 
207
#ifdef RUBY_EXPORT
 
208
#undef RUBY_EXTERN
 
209
#endif
 
210
 
 
211
#ifndef RUBY_EXTERN
 
212
#define RUBY_EXTERN extern
 
213
#endif
 
214
 
 
215
#ifndef EXTERN
 
216
#define EXTERN RUBY_EXTERN      /* deprecated */
 
217
#endif
 
218
 
 
219
#ifndef RUBY_MBCHAR_MAXSIZE
 
220
#define RUBY_MBCHAR_MAXSIZE INT_MAX
 
221
        /* MB_CUR_MAX will not work well in C locale */
 
222
#endif
 
223
 
 
224
#if defined(sparc) || defined(__sparc__)
 
225
static inline void
 
226
flush_register_windows(void)
 
227
{
 
228
    asm
 
229
#ifdef __GNUC__
 
230
        volatile
 
231
#endif
 
232
# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
 
233
        ("flushw")
 
234
# else
 
235
        ("ta 0x03")
 
236
# endif /* trap always to flush register windows if we are on a Sparc system */
 
237
        ;
 
238
}
 
239
#  define FLUSH_REGISTER_WINDOWS flush_register_windows()
 
240
#elif defined(__ia64)
 
241
void *rb_ia64_bsp(void);
 
242
void rb_ia64_flushrs(void);
 
243
#  define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
 
244
#else
 
245
#  define FLUSH_REGISTER_WINDOWS ((void)0)
 
246
#endif
 
247
 
 
248
#if defined(DOSISH)
 
249
#define PATH_SEP ";"
 
250
#elif defined(riscos)
 
251
#define PATH_SEP ","
 
252
#else
 
253
#define PATH_SEP ":"
 
254
#endif
 
255
#define PATH_SEP_CHAR PATH_SEP[0]
 
256
 
 
257
#if defined(__human68k__)
 
258
#define PATH_ENV "path"
 
259
#else
 
260
#define PATH_ENV "PATH"
 
261
#endif
 
262
 
 
263
#if defined(DOSISH) && !defined(__human68k__) && !defined(__EMX__)
 
264
#define ENV_IGNORECASE
 
265
#endif
 
266
 
 
267
#ifndef DLEXT_MAXLEN
 
268
#define DLEXT_MAXLEN 4
 
269
#endif
 
270
 
 
271
#ifndef RUBY_PLATFORM
 
272
#define RUBY_PLATFORM "unknown-unknown"
 
273
#endif
 
274
 
 
275
#if defined(__cplusplus)
 
276
#if 0
 
277
{ /* satisfy cc-mode */
 
278
#endif
 
279
}  /* extern "C" { */
 
280
#endif
 
281
 
 
282
#endif /* RUBY_DEFINES_H */