Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 797 lines (679 sloc) 22.486 kB
817a62d 2000-05-01
matz authored
1 /**********************************************************************
99d0354 Initial revision
matz authored
2
3 ruby.h -
4
5 $Author$
6 created at: Thu Jun 10 14:26:32 JST 1993
7
42bc5d2 Updated Copyrights of Matz to 2003.
michal authored
8 Copyright (C) 1993-2003 Yukihiro Matsumoto
817a62d 2000-05-01
matz authored
9 Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
7dff2ac 2000-05-09
matz authored
10 Copyright (C) 2000 Information-technology Promotion Agency, Japan
99d0354 Initial revision
matz authored
11
817a62d 2000-05-01
matz authored
12 **********************************************************************/
99d0354 Initial revision
matz authored
13
14 #ifndef RUBY_H
15 #define RUBY_H
16
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
17 #if defined(__cplusplus)
18 extern "C" {
31ce26f @nobu * dir.c (ruby_glob): glob function not using ruby exception system.
nobu authored
19 #if 0
20 } /* satisfy cc-mode */
21 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
22 #endif
99d0354 Initial revision
matz authored
23
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
24 #include "config.h"
c4c770e @nobu * ruby.h, lib/mkmf.rb (create_header): clear command line options for
nobu authored
25 #ifdef RUBY_EXTCONF_H
26 #include RUBY_EXTCONF_H
27 #endif
f8e87ab @akr * common.mk, configure.in, defines.h, eval.c, gc.c, main.c,
akr authored
28
29 #define NORETURN_STYLE_NEW 1
30 #ifndef NORETURN
31 # define NORETURN(x) x
32 #endif
33 #ifndef NOINLINE
34 # define NOINLINE(x) x
35 #endif
36
99d0354 Initial revision
matz authored
37 #include "defines.h"
38
39 #ifdef HAVE_STDLIB_H
40 # include <stdlib.h>
41 #endif
42
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
43 #ifdef HAVE_STRING_H
44 # include <string.h>
45 #else
46 # include <strings.h>
47 #endif
48
b83435d @nobu * configure.in (ac_cv_func_setitimer): moved from defines.h
nobu authored
49 #ifdef HAVE_INTRINSICS_H
50 # include <intrinsics.h>
51 #endif
52
4027cb8 @shyouhei merge revision(s) 27721:27725,27738:27740:
shyouhei authored
53 #ifdef HAVE_STDINT_H
54 # include <stdint.h>
55 #endif
56
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
57 #include <stddef.h>
58 #include <stdio.h>
59
60 /* need to include <ctype.h> to use these macros */
c3a66e8 auxiliary routines update.
matz authored
61 #ifndef ISPRINT
8ffd514 @nobu * configure.in (ieeefp.h), numeric.c: needed for finite() on
nobu authored
62 #define ISASCII(c) isascii((int)(unsigned char)(c))
07bb9f2 1.4.0
matz authored
63 #undef ISPRINT
8ffd514 @nobu * configure.in (ieeefp.h), numeric.c: needed for finite() on
nobu authored
64 #define ISPRINT(c) (ISASCII(c) && isprint((int)(unsigned char)(c)))
65 #define ISSPACE(c) (ISASCII(c) && isspace((int)(unsigned char)(c)))
66 #define ISUPPER(c) (ISASCII(c) && isupper((int)(unsigned char)(c)))
67 #define ISLOWER(c) (ISASCII(c) && islower((int)(unsigned char)(c)))
68 #define ISALNUM(c) (ISASCII(c) && isalnum((int)(unsigned char)(c)))
69 #define ISALPHA(c) (ISASCII(c) && isalpha((int)(unsigned char)(c)))
70 #define ISDIGIT(c) (ISASCII(c) && isdigit((int)(unsigned char)(c)))
71 #define ISXDIGIT(c) (ISASCII(c) && isxdigit((int)(unsigned char)(c)))
c3a66e8 auxiliary routines update.
matz authored
72 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
73
8ffd514 @nobu * configure.in (ieeefp.h), numeric.c: needed for finite() on
nobu authored
74 #if defined(HAVE_ALLOCA_H)
99d0354 Initial revision
matz authored
75 #include <alloca.h>
b6c7726 * dln.c, eval.c, gc.c, regex.c, ruby.h: shut up AIX alloca
matz authored
76 #else
77 # ifdef _AIX
99d0354 Initial revision
matz authored
78 #pragma alloca
b6c7726 * dln.c, eval.c, gc.c, regex.c, ruby.h: shut up AIX alloca
matz authored
79 # endif
99d0354 Initial revision
matz authored
80 #endif
81
bbc9eed * the VMS support patch submitted by Akiyoshi, Masamichi
matz authored
82 #if defined(__VMS)
83 # pragma builtins
84 # define alloca __alloca
85 #endif
86
abbcfe3 revered all LLP64 modifies due to portability reason.
matz authored
87 #if SIZEOF_LONG != SIZEOF_VOIDP
88 # error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
89 #else
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
90 typedef unsigned long VALUE;
dbaefe6 19991214
matz authored
91 typedef unsigned long ID;
bf5b73c * ruby.h: support LLP64 model. [ruby-talk:149524]
matz authored
92 #endif
99d0354 Initial revision
matz authored
93
94 #ifdef __STDC__
95 # include <limits.h>
96 #else
97 # ifndef LONG_MAX
98 # ifdef HAVE_LIMITS_H
99 # include <limits.h>
100 # else
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
101 /* assuming 32bit(2's compliment) long */
102 # define LONG_MAX 2147483647
99d0354 Initial revision
matz authored
103 # endif
104 # endif
105 # ifndef LONG_MIN
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
106 # define LONG_MIN (-LONG_MAX-1)
99d0354 Initial revision
matz authored
107 # endif
108 # ifndef CHAR_BIT
109 # define CHAR_BIT 8
110 # endif
111 #endif
112
314e43a * ruby.h: use ifdef (or defined) for macro constants that may or
matz authored
113 #ifdef HAVE_LONG_LONG
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
114 # ifndef LLONG_MAX
115 # ifdef LONG_LONG_MAX
116 # define LLONG_MAX LONG_LONG_MAX
117 # else
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
118 # ifdef _I64_MAX
119 # define LLONG_MAX _I64_MAX
120 # else
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
121 /* assuming 64bit(2's complement) long long */
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
122 # define LLONG_MAX 9223372036854775807LL
123 # endif
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
124 # endif
125 # endif
126 # ifndef LLONG_MIN
127 # ifdef LONG_LONG_MIN
128 # define LLONG_MIN LONG_LONG_MIN
129 # else
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
130 # ifdef _I64_MIN
108d316 @unak * ruby.h (LLONG_MIN): fix typo.
unak authored
131 # define LLONG_MIN _I64_MIN
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
132 # else
133 # define LLONG_MIN (-LLONG_MAX-1)
134 # endif
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
135 # endif
136 # endif
137 #endif
138
99d0354 Initial revision
matz authored
139 #define FIXNUM_MAX (LONG_MAX>>1)
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
140 #define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
99d0354 Initial revision
matz authored
141
142 #define FIXNUM_FLAG 0x01
f0f206d 2000-03-07
matz authored
143 #define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
b53fdf2 * ruby.c (proc_options): unexpected SecurityError happens when -T4.
matz authored
144 #define LONG2FIX(i) INT2FIX(i)
e83d532 2000-02-17
matz authored
145 #define rb_fix_new(v) INT2FIX(v)
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
146 VALUE rb_int2inum _((long));
147 #define INT2NUM(v) rb_int2inum(v)
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
148 #define LONG2NUM(v) INT2NUM(v)
e83d532 2000-02-17
matz authored
149 #define rb_int_new(v) rb_int2inum(v)
dbaefe6 19991214
matz authored
150 VALUE rb_uint2inum _((unsigned long));
151 #define UINT2NUM(v) rb_uint2inum(v)
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
152 #define ULONG2NUM(v) UINT2NUM(v)
e83d532 2000-02-17
matz authored
153 #define rb_uint_new(v) rb_uint2inum(v)
99d0354 Initial revision
matz authored
154
314e43a * ruby.h: use ifdef (or defined) for macro constants that may or
matz authored
155 #ifdef HAVE_LONG_LONG
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
156 VALUE rb_ll2inum _((LONG_LONG));
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
157 #define LL2NUM(v) rb_ll2inum(v)
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
158 VALUE rb_ull2inum _((unsigned LONG_LONG));
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
159 #define ULL2NUM(v) rb_ull2inum(v)
160 #endif
161
996e902 * io.c (rb_io_sysseek): new method based on a patch from Aristarkh
matz authored
162 #if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
163 # define OFFT2NUM(v) LL2NUM(v)
ceaa6bd * ruby.h (OFFT2NUM): use LONG2NUM() if sizeof(long) equals to
matz authored
164 #elif SIZEOF_OFF_T == SIZEOF_LONG
165 # define OFFT2NUM(v) LONG2NUM(v)
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
166 #else
167 # define OFFT2NUM(v) INT2NUM(v)
168 #endif
169
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
170 #define FIX2LONG(x) RSHIFT((long)x,1)
171 #define FIX2ULONG(x) (((unsigned long)(x))>>1)
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
172 #define FIXNUM_P(f) (((long)(f))&FIXNUM_FLAG)
82b2e5e @shyouhei merge revision(s) 17842:
shyouhei authored
173 #define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
99d0354 Initial revision
matz authored
174 #define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
175 #define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
176
f0f206d 2000-03-07
matz authored
177 #define IMMEDIATE_MASK 0x03
178 #define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
179
180 #define SYMBOL_FLAG 0x0e
181 #define SYMBOL_P(x) (((VALUE)(x)&0xff)==SYMBOL_FLAG)
182 #define ID2SYM(x) ((VALUE)(((long)(x))<<8|SYMBOL_FLAG))
1a81d2e * ruby.h (SYM2ID): should not cast to signed long.
matz authored
183 #define SYM2ID(x) RSHIFT((unsigned long)x,8)
f0f206d 2000-03-07
matz authored
184
99d0354 Initial revision
matz authored
185 /* special contants - i.e. non-zero and non-fixnum constants */
f61938d * ruby.h (Qfalse, Qtrue, Qnil, Qundef): make sure these immediate
ocean authored
186 #define Qfalse ((VALUE)0)
187 #define Qtrue ((VALUE)2)
188 #define Qnil ((VALUE)4)
189 #define Qundef ((VALUE)6) /* undefined value for placeholder */
99d0354 Initial revision
matz authored
190
a027f98 matz
matz authored
191 #define RTEST(v) (((VALUE)(v) & ~Qnil) != 0)
99d0354 Initial revision
matz authored
192 #define NIL_P(v) ((VALUE)(v) == Qnil)
193
194 #define CLASS_OF(v) rb_class_of((VALUE)(v))
195
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
196 #define T_NONE 0x00
197
198 #define T_NIL 0x01
199 #define T_OBJECT 0x02
200 #define T_CLASS 0x03
201 #define T_ICLASS 0x04
202 #define T_MODULE 0x05
203 #define T_FLOAT 0x06
204 #define T_STRING 0x07
205 #define T_REGEXP 0x08
206 #define T_ARRAY 0x09
207 #define T_FIXNUM 0x0a
208 #define T_HASH 0x0b
209 #define T_STRUCT 0x0c
210 #define T_BIGNUM 0x0d
211 #define T_FILE 0x0e
99d0354 Initial revision
matz authored
212
213 #define T_TRUE 0x20
214 #define T_FALSE 0x21
215 #define T_DATA 0x22
216 #define T_MATCH 0x23
f0f206d 2000-03-07
matz authored
217 #define T_SYMBOL 0x24
99d0354 Initial revision
matz authored
218
95be9e8 * gc.c (os_live_obj): do not list terminated object.
matz authored
219 #define T_BLKTAG 0x3b
f0f206d 2000-03-07
matz authored
220 #define T_UNDEF 0x3c
b77b7c3 2000-02-01
matz authored
221 #define T_VARMAP 0x3d
222 #define T_SCOPE 0x3e
223 #define T_NODE 0x3f
99d0354 Initial revision
matz authored
224
b77b7c3 2000-02-01
matz authored
225 #define T_MASK 0x3f
99d0354 Initial revision
matz authored
226
227 #define BUILTIN_TYPE(x) (((struct RBasic*)(x))->flags & T_MASK)
228
229 #define TYPE(x) rb_type((VALUE)(x))
230
c4ce86c @shyouhei merge revision(s) 26251:
shyouhei authored
231 #ifdef __GNUC__
232 #define RB_GC_GUARD_PTR(ptr) \
233 __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
234 #else
235 #define RB_GC_GUARD_PTR(ptr) (volatile VALUE *)(ptr)
236 #endif
237 #define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
fad66d2 @knu * ruby.h: New macro: RB_GC_GUARD().
knu authored
238
99d0354 Initial revision
matz authored
239 void rb_check_type _((VALUE,int));
240 #define Check_Type(v,t) rb_check_type((VALUE)(v),t)
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
241
242 VALUE rb_str_to_str _((VALUE));
635b842 @eban * ruby.h (rb_string_value): add volatile to avoid compiler warning.
eban authored
243 VALUE rb_string_value _((volatile VALUE*));
e9a7798 * array.c (rb_ary_become): should not free ptr if it's shared.
matz authored
244 char *rb_string_value_ptr _((volatile VALUE*));
396907e * string.c: use StringValueCStr to retrieve paths to system calls.
matz authored
245 char *rb_string_value_cstr _((volatile VALUE*));
7dba8bc * bignum.c (bigdivrem): access boundary bug.
matz authored
246
715c2de * string.c (rb_str_upto): generate sequence according to "succ"
matz authored
247 #define StringValue(v) rb_string_value(&(v))
84216c4 security enhancement of dl library (need test).
matz authored
248 #define StringValuePtr(v) rb_string_value_ptr(&(v))
396907e * string.c: use StringValueCStr to retrieve paths to system calls.
matz authored
249 #define StringValueCStr(v) rb_string_value_cstr(&(v))
84216c4 security enhancement of dl library (need test).
matz authored
250
251 void rb_check_safe_obj _((VALUE));
99d0354 Initial revision
matz authored
252 void rb_check_safe_str _((VALUE));
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
253 #define SafeStringValue(v) do {\
7dba8bc * bignum.c (bigdivrem): access boundary bug.
matz authored
254 StringValue(v);\
84216c4 security enhancement of dl library (need test).
matz authored
255 rb_check_safe_obj(v);\
3b94766 * object.c (rb_str2cstr): warn if string contains \0 and length
matz authored
256 } while (0)
7dba8bc * bignum.c (bigdivrem): access boundary bug.
matz authored
257 /* obsolete macro - use SafeStringValue(v) */
258 #define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
259
99d0354 Initial revision
matz authored
260 void rb_secure _((int));
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
261 RUBY_EXTERN int ruby_safe_level;
b77b7c3 2000-02-01
matz authored
262 #define rb_safe_level() (ruby_safe_level)
263 void rb_set_safe_level _((int));
e314b13 * io.c (rb_io_initialize): should check rb_secure(4).
matz authored
264 void rb_secure_update _((VALUE));
b77b7c3 2000-02-01
matz authored
265
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
266 long rb_num2long _((VALUE));
267 unsigned long rb_num2ulong _((VALUE));
07bb9f2 1.4.0
matz authored
268 #define NUM2LONG(x) (FIXNUM_P(x)?FIX2LONG(x):rb_num2long((VALUE)x))
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
269 #define NUM2ULONG(x) rb_num2ulong((VALUE)x)
270 #if SIZEOF_INT < SIZEOF_LONG
034ce45 * pack.c (htov16): converts endian using swap16. htov32(), hton16,
matz authored
271 long rb_num2int _((VALUE));
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
272 #define NUM2INT(x) (FIXNUM_P(x)?FIX2INT(x):rb_num2int((VALUE)x))
034ce45 * pack.c (htov16): converts endian using swap16. htov32(), hton16,
matz authored
273 long rb_fix2int _((VALUE));
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
274 #define FIX2INT(x) rb_fix2int((VALUE)x)
034ce45 * pack.c (htov16): converts endian using swap16. htov32(), hton16,
matz authored
275 unsigned long rb_num2uint _((VALUE));
f1a769b @nobu * numeric.c (rb_num2uint, rb_fix2int): new function to convert
nobu authored
276 #define NUM2UINT(x) rb_num2uint(x)
034ce45 * pack.c (htov16): converts endian using swap16. htov32(), hton16,
matz authored
277 unsigned long rb_fix2uint _((VALUE));
f1a769b @nobu * numeric.c (rb_num2uint, rb_fix2int): new function to convert
nobu authored
278 #define FIX2UINT(x) rb_fix2uint(x)
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
279 #else
225c97a @knu * eval.c, file.c, gc.c, io.c, object.c, ruby.c, ruby.h, struct.c,
knu authored
280 #define NUM2INT(x) ((int)NUM2LONG(x))
281 #define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
282 #define FIX2INT(x) ((int)FIX2LONG(x))
283 #define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
284 #endif
285
314e43a * ruby.h: use ifdef (or defined) for macro constants that may or
matz authored
286 #ifdef HAVE_LONG_LONG
c4c42a3 @unak * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
unak authored
287 LONG_LONG rb_num2ll _((VALUE));
288 unsigned LONG_LONG rb_num2ull _((VALUE));
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
289 # define NUM2LL(x) (FIXNUM_P(x)?FIX2LONG(x):rb_num2ll((VALUE)x))
0c3ca9d @akr * configure.in: check sizeof(rlim_t).
akr authored
290 # define NUM2ULL(x) rb_num2ull((VALUE)x)
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
291 #endif
292
314e43a * ruby.h: use ifdef (or defined) for macro constants that may or
matz authored
293 #if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
5e853e4 * re.c (rb_reg_match): should clear $~ if operand is nil.
matz authored
294 # define NUM2OFFT(x) ((off_t)NUM2LL(x))
295 #else
296 # define NUM2OFFT(x) NUM2LONG(x)
297 #endif
298
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
299 double rb_num2dbl _((VALUE));
300 #define NUM2DBL(x) rb_num2dbl((VALUE)(x))
301
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
302 /* obsolete API - use StringValue() */
fa79abb *.c: Int vs Long cleanup
michal authored
303 char *rb_str2cstr _((VALUE,long*));
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
304 /* obsolete API - use StringValuePtr() */
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
305 #define STR2CSTR(x) rb_str2cstr((VALUE)(x),0)
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
306
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
307 #define NUM2CHR(x) (((TYPE(x) == T_STRING)&&(RSTRING(x)->len>=1))?\
07bb9f2 1.4.0
matz authored
308 RSTRING(x)->ptr[0]:(char)(NUM2INT(x)&0xff))
309 #define CHR2FIX(x) INT2FIX((long)((x)&0xff))
99d0354 Initial revision
matz authored
310
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
311 VALUE rb_newobj _((void));
99d0354 Initial revision
matz authored
312 #define NEWOBJ(obj,type) type *obj = (type*)rb_newobj()
d53d108 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
matz authored
313 #define OBJSETUP(obj,c,t) do {\
99d0354 Initial revision
matz authored
314 RBASIC(obj)->flags = (t);\
e0208c1 matz
matz authored
315 RBASIC(obj)->klass = (c);\
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
316 if (rb_safe_level() >= 3) FL_SET(obj, FL_TAINT);\
d53d108 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
matz authored
317 } while (0)
07bb9f2 1.4.0
matz authored
318 #define CLONESETUP(clone,obj) do {\
4112162 * variable.c (rb_copy_generic_ivar): remove old generic instance
matz authored
319 OBJSETUP(clone,rb_singleton_class_clone((VALUE)obj),RBASIC(obj)->flags);\
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
320 rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);\
f6e9837 * regex.c (re_search): should consider reverse search.
matz authored
321 if (FL_TEST(obj, FL_EXIVAR)) rb_copy_generic_ivar((VALUE)clone,(VALUE)obj);\
07bb9f2 1.4.0
matz authored
322 } while (0)
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
323 #define DUPSETUP(dup,obj) do {\
324 OBJSETUP(dup,rb_obj_class(obj),(RBASIC(obj)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT));\
325 if (FL_TEST(obj, FL_EXIVAR)) rb_copy_generic_ivar((VALUE)dup,(VALUE)obj);\
326 } while (0)
99d0354 Initial revision
matz authored
327
328 struct RBasic {
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
329 unsigned long flags;
330 VALUE klass;
99d0354 Initial revision
matz authored
331 };
332
333 struct RObject {
334 struct RBasic basic;
335 struct st_table *iv_tbl;
336 };
337
338 struct RClass {
339 struct RBasic basic;
340 struct st_table *iv_tbl;
341 struct st_table *m_tbl;
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
342 VALUE super;
99d0354 Initial revision
matz authored
343 };
e3b8ed3 @akr * ruby.h (RCLASS_IV_TBL): defined.
akr authored
344 #define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
345 #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
346 #define RCLASS_SUPER(c) (RCLASS(c)->super)
347 #define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
348 #define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
349 #define RMODULE_SUPER(m) RCLASS_SUPER(m)
99d0354 Initial revision
matz authored
350
351 struct RFloat {
352 struct RBasic basic;
353 double value;
354 };
8f03c17 @shyouhei merge revision(s) 24190,24192:
shyouhei authored
355 #define RFLOAT_VALUE(v) (RFLOAT(v)->value)
99d0354 Initial revision
matz authored
356
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
357 #define ELTS_SHARED FL_USER2
358
99d0354 Initial revision
matz authored
359 struct RString {
360 struct RBasic basic;
07bb9f2 1.4.0
matz authored
361 long len;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
362 char *ptr;
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
363 union {
5b79775 capa field in RString, and RArray is now LONG (ruby-lang:458)
michal authored
364 long capa;
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
365 VALUE shared;
366 } aux;
99d0354 Initial revision
matz authored
367 };
830ea45 * ruby.h (RSTRING_PTR): add migration macro.
matz authored
368 #define RSTRING_PTR(s) (RSTRING(s)->ptr)
369 #define RSTRING_LEN(s) (RSTRING(s)->len)
8f03c17 @shyouhei merge revision(s) 24190,24192:
shyouhei authored
370 #define RSTRING_END(s) (RSTRING_PTR(s)+RSTRING_LEN(s))
99d0354 Initial revision
matz authored
371
372 struct RArray {
373 struct RBasic basic;
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
374 long len;
375 union {
5b79775 capa field in RString, and RArray is now LONG (ruby-lang:458)
michal authored
376 long capa;
052bfae * array.c (rb_ary_modify): should copy the internal buffer if the
matz authored
377 VALUE shared;
378 } aux;
99d0354 Initial revision
matz authored
379 VALUE *ptr;
380 };
830ea45 * ruby.h (RSTRING_PTR): add migration macro.
matz authored
381 #define RARRAY_PTR(s) (RARRAY(s)->ptr)
382 #define RARRAY_LEN(s) (RARRAY(s)->len)
99d0354 Initial revision
matz authored
383
384 struct RRegexp {
385 struct RBasic basic;
386 struct re_pattern_buffer *ptr;
07bb9f2 1.4.0
matz authored
387 long len;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
388 char *str;
99d0354 Initial revision
matz authored
389 };
8f03c17 @shyouhei merge revision(s) 24190,24192:
shyouhei authored
390 #define RREGEXP_SRC_PTR(r) (RREGEXP(r)->src)
391 #define RREGEXP_SRC_LEN(r) (RREGEXP(r)->len)
99d0354 Initial revision
matz authored
392
393 struct RHash {
394 struct RBasic basic;
395 struct st_table *tbl;
396 int iter_lev;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
397 VALUE ifnone;
99d0354 Initial revision
matz authored
398 };
663a9de @akr * ruby.h (RHASH_TBL): defined for compatibility to 1.9.
akr authored
399 #define RHASH_TBL(h) (RHASH(h)->tbl)
400 #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
401 #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
402 #define RHASH_SIZE(h) (RHASH(h)->tbl->num_entries)
403 #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
99d0354 Initial revision
matz authored
404
405 struct RFile {
406 struct RBasic basic;
946b981 @nobu * rubyio.h (rb_io_t): renamed from OpenFile.
nobu authored
407 struct rb_io_t *fptr;
99d0354 Initial revision
matz authored
408 };
409
410 struct RData {
411 struct RBasic basic;
dbaefe6 19991214
matz authored
412 void (*dmark) _((void*));
413 void (*dfree) _((void*));
99d0354 Initial revision
matz authored
414 void *data;
415 };
416
417 #define DATA_PTR(dta) (RDATA(dta)->data)
418
27df115 @eban 2000-06-27
eban authored
419 /*
623f789 2000-06-22
matz authored
420 #define RUBY_DATA_FUNC(func) ((void (*)_((void*)))func)
27df115 @eban 2000-06-27
eban authored
421 */
422 typedef void (*RUBY_DATA_FUNC) _((void*));
423
424 VALUE rb_data_object_alloc _((VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
425
d53d108 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
matz authored
426 #define Data_Wrap_Struct(klass,mark,free,sval)\
427 rb_data_object_alloc(klass,sval,(RUBY_DATA_FUNC)mark,(RUBY_DATA_FUNC)free)
27df115 @eban 2000-06-27
eban authored
428
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
429 #define Data_Make_Struct(klass,type,mark,free,sval) (\
99d0354 Initial revision
matz authored
430 sval = ALLOC(type),\
431 memset(sval, 0, sizeof(type)),\
27df115 @eban 2000-06-27
eban authored
432 Data_Wrap_Struct(klass,mark,free,sval)\
99d0354 Initial revision
matz authored
433 )
434
d53d108 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
matz authored
435 #define Data_Get_Struct(obj,type,sval) do {\
99d0354 Initial revision
matz authored
436 Check_Type(obj, T_DATA); \
437 sval = (type*)DATA_PTR(obj);\
d53d108 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
matz authored
438 } while (0)
99d0354 Initial revision
matz authored
439
440 struct RStruct {
441 struct RBasic basic;
07bb9f2 1.4.0
matz authored
442 long len;
99d0354 Initial revision
matz authored
443 VALUE *ptr;
444 };
92bb611 @akr * ruby.h (RSTRUCT_LEN, RSTRUCT_PTR): defined for source level
akr authored
445 #define RSTRUCT_LEN(st) (RSTRUCT(st)->len)
446 #define RSTRUCT_PTR(st) (RSTRUCT(st)->ptr)
99d0354 Initial revision
matz authored
447
448 struct RBignum {
449 struct RBasic basic;
450 char sign;
07bb9f2 1.4.0
matz authored
451 long len;
56e60da 20000105
matz authored
452 void *digits;
99d0354 Initial revision
matz authored
453 };
8f03c17 @shyouhei merge revision(s) 24190,24192:
shyouhei authored
454 #define RBIGNUM_SIGN(b) (RBIGNUM(b)->sign)
455 #define RBIGNUM_SET_SIGN(b,s) (RBIGNUM(b)->sign = (s))
456 #define RBIGNUM_POSITIVE_P(b) RBIGNUM_SIGN(b)
457 #define RBIGNUM_NEGATIVE_P(b) (!RBIGNUM_SIGN(b))
458 #define RBIGNUM_LEN(b) (RBIGNUM(b)->len)
459 #define RBIGNUM_DIGITS(b) (RBIGNUM(b)->digits)
99d0354 Initial revision
matz authored
460
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
461 #define R_CAST(st) (struct st*)
99d0354 Initial revision
matz authored
462 #define RBASIC(obj) (R_CAST(RBasic)(obj))
463 #define ROBJECT(obj) (R_CAST(RObject)(obj))
464 #define RCLASS(obj) (R_CAST(RClass)(obj))
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
465 #define RMODULE(obj) RCLASS(obj)
99d0354 Initial revision
matz authored
466 #define RFLOAT(obj) (R_CAST(RFloat)(obj))
467 #define RSTRING(obj) (R_CAST(RString)(obj))
468 #define RREGEXP(obj) (R_CAST(RRegexp)(obj))
469 #define RARRAY(obj) (R_CAST(RArray)(obj))
470 #define RHASH(obj) (R_CAST(RHash)(obj))
471 #define RDATA(obj) (R_CAST(RData)(obj))
472 #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
473 #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
474 #define RFILE(obj) (R_CAST(RFile)(obj))
475
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
476 #define FL_SINGLETON FL_USER0
b77b7c3 2000-02-01
matz authored
477 #define FL_MARK (1<<6)
478 #define FL_FINALIZE (1<<7)
479 #define FL_TAINT (1<<8)
480 #define FL_EXIVAR (1<<9)
481 #define FL_FREEZE (1<<10)
99d0354 Initial revision
matz authored
482
483 #define FL_USHIFT 11
484
485 #define FL_USER0 (1<<(FL_USHIFT+0))
486 #define FL_USER1 (1<<(FL_USHIFT+1))
487 #define FL_USER2 (1<<(FL_USHIFT+2))
488 #define FL_USER3 (1<<(FL_USHIFT+3))
489 #define FL_USER4 (1<<(FL_USHIFT+4))
490 #define FL_USER5 (1<<(FL_USHIFT+5))
491 #define FL_USER6 (1<<(FL_USHIFT+6))
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
492 #define FL_USER7 (1<<(FL_USHIFT+7))
99d0354 Initial revision
matz authored
493
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
494 #define FL_UMASK (0xff<<FL_USHIFT)
99d0354 Initial revision
matz authored
495
f0f206d 2000-03-07
matz authored
496 #define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
56e60da 20000105
matz authored
497
498 #define FL_ABLE(x) (!SPECIAL_CONST_P(x))
99d0354 Initial revision
matz authored
499 #define FL_TEST(x,f) (FL_ABLE(x)?(RBASIC(x)->flags&(f)):0)
a6dcd4f 2000-05-12
matz authored
500 #define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
501 #define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
502 #define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
99d0354 Initial revision
matz authored
503
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
504 #define OBJ_TAINTED(x) FL_TEST((x), FL_TAINT)
505 #define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
a6dcd4f 2000-05-12
matz authored
506 #define OBJ_INFECT(x,s) do {if (FL_ABLE(x) && FL_ABLE(s)) RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT;} while (0)
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
507
b77b7c3 2000-02-01
matz authored
508 #define OBJ_FROZEN(x) FL_TEST((x), FL_FREEZE)
509 #define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
510
99d0354 Initial revision
matz authored
511 #define ALLOC_N(type,n) (type*)xmalloc(sizeof(type)*(n))
512 #define ALLOC(type) (type*)xmalloc(sizeof(type))
513 #define REALLOC_N(var,type,n) (var)=(type*)xrealloc((char*)(var),sizeof(type)*(n))
514
515 #define ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
516
517 #define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
518 #define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
519 #define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
9e14de6 matz
matz authored
520 #define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
99d0354 Initial revision
matz authored
521
e314b13 * io.c (rb_io_initialize): should check rb_secure(4).
matz authored
522 void rb_obj_infect _((VALUE,VALUE));
523
f9a4209 @knu * dir.c, win32/win32.c, win32/dir.h, ruby.h, intern.h: Bring
knu authored
524 typedef int ruby_glob_func(const char*,VALUE);
acc505b * dir.c (rb_glob, rb_globi): add const.
ocean authored
525 void rb_glob _((const char*,void(*)(const char*,VALUE),VALUE));
526 void rb_globi _((const char*,void(*)(const char*,VALUE),VALUE));
f9a4209 @knu * dir.c, win32/win32.c, win32/dir.h, ruby.h, intern.h: Bring
knu authored
527 int ruby_brace_expand _((const char*,int,ruby_glob_func*,VALUE));
528 int ruby_brace_glob _((const char*,int,ruby_glob_func*,VALUE));
27351b9 @eban see ChangeLog.
eban authored
529
07bb9f2 1.4.0
matz authored
530 VALUE rb_define_class _((const char*,VALUE));
531 VALUE rb_define_module _((const char*));
532 VALUE rb_define_class_under _((VALUE, const char*, VALUE));
533 VALUE rb_define_module_under _((VALUE, const char*));
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
534
99d0354 Initial revision
matz authored
535 void rb_include_module _((VALUE,VALUE));
536 void rb_extend_object _((VALUE,VALUE));
537
07bb9f2 1.4.0
matz authored
538 void rb_define_variable _((const char*,VALUE*));
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
539 void rb_define_virtual_variable _((const char*,VALUE(*)(ANYARGS),void(*)(ANYARGS)));
540 void rb_define_hooked_variable _((const char*,VALUE*,VALUE(*)(ANYARGS),void(*)(ANYARGS)));
31ce26f @nobu * dir.c (ruby_glob): glob function not using ruby exception system.
nobu authored
541 int ruby_glob _((const char*,int,int(*)(const char*,VALUE),VALUE));
542 int ruby_globi _((const char*,int,int(*)(const char*,VALUE),VALUE));
07bb9f2 1.4.0
matz authored
543 void rb_define_readonly_variable _((const char*,VALUE*));
a6dcd4f 2000-05-12
matz authored
544 void rb_define_const _((VALUE,const char*,VALUE));
545 void rb_define_global_const _((const char*,VALUE));
99d0354 Initial revision
matz authored
546
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
547 #define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))func)
548 void rb_define_method _((VALUE,const char*,VALUE(*)(ANYARGS),int));
549 void rb_define_module_function _((VALUE,const char*,VALUE(*)(ANYARGS),int));
550 void rb_define_global_function _((const char*,VALUE(*)(ANYARGS),int));
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
551
07bb9f2 1.4.0
matz authored
552 void rb_undef_method _((VALUE,const char*));
553 void rb_define_alias _((VALUE,const char*,const char*));
554 void rb_define_attr _((VALUE,const char*,int,int));
99d0354 Initial revision
matz authored
555
94e1f8e 2000-02-08
matz authored
556 void rb_global_variable _((VALUE*));
557 void rb_gc_register_address _((VALUE*));
558 void rb_gc_unregister_address _((VALUE*));
559
07bb9f2 1.4.0
matz authored
560 ID rb_intern _((const char*));
5376e8a @knu Merge from ruby_1_8.
knu authored
561 const char *rb_id2name _((ID));
99d0354 Initial revision
matz authored
562 ID rb_to_id _((VALUE));
563
5376e8a @knu Merge from ruby_1_8.
knu authored
564 const char *rb_class2name _((VALUE));
565 const char *rb_obj_classname _((VALUE));
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
566
567 void rb_p _((VALUE));
99d0354 Initial revision
matz authored
568
07bb9f2 1.4.0
matz authored
569 VALUE rb_eval_string _((const char*));
570 VALUE rb_eval_string_protect _((const char*, int*));
571 VALUE rb_eval_string_wrap _((const char*, int*));
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
572 VALUE rb_funcall __((VALUE, ID, int, ...));
5550197 * re.c (rb_reg_expr_str): should treat backslash specially in
matz authored
573 VALUE rb_funcall2 _((VALUE, ID, int, const VALUE*));
574 VALUE rb_funcall3 _((VALUE, ID, int, const VALUE*));
575 int rb_scan_args __((int, const VALUE*, const char*, ...));
576 VALUE rb_call_super _((int, const VALUE*));
99d0354 Initial revision
matz authored
577
0d2a064 19991117
matz authored
578 VALUE rb_gv_set _((const char*, VALUE));
579 VALUE rb_gv_get _((const char*));
07bb9f2 1.4.0
matz authored
580 VALUE rb_iv_get _((VALUE, const char*));
581 VALUE rb_iv_set _((VALUE, const char*, VALUE));
99d0354 Initial revision
matz authored
582
583 VALUE rb_equal _((VALUE,VALUE));
584
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
585 RUBY_EXTERN VALUE ruby_verbose, ruby_debug;
99d0354 Initial revision
matz authored
586
10293da @eban setres[ug]id, NORETURN
eban authored
587 NORETURN(void rb_raise __((VALUE, const char*, ...)));
588 NORETURN(void rb_fatal __((const char*, ...)));
589 NORETURN(void rb_bug __((const char*, ...)));
590 NORETURN(void rb_sys_fail _((const char*)));
591 NORETURN(void rb_iter_break _((void)));
592 NORETURN(void rb_exit _((int)));
593 NORETURN(void rb_notimplement _((void)));
99d0354 Initial revision
matz authored
594
07bb9f2 1.4.0
matz authored
595 void rb_warning __((const char*, ...)); /* reports if `-w' specified */
8485eea * string.c (rb_str_substr): "a"[1,2] should return ""; need
matz authored
596 void rb_sys_warning __((const char*, ...)); /* reports if `-w' specified */
597 void rb_warn __((const char*, ...)); /* reports always */
99d0354 Initial revision
matz authored
598
7c65674 @knu * ruby.h (rb_block_call_func): Fix prototype.
knu authored
599 typedef VALUE rb_block_call_func _((VALUE, VALUE));
cde1e57 @knu * enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,
knu authored
600
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
601 VALUE rb_each _((VALUE));
602 VALUE rb_yield _((VALUE));
eb0c965 * eval.c (rb_yield_0): give warning for multiple values for a
matz authored
603 VALUE rb_yield_values __((int n, ...));
ce9aba0 * enum.c (inject_i): use rb_yield_values.
matz authored
604 VALUE rb_yield_splat _((VALUE));
4ff5e66 2000-05-24
matz authored
605 int rb_block_given_p _((void));
3a9bbe2 @nobu * enum.c (enum_min_by, enum_max_by): return nil if no iteration.
nobu authored
606 void rb_need_block _((void));
55c4221 * parse.y (str_extend): shuould allow interpolation of $-x.
matz authored
607 VALUE rb_iterate _((VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE));
7678f4b * eval.c (block_pass): should not downgrade safe level.
matz authored
608 VALUE rb_rescue _((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE));
609 VALUE rb_rescue2 __((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...));
610 VALUE rb_ensure _((VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE));
611 VALUE rb_catch _((const char*,VALUE(*)(ANYARGS),VALUE));
10293da @eban setres[ug]id, NORETURN
eban authored
612 NORETURN(void rb_throw _((const char*,VALUE)));
07bb9f2 1.4.0
matz authored
613
614 VALUE rb_require _((const char*));
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
615
f8e87ab @akr * common.mk, configure.in, defines.h, eval.c, gc.c, main.c,
akr authored
616 #ifdef __ia64
617 void ruby_init_stack(VALUE*, void*);
618 #define RUBY_INIT_STACK \
619 VALUE variable_in_this_stack_frame; \
620 ruby_init_stack(&variable_in_this_stack_frame, rb_ia64_bsp());
621 #else
622 void ruby_init_stack(VALUE*);
623 #define RUBY_INIT_STACK \
624 VALUE variable_in_this_stack_frame; \
625 ruby_init_stack(&variable_in_this_stack_frame);
626 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
627 void ruby_init _((void));
628 void ruby_options _((int, char**));
a3cf62c @nobu * intern.h (ruby_stop): never return.
nobu authored
629 NORETURN(void ruby_run _((void)));
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
630
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
631 RUBY_EXTERN VALUE rb_mKernel;
632 RUBY_EXTERN VALUE rb_mComparable;
633 RUBY_EXTERN VALUE rb_mEnumerable;
634 RUBY_EXTERN VALUE rb_mPrecision;
635 RUBY_EXTERN VALUE rb_mErrno;
636 RUBY_EXTERN VALUE rb_mFileTest;
637 RUBY_EXTERN VALUE rb_mGC;
638 RUBY_EXTERN VALUE rb_mMath;
639 RUBY_EXTERN VALUE rb_mProcess;
640
641 RUBY_EXTERN VALUE rb_cObject;
642 RUBY_EXTERN VALUE rb_cArray;
643 RUBY_EXTERN VALUE rb_cBignum;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
644 RUBY_EXTERN VALUE rb_cBinding;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
645 RUBY_EXTERN VALUE rb_cClass;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
646 RUBY_EXTERN VALUE rb_cCont;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
647 RUBY_EXTERN VALUE rb_cDir;
648 RUBY_EXTERN VALUE rb_cData;
cde1e57 @knu * enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,
knu authored
649 RUBY_EXTERN VALUE rb_cEnumerator;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
650 RUBY_EXTERN VALUE rb_cFalseClass;
651 RUBY_EXTERN VALUE rb_cFile;
652 RUBY_EXTERN VALUE rb_cFixnum;
653 RUBY_EXTERN VALUE rb_cFloat;
654 RUBY_EXTERN VALUE rb_cHash;
655 RUBY_EXTERN VALUE rb_cInteger;
656 RUBY_EXTERN VALUE rb_cIO;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
657 RUBY_EXTERN VALUE rb_cMatch;
b558a48 * array.c (rb_ary_pop): may cause realloc oscillation. a patch
matz authored
658 RUBY_EXTERN VALUE rb_cMethod;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
659 RUBY_EXTERN VALUE rb_cModule;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
660 RUBY_EXTERN VALUE rb_cNameErrorMesg;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
661 RUBY_EXTERN VALUE rb_cNilClass;
662 RUBY_EXTERN VALUE rb_cNumeric;
663 RUBY_EXTERN VALUE rb_cProc;
664 RUBY_EXTERN VALUE rb_cRange;
665 RUBY_EXTERN VALUE rb_cRegexp;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
666 RUBY_EXTERN VALUE rb_cStat;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
667 RUBY_EXTERN VALUE rb_cString;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
668 RUBY_EXTERN VALUE rb_cStruct;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
669 RUBY_EXTERN VALUE rb_cSymbol;
670 RUBY_EXTERN VALUE rb_cThread;
671 RUBY_EXTERN VALUE rb_cTime;
672 RUBY_EXTERN VALUE rb_cTrueClass;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
673 RUBY_EXTERN VALUE rb_cUnboundMethod;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
674
675 RUBY_EXTERN VALUE rb_eException;
676 RUBY_EXTERN VALUE rb_eStandardError;
677 RUBY_EXTERN VALUE rb_eSystemExit;
678 RUBY_EXTERN VALUE rb_eInterrupt;
679 RUBY_EXTERN VALUE rb_eSignal;
680 RUBY_EXTERN VALUE rb_eFatal;
681 RUBY_EXTERN VALUE rb_eArgError;
682 RUBY_EXTERN VALUE rb_eEOFError;
683 RUBY_EXTERN VALUE rb_eIndexError;
8b85487 @knu * enumerator.c (rb_eStopIteration), eval.c (rb_f_loop), ruby.h:
knu authored
684 RUBY_EXTERN VALUE rb_eStopIteration;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
685 RUBY_EXTERN VALUE rb_eRangeError;
686 RUBY_EXTERN VALUE rb_eIOError;
687 RUBY_EXTERN VALUE rb_eRuntimeError;
688 RUBY_EXTERN VALUE rb_eSecurityError;
689 RUBY_EXTERN VALUE rb_eSystemCallError;
4646793 * eval.c (rb_thread_save_context, rb_thread_restore_context):
why authored
690 RUBY_EXTERN VALUE rb_eThreadError;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
691 RUBY_EXTERN VALUE rb_eTypeError;
692 RUBY_EXTERN VALUE rb_eZeroDivError;
693 RUBY_EXTERN VALUE rb_eNotImpError;
694 RUBY_EXTERN VALUE rb_eNoMemError;
695 RUBY_EXTERN VALUE rb_eNoMethodError;
696 RUBY_EXTERN VALUE rb_eFloatDomainError;
0bee190 * ruby.h: export classes/modules to implement sandbox.
matz authored
697 RUBY_EXTERN VALUE rb_eLocalJumpError;
698 RUBY_EXTERN VALUE rb_eSysStackError;
699 RUBY_EXTERN VALUE rb_eRegexpError;
23b715b @nobu * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
nobu authored
700
701 RUBY_EXTERN VALUE rb_eScriptError;
702 RUBY_EXTERN VALUE rb_eNameError;
703 RUBY_EXTERN VALUE rb_eSyntaxError;
704 RUBY_EXTERN VALUE rb_eLoadError;
705
691e3ab * eval.c (error_pos): use $deferr for output instead of stderr
matz authored
706 RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr;
707 RUBY_EXTERN VALUE ruby_errinfo;
389789c @nobu * intern.h: add prototypes.
nobu authored
708
6731d42 * eval.c (rb_mod_define_method): should have clear method cache.
matz authored
709 static inline VALUE
f4b24c2 @nobu * dln.h, ruby.h, util.h: enable prototypes in C++.
nobu authored
710 #if defined(HAVE_PROTOTYPES)
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
711 rb_class_of(VALUE obj)
712 #else
8e07079 * ruby.h: better inline function support.
matz authored
713 rb_class_of(obj)
714 VALUE obj;
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
715 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
716 {
717 if (FIXNUM_P(obj)) return rb_cFixnum;
718 if (obj == Qnil) return rb_cNilClass;
719 if (obj == Qfalse) return rb_cFalseClass;
720 if (obj == Qtrue) return rb_cTrueClass;
f0f206d 2000-03-07
matz authored
721 if (SYMBOL_P(obj)) return rb_cSymbol;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
722
723 return RBASIC(obj)->klass;
724 }
725
6731d42 * eval.c (rb_mod_define_method): should have clear method cache.
matz authored
726 static inline int
f4b24c2 @nobu * dln.h, ruby.h, util.h: enable prototypes in C++.
nobu authored
727 #if defined(HAVE_PROTOTYPES)
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
728 rb_type(VALUE obj)
729 #else
8e07079 * ruby.h: better inline function support.
matz authored
730 rb_type(obj)
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
731 VALUE obj;
732 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
733 {
734 if (FIXNUM_P(obj)) return T_FIXNUM;
735 if (obj == Qnil) return T_NIL;
736 if (obj == Qfalse) return T_FALSE;
737 if (obj == Qtrue) return T_TRUE;
817a62d 2000-05-01
matz authored
738 if (obj == Qundef) return T_UNDEF;
f0f206d 2000-03-07
matz authored
739 if (SYMBOL_P(obj)) return T_SYMBOL;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
740 return BUILTIN_TYPE(obj);
741 }
742
6731d42 * eval.c (rb_mod_define_method): should have clear method cache.
matz authored
743 static inline int
f4b24c2 @nobu * dln.h, ruby.h, util.h: enable prototypes in C++.
nobu authored
744 #if defined(HAVE_PROTOTYPES)
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
745 rb_special_const_p(VALUE obj)
746 #else
8e07079 * ruby.h: better inline function support.
matz authored
747 rb_special_const_p(obj)
748 VALUE obj;
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
749 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
750 {
56e60da 20000105
matz authored
751 if (SPECIAL_CONST_P(obj)) return Qtrue;
07bb9f2 1.4.0
matz authored
752 return Qfalse;
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
753 }
5cf6ffb * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
matz authored
754
0a4dd34 @eban * forgot to commit.
eban authored
755 #include "missing.h"
8d727b1 @nobu * intern.h: provide proper prototypes. [ruby-core:02724]
nobu authored
756 #include "intern.h"
d951f65 This commit was generated by cvs2svn to compensate for changes in r11,
matz authored
757
99d0354 Initial revision
matz authored
758 #if defined(EXTLIB) && defined(USE_DLN_A_OUT)
759 /* hook for external modules */
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
760 static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
99d0354 Initial revision
matz authored
761 #endif
762
f2abcf8 * configure.in: always check existence of the pthread library
nagai authored
763 #if defined(HAVE_LIBPTHREAD)
a18d0b9 * check existence of "pthread.h"
nagai authored
764 #ifdef HAVE_PTHREAD_H
765 #include <pthread.h>
766 #endif
f2abcf8 * configure.in: always check existence of the pthread library
nagai authored
767 typedef pthread_t rb_nativethread_t;
768 # define NATIVETHREAD_CURRENT() pthread_self()
769 # define NATIVETHREAD_EQUAL(t1,t2) pthread_equal((t1),(t2))
770 # define HAVE_NATIVETHREAD
08132d7 * signal.c (ruby_nativethread_signal, posix_nativethread_signal,
nagai authored
771
772 # define NATIVETHREAD_KILL(th,sig) pthread_kill((th),(sig))
773 # define HAVE_NATIVETHREAD_KILL
4d325d3 @eban * ruby.h: don't treat Cygwin as Windows.
eban authored
774 #elif defined(_WIN32) || defined(_WIN32_WCE)
f2abcf8 * configure.in: always check existence of the pthread library
nagai authored
775 typedef DWORD rb_nativethread_t;
776 # define NATIVETHREAD_CURRENT() GetCurrentThreadId()
777 # define NATIVETHREAD_EQUAL(t1,t2) ((t1) == (t2))
778 # define HAVE_NATIVETHREAD
779 #endif
a18d0b9 * check existence of "pthread.h"
nagai authored
780 #ifdef HAVE_NATIVETHREAD
08132d7 * signal.c (ruby_nativethread_signal, posix_nativethread_signal,
nagai authored
781 int is_ruby_native_thread _((void));
a18d0b9 * check existence of "pthread.h"
nagai authored
782 #else
783 #define is_ruby_native_thread() (1)
784 #endif
08132d7 * signal.c (ruby_nativethread_signal, posix_nativethread_signal,
nagai authored
785 #ifdef HAVE_NATIVETHREAD_KILL
786 void ruby_native_thread_kill _((int));
787 #endif
f2abcf8 * configure.in: always check existence of the pthread library
nagai authored
788
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
789 #if defined(__cplusplus)
31ce26f @nobu * dir.c (ruby_glob): glob function not using ruby exception system.
nobu authored
790 #if 0
791 { /* satisfy cc-mode */
792 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
793 } /* extern "C" { */
99d0354 Initial revision
matz authored
794 #endif
a2af08d This commit was generated by cvs2svn to compensate for changes in r372,
matz authored
795
796 #endif /* ifndef RUBY_H */
Something went wrong with that request. Please try again.