Ruby 2.1.5p273(2014-11-13revision48405)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

ruby.h
Go to the documentation of this file.
1 /**********************************************************************
2
3 ruby/ruby.h -
4
5 $Author: ko1 $
6 created at: Thu Jun 10 14:26:32 JST 1993
7
8 Copyright (C) 1993-2008 Yukihiro Matsumoto
9 Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
10 Copyright (C) 2000 Information-technology Promotion Agency, Japan
11
12 **********************************************************************/
13
14 #ifndef RUBY_RUBY_H
15 #define RUBY_RUBY_H 1
16
17 #if defined(__cplusplus)
18 extern "C" {
19 #if 0
20 } /* satisfy cc-mode */
21 #endif
22 #endif
23
24 #include "ruby/config.h"
25 #ifdef RUBY_EXTCONF_H
26 #include RUBY_EXTCONF_H
27 #endif
28
29 #include "defines.h"
30
31 #define NORETURN_STYLE_NEW 1
32 #ifndef NORETURN
33 # define NORETURN(x) x
34 #endif
35 #ifndef DEPRECATED
36 # define DEPRECATED(x) x
37 #endif
38 #ifndef NOINLINE
39 # define NOINLINE(x) x
40 #endif
41 #ifndef UNREACHABLE
42 # define UNREACHABLE /* unreachable */
43 #endif
44
45 #ifdef __GNUC__
46 #define PRINTF_ARGS(decl, string_index, first_to_check) \
47 decl __attribute__((format(printf, string_index, first_to_check)))
48 #else
49 #define PRINTF_ARGS(decl, string_index, first_to_check) decl
50 #endif
51
52 #ifdef HAVE_INTRINSICS_H
53 # include <intrinsics.h>
54 #endif
55
56 #include <stdarg.h>
57
58 RUBY_SYMBOL_EXPORT_BEGIN
59
60 /* Make alloca work the best possible way. */
61 #ifdef __GNUC__
62 # ifndef atarist
63 # ifndef alloca
64 # define alloca __builtin_alloca
65 # endif
66 # endif /* atarist */
67 #else
68 # ifdef HAVE_ALLOCA_H
69 # include <alloca.h>
70 # else
71 # ifdef _AIX
72 #pragma alloca
73 # else
74 # ifndef alloca /* predefined by HP cc +Olibcalls */
75 void *alloca();
76 # endif
77 # endif /* AIX */
78 # endif /* HAVE_ALLOCA_H */
79 #endif /* __GNUC__ */
80
81 #if defined HAVE_UINTPTR_T && 0
82 typedef uintptr_t VALUE;
83 typedef uintptr_t ID;
84 # define SIGNED_VALUE intptr_t
85 # define SIZEOF_VALUE SIZEOF_UINTPTR_T
86 # undef PRI_VALUE_PREFIX
87 #elif SIZEOF_LONG == SIZEOF_VOIDP
88 typedef unsigned long VALUE;
89 typedef unsigned long ID;
90 # define SIGNED_VALUE long
91 # define SIZEOF_VALUE SIZEOF_LONG
92 # define PRI_VALUE_PREFIX "l"
93 #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
94 typedef unsigned LONG_LONG VALUE;
95 typedef unsigned LONG_LONG ID;
96 # define SIGNED_VALUE LONG_LONG
97 # define LONG_LONG_VALUE 1
98 # define SIZEOF_VALUE SIZEOF_LONG_LONG
99 # define PRI_VALUE_PREFIX PRI_LL_PREFIX
100 #else
101 # error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
102 #endif
103
104 typedef char ruby_check_sizeof_int[SIZEOF_INT == sizeof(int) ? 1 : -1];
105 typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1];
106 #ifdef HAVE_LONG_LONG
107 typedef char ruby_check_sizeof_long_long[SIZEOF_LONG_LONG == sizeof(LONG_LONG) ? 1 : -1];
108 #endif
109 typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
110
111 #ifndef PRI_INT_PREFIX
112 #define PRI_INT_PREFIX ""
113 #endif
114 #ifndef PRI_LONG_PREFIX
115 #define PRI_LONG_PREFIX "l"
116 #endif
117
118 #if SIZEOF_LONG == 8
119 #define PRI_64_PREFIX PRI_LONG_PREFIX
120 #elif SIZEOF_LONG_LONG == 8
121 #define PRI_64_PREFIX PRI_LL_PREFIX
122 #endif
123
124 #if defined PRIdPTR && !defined PRI_VALUE_PREFIX
125 #define PRIdVALUE PRIdPTR
126 #define PRIoVALUE PRIoPTR
127 #define PRIuVALUE PRIuPTR
128 #define PRIxVALUE PRIxPTR
129 #define PRIXVALUE PRIXPTR
130 #define PRIsVALUE PRIiPTR
131 #else
132 #define PRIdVALUE PRI_VALUE_PREFIX"d"
133 #define PRIoVALUE PRI_VALUE_PREFIX"o"
134 #define PRIuVALUE PRI_VALUE_PREFIX"u"
135 #define PRIxVALUE PRI_VALUE_PREFIX"x"
136 #define PRIXVALUE PRI_VALUE_PREFIX"X"
137 #define PRIsVALUE PRI_VALUE_PREFIX"i"
138 #endif
139 #ifndef PRI_VALUE_PREFIX
140 # define PRI_VALUE_PREFIX ""
141 #endif
142
143 #ifndef PRI_TIMET_PREFIX
144 # if SIZEOF_TIME_T == SIZEOF_INT
145 # define PRI_TIMET_PREFIX
146 # elif SIZEOF_TIME_T == SIZEOF_LONG
147 # define PRI_TIMET_PREFIX "l"
148 # elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
149 # define PRI_TIMET_PREFIX PRI_LL_PREFIX
150 # endif
151 #endif
152
153 #if defined PRI_PTRDIFF_PREFIX
154 #elif SIZEOF_PTRDIFF_T == SIZEOF_INT
155 # define PRI_PTRDIFF_PREFIX ""
156 #elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
157 # define PRI_PTRDIFF_PREFIX "l"
158 #elif SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
159 # define PRI_PTRDIFF_PREFIX PRI_LL_PREFIX
160 #endif
161 #define PRIdPTRDIFF PRI_PTRDIFF_PREFIX"d"
162 #define PRIiPTRDIFF PRI_PTRDIFF_PREFIX"i"
163 #define PRIoPTRDIFF PRI_PTRDIFF_PREFIX"o"
164 #define PRIuPTRDIFF PRI_PTRDIFF_PREFIX"u"
165 #define PRIxPTRDIFF PRI_PTRDIFF_PREFIX"x"
166 #define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X"
167
168 #if defined PRI_SIZE_PREFIX
169 #elif SIZEOF_SIZE_T == SIZEOF_INT
170 # define PRI_SIZE_PREFIX ""
171 #elif SIZEOF_SIZE_T == SIZEOF_LONG
172 # define PRI_SIZE_PREFIX "l"
173 #elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
174 # define PRI_SIZE_PREFIX PRI_LL_PREFIX
175 #endif
176 #define PRIdSIZE PRI_SIZE_PREFIX"d"
177 #define PRIiSIZE PRI_SIZE_PREFIX"i"
178 #define PRIoSIZE PRI_SIZE_PREFIX"o"
179 #define PRIuSIZE PRI_SIZE_PREFIX"u"
180 #define PRIxSIZE PRI_SIZE_PREFIX"x"
181 #define PRIXSIZE PRI_SIZE_PREFIX"X"
182
183 #ifdef __STDC__
184 # include <limits.h>
185 #else
186 # ifndef LONG_MAX
187 # ifdef HAVE_LIMITS_H
188 # include <limits.h>
189 # else
190 /* assuming 32bit(2's complement) long */
191 # define LONG_MAX 2147483647
192 # endif
193 # endif
194 # ifndef LONG_MIN
195 # define LONG_MIN (-LONG_MAX-1)
196 # endif
197 # ifndef CHAR_BIT
198 # define CHAR_BIT 8
199 # endif
200 #endif
201
202 #ifdef HAVE_LONG_LONG
203 # ifndef LLONG_MAX
204 # ifdef LONG_LONG_MAX
205 # define LLONG_MAX LONG_LONG_MAX
206 # else
207 # ifdef _I64_MAX
208 # define LLONG_MAX _I64_MAX
209 # else
210 /* assuming 64bit(2's complement) long long */
211 # define LLONG_MAX 9223372036854775807LL
212 # endif
213 # endif
214 # endif
215 # ifndef LLONG_MIN
216 # ifdef LONG_LONG_MIN
217 # define LLONG_MIN LONG_LONG_MIN
218 # else
219 # ifdef _I64_MIN
220 # define LLONG_MIN _I64_MIN
221 # else
222 # define LLONG_MIN (-LLONG_MAX-1)
223 # endif
224 # endif
225 # endif
226 #endif
227
228 #define FIXNUM_MAX (LONG_MAX>>1)
229 #define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
230
231 #define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
232 #define LONG2FIX(i) INT2FIX(i)
233 #define rb_fix_new(v) INT2FIX(v)
234 VALUE rb_int2inum(SIGNED_VALUE);
235
236 #define rb_int_new(v) rb_int2inum(v)
237 VALUE rb_uint2inum(VALUE);
238
239 #define rb_uint_new(v) rb_uint2inum(v)
240
241 #ifdef HAVE_LONG_LONG
242 VALUE rb_ll2inum(LONG_LONG);
243 #define LL2NUM(v) rb_ll2inum(v)
244 VALUE rb_ull2inum(unsigned LONG_LONG);
245 #define ULL2NUM(v) rb_ull2inum(v)
246 #endif
247
248 #ifndef OFFT2NUM
249 #if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
250 # define OFFT2NUM(v) LL2NUM(v)
251 #elif SIZEOF_OFF_T == SIZEOF_LONG
252 # define OFFT2NUM(v) LONG2NUM(v)
253 #else
254 # define OFFT2NUM(v) INT2NUM(v)
255 #endif
256 #endif
257
258 #if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
259 # define SIZET2NUM(v) ULL2NUM(v)
260 # define SSIZET2NUM(v) LL2NUM(v)
261 #elif SIZEOF_SIZE_T == SIZEOF_LONG
262 # define SIZET2NUM(v) ULONG2NUM(v)
263 # define SSIZET2NUM(v) LONG2NUM(v)
264 #else
265 # define SIZET2NUM(v) UINT2NUM(v)
266 # define SSIZET2NUM(v) INT2NUM(v)
267 #endif
268
269 #ifndef SIZE_MAX
270 # if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
271 # define SIZE_MAX ULLONG_MAX
272 # define SIZE_MIN ULLONG_MIN
273 # elif SIZEOF_SIZE_T == SIZEOF_LONG
274 # define SIZE_MAX ULONG_MAX
275 # define SIZE_MIN ULONG_MIN
276 # elif SIZEOF_SIZE_T == SIZEOF_INT
277 # define SIZE_MAX UINT_MAX
278 # define SIZE_MIN UINT_MIN
279 # else
280 # define SIZE_MAX USHRT_MAX
281 # define SIZE_MIN USHRT_MIN
282 # endif
283 #endif
284
285 #ifndef SSIZE_MAX
286 # if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
287 # define SSIZE_MAX LLONG_MAX
288 # define SSIZE_MIN LLONG_MIN
289 # elif SIZEOF_SIZE_T == SIZEOF_LONG
290 # define SSIZE_MAX LONG_MAX
291 # define SSIZE_MIN LONG_MIN
292 # elif SIZEOF_SIZE_T == SIZEOF_INT
293 # define SSIZE_MAX INT_MAX
294 # define SSIZE_MIN INT_MIN
295 # else
296 # define SSIZE_MAX SHRT_MAX
297 # define SSIZE_MIN SHRT_MIN
298 # endif
299 #endif
300
301 #if SIZEOF_INT < SIZEOF_VALUE
302 NORETURN(void rb_out_of_int(SIGNED_VALUE num));
303 #endif
304
305 #if SIZEOF_INT < SIZEOF_LONG
306 static inline int
307 rb_long2int_inline(long n)
308 {
309 int i = (int)n;
310 if ((long)i != n)
311 rb_out_of_int(n);
312
313 return i;
314 }
315 #define rb_long2int(n) rb_long2int_inline(n)
316 #else
317 #define rb_long2int(n) ((int)(n))
318 #endif
319
320 #ifndef PIDT2NUM
321 #define PIDT2NUM(v) LONG2NUM(v)
322 #endif
323 #ifndef NUM2PIDT
324 #define NUM2PIDT(v) NUM2LONG(v)
325 #endif
326 #ifndef UIDT2NUM
327 #define UIDT2NUM(v) LONG2NUM(v)
328 #endif
329 #ifndef NUM2UIDT
330 #define NUM2UIDT(v) NUM2LONG(v)
331 #endif
332 #ifndef GIDT2NUM
333 #define GIDT2NUM(v) LONG2NUM(v)
334 #endif
335 #ifndef NUM2GIDT
336 #define NUM2GIDT(v) NUM2LONG(v)
337 #endif
338 #ifndef NUM2MODET
339 #define NUM2MODET(v) NUM2INT(v)
340 #endif
341 #ifndef MODET2NUM
342 #define MODET2NUM(v) INT2NUM(v)
343 #endif
344
345 #define FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1))
346 #define FIX2ULONG(x) ((unsigned long)FIX2LONG(x))
347 #define FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&FIXNUM_FLAG)
348 #define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
349 #define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
350 #define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
351
352 #define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
353
354 #define SYMBOL_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
355 #define ID2SYM(x) (((VALUE)(x)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
356 #define SYM2ID(x) RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT)
357
358 #ifndef USE_FLONUM
359 #if SIZEOF_VALUE >= SIZEOF_DOUBLE
360 #define USE_FLONUM 1
361 #else
362 #define USE_FLONUM 0
363 #endif
364 #endif
365
366 #if USE_FLONUM
367 #define FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&FLONUM_MASK) == FLONUM_FLAG)
368 #else
369 #define FLONUM_P(x) 0
370 #endif
371
372 /* Module#methods, #singleton_methods and so on return Symbols */
373 #define USE_SYMBOL_AS_METHOD_NAME 1
374
375 /*
376 !USE_FLONUM
377 -------------------------
378 ...xxxx xxx1 Fixnum
379 ...0000 1110 Symbol
380 ...0000 0000 Qfalse
381 ...0000 0010 Qtrue
382 ...0000 0100 Qnil
383 ...0000 0110 Qundef
384
385 USE_FLONUM
386 -------------------------
387 ...xxxx xxx1 Fixnum
388 ...xxxx xx10 Flonum
389 ...0000 1100 Symbol
390 ...0000 0000 Qfalse 0x00 = 0
391 ...0000 1000 Qnil 0x08 = 8
392 ...0001 0100 Qtrue 0x14 = 20
393 ...0011 0100 Qundef 0x34 = 52
394 */
395
396 /* special constants - i.e. non-zero and non-fixnum constants */
397 enum ruby_special_consts {
398 #if USE_FLONUM
399 RUBY_Qfalse = 0x00,
400 RUBY_Qtrue = 0x14,
401 RUBY_Qnil = 0x08,
402 RUBY_Qundef = 0x34,
403
404 RUBY_IMMEDIATE_MASK = 0x07,
405 RUBY_FIXNUM_FLAG = 0x01,
406 RUBY_FLONUM_MASK = 0x03,
407 RUBY_FLONUM_FLAG = 0x02,
408 RUBY_SYMBOL_FLAG = 0x0c,
409 RUBY_SPECIAL_SHIFT = 8
410 #else
411 RUBY_Qfalse = 0,
412 RUBY_Qtrue = 2,
413 RUBY_Qnil = 4,
414 RUBY_Qundef = 6,
415
416 RUBY_IMMEDIATE_MASK = 0x03,
417 RUBY_FIXNUM_FLAG = 0x01,
418 RUBY_FLONUM_MASK = 0x00, /* any values ANDed with FLONUM_MASK cannot be FLONUM_FLAG */
419 RUBY_FLONUM_FLAG = 0x02,
420 RUBY_SYMBOL_FLAG = 0x0e,
421 RUBY_SPECIAL_SHIFT = 8
422 #endif
423 };
424
425 #define Qfalse ((VALUE)RUBY_Qfalse)
426 #define Qtrue ((VALUE)RUBY_Qtrue)
427 #define Qnil ((VALUE)RUBY_Qnil)
428 #define Qundef ((VALUE)RUBY_Qundef) /* undefined value for placeholder */
429 #define IMMEDIATE_MASK RUBY_IMMEDIATE_MASK
430 #define FIXNUM_FLAG RUBY_FIXNUM_FLAG
431 #if USE_FLONUM
432 #define FLONUM_MASK RUBY_FLONUM_MASK
433 #define FLONUM_FLAG RUBY_FLONUM_FLAG
434 #endif
435 #define SYMBOL_FLAG RUBY_SYMBOL_FLAG
436
437 #define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
438 #define NIL_P(v) !((VALUE)(v) != Qnil)
439
440 #define CLASS_OF(v) rb_class_of((VALUE)(v))
441
442 enum ruby_value_type {
443 RUBY_T_NONE = 0x00,
444
445 RUBY_T_OBJECT = 0x01,
446 RUBY_T_CLASS = 0x02,
447 RUBY_T_MODULE = 0x03,
448 RUBY_T_FLOAT = 0x04,
449 RUBY_T_STRING = 0x05,
450 RUBY_T_REGEXP = 0x06,
451 RUBY_T_ARRAY = 0x07,
452 RUBY_T_HASH = 0x08,
453 RUBY_T_STRUCT = 0x09,
454 RUBY_T_BIGNUM = 0x0a,
455 RUBY_T_FILE = 0x0b,
456 RUBY_T_DATA = 0x0c,
457 RUBY_T_MATCH = 0x0d,
458 RUBY_T_COMPLEX = 0x0e,
459 RUBY_T_RATIONAL = 0x0f,
460
461 RUBY_T_NIL = 0x11,
462 RUBY_T_TRUE = 0x12,
463 RUBY_T_FALSE = 0x13,
464 RUBY_T_SYMBOL = 0x14,
465 RUBY_T_FIXNUM = 0x15,
466
467 RUBY_T_UNDEF = 0x1b,
468 RUBY_T_NODE = 0x1c,
469 RUBY_T_ICLASS = 0x1d,
470 RUBY_T_ZOMBIE = 0x1e,
471
472 RUBY_T_MASK = 0x1f
473 };
474
475 #define T_NONE RUBY_T_NONE
476 #define T_NIL RUBY_T_NIL
477 #define T_OBJECT RUBY_T_OBJECT
478 #define T_CLASS RUBY_T_CLASS
479 #define T_ICLASS RUBY_T_ICLASS
480 #define T_MODULE RUBY_T_MODULE
481 #define T_FLOAT RUBY_T_FLOAT
482 #define T_STRING RUBY_T_STRING
483 #define T_REGEXP RUBY_T_REGEXP
484 #define T_ARRAY RUBY_T_ARRAY
485 #define T_HASH RUBY_T_HASH
486 #define T_STRUCT RUBY_T_STRUCT
487 #define T_BIGNUM RUBY_T_BIGNUM
488 #define T_FILE RUBY_T_FILE
489 #define T_FIXNUM RUBY_T_FIXNUM
490 #define T_TRUE RUBY_T_TRUE
491 #define T_FALSE RUBY_T_FALSE
492 #define T_DATA RUBY_T_DATA
493 #define T_MATCH RUBY_T_MATCH
494 #define T_SYMBOL RUBY_T_SYMBOL
495 #define T_RATIONAL RUBY_T_RATIONAL
496 #define T_COMPLEX RUBY_T_COMPLEX
497 #define T_UNDEF RUBY_T_UNDEF
498 #define T_NODE RUBY_T_NODE
499 #define T_ZOMBIE RUBY_T_ZOMBIE
500 #define T_MASK RUBY_T_MASK
501
502 #define BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & T_MASK)
503
504 static inline int rb_type(VALUE obj);
505 #define TYPE(x) rb_type((VALUE)(x))
506
507 /* RB_GC_GUARD_PTR() is an intermediate macro, and has no effect by
508 * itself. don't use it directly */
509 #ifdef __GNUC__
510 #define RB_GC_GUARD_PTR(ptr) \
511 __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
512 #else
513 #ifdef _MSC_VER
514 #pragma optimize("", off)
515 static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
516 #pragma optimize("", on)
517 #else
518 volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr);
519 #define HAVE_RB_GC_GUARDED_PTR 1
520 #endif
521 #define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
522 #endif
523 #define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
524
525 #ifdef __GNUC__
526 #define RB_UNUSED_VAR(x) x __attribute__ ((unused))
527 #else
528 #define RB_UNUSED_VAR(x) x
529 #endif
530
531 void rb_check_type(VALUE,int);
532 #define Check_Type(v,t) rb_check_type((VALUE)(v),(t))
533
534 VALUE rb_str_to_str(VALUE);
535 VALUE rb_string_value(volatile VALUE*);
536 char *rb_string_value_ptr(volatile VALUE*);
537 char *rb_string_value_cstr(volatile VALUE*);
538
539 #define StringValue(v) rb_string_value(&(v))
540 #define StringValuePtr(v) rb_string_value_ptr(&(v))
541 #define StringValueCStr(v) rb_string_value_cstr(&(v))
542
543 void rb_check_safe_obj(VALUE);
544 DEPRECATED(void rb_check_safe_str(VALUE));
545 #define SafeStringValue(v) do {\
546 StringValue(v);\
547 rb_check_safe_obj(v);\
548 } while (0)
549 /* obsolete macro - use SafeStringValue(v) */
550 #define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
551
552 VALUE rb_str_export(VALUE);
553 #define ExportStringValue(v) do {\
554 SafeStringValue(v);\
555 (v) = rb_str_export(v);\
556 } while (0)
557 VALUE rb_str_export_locale(VALUE);
558
559 VALUE rb_get_path(VALUE);
560 #define FilePathValue(v) (RB_GC_GUARD(v) = rb_get_path(v))
561
562 VALUE rb_get_path_no_checksafe(VALUE);
563 #define FilePathStringValue(v) ((v) = rb_get_path_no_checksafe(v))
564
565 #define RUBY_SAFE_LEVEL_MAX 3
566 void rb_secure(int);
567 int rb_safe_level(void);
568 void rb_set_safe_level(int);
569 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
570 int ruby_safe_level_4_error(void) __attribute__((error("$SAFE=4 is obsolete")));
571 int ruby_safe_level_4_warning(void) __attribute__((warning("$SAFE=4 is obsolete")));
572 # ifdef RUBY_EXPORT
573 # define ruby_safe_level_4_warning() ruby_safe_level_4_error()
574 # endif
575 #define RUBY_SAFE_LEVEL_INVALID_P(level) \
576 __extension__(__builtin_constant_p(level) && \
577 ((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level)))
578 #define RUBY_SAFE_LEVEL_CHECK(level, type) \
579 (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_4_##type() : (level))
580 #define rb_secure(level) rb_secure(RUBY_SAFE_LEVEL_CHECK(level, warning))
581 #define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error))
582 #endif
583 void rb_set_safe_level_force(int);
584 void rb_secure_update(VALUE);
585 NORETURN(void rb_insecure_operation(void));
586
587 VALUE rb_errinfo(void);
588 void rb_set_errinfo(VALUE);
589
590 SIGNED_VALUE rb_num2long(VALUE);
591 VALUE rb_num2ulong(VALUE);
592 static inline long
593 rb_num2long_inline(VALUE x)
594 {
595 if (FIXNUM_P(x))
596 return FIX2LONG(x);
597 else
598 return (long)rb_num2long(x);
599 }
600 #define NUM2LONG(x) rb_num2long_inline(x)
601 static inline unsigned long
602 rb_num2ulong_inline(VALUE x)
603 {
604 if (FIXNUM_P(x))
605 return (unsigned long)FIX2LONG(x);
606 else
607 return (unsigned long)rb_num2ulong(x);
608 }
609 #define NUM2ULONG(x) rb_num2ulong_inline(x)
610 #if SIZEOF_INT < SIZEOF_LONG
611 long rb_num2int(VALUE);
612 long rb_fix2int(VALUE);
613 #define FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
614
615 static inline int
616 rb_num2int_inline(VALUE x)
617 {
618 if (FIXNUM_P(x))
619 return FIX2INT(x);
620 else
621 return (int)rb_num2int(x);
622 }
623 #define NUM2INT(x) rb_num2int_inline(x)
624
625 unsigned long rb_num2uint(VALUE);
626 #define NUM2UINT(x) ((unsigned int)rb_num2uint(x))
627 unsigned long rb_fix2uint(VALUE);
628 #define FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
629 #else /* SIZEOF_INT < SIZEOF_LONG */
630 #define NUM2INT(x) ((int)NUM2LONG(x))
631 #define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
632 #define FIX2INT(x) ((int)FIX2LONG(x))
633 #define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
634 #endif /* SIZEOF_INT < SIZEOF_LONG */
635
636 short rb_num2short(VALUE);
637 unsigned short rb_num2ushort(VALUE);
638 short rb_fix2short(VALUE);
639 unsigned short rb_fix2ushort(VALUE);
640 #define FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
641 static inline short
642 rb_num2short_inline(VALUE x)
643 {
644 if (FIXNUM_P(x))
645 return FIX2SHORT(x);
646 else
647 return rb_num2short(x);
648 }
649
650 #define NUM2SHORT(x) rb_num2short_inline(x)
651 #define NUM2USHORT(x) rb_num2ushort(x)
652
653 #ifdef HAVE_LONG_LONG
654 LONG_LONG rb_num2ll(VALUE);
655 unsigned LONG_LONG rb_num2ull(VALUE);
656 static inline LONG_LONG
657 rb_num2ll_inline(VALUE x)
658 {
659 if (FIXNUM_P(x))
660 return FIX2LONG(x);
661 else
662 return rb_num2ll(x);
663 }
664 # define NUM2LL(x) rb_num2ll_inline(x)
665 # define NUM2ULL(x) rb_num2ull(x)
666 #endif
667
668 #if !defined(NUM2OFFT)
669 # if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
670 # define NUM2OFFT(x) ((off_t)NUM2LL(x))
671 # else
672 # define NUM2OFFT(x) NUM2LONG(x)
673 # endif
674 #endif
675
676 #if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
677 # define NUM2SIZET(x) ((size_t)NUM2ULL(x))
678 # define NUM2SSIZET(x) ((ssize_t)NUM2LL(x))
679 #else
680 # define NUM2SIZET(x) NUM2ULONG(x)
681 # define NUM2SSIZET(x) NUM2LONG(x)
682 #endif
683
684 double rb_num2dbl(VALUE);
685 #define NUM2DBL(x) rb_num2dbl((VALUE)(x))
686
687 VALUE rb_uint2big(VALUE);
688 VALUE rb_int2big(SIGNED_VALUE);
689
690 VALUE rb_newobj(void);
691 VALUE rb_newobj_of(VALUE, VALUE);
692 VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
693 #define NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
694 #define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
695 #define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
696 #define CLONESETUP(clone,obj) do {\
697 OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
698 rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)(clone));\
699 if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(clone),(VALUE)(obj));\
700 } while (0)
701 #define DUPSETUP(dup,obj) do {\
702 OBJSETUP((dup),rb_obj_class(obj), (RBASIC(obj)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT)); \
703 if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(dup),(VALUE)(obj));\
704 } while (0)
705
706 #ifndef USE_RGENGC
707 #define USE_RGENGC 1
708 #endif
709
710 #ifndef RGENGC_WB_PROTECTED_ARRAY
711 #define RGENGC_WB_PROTECTED_ARRAY 1
712 #endif
713 #ifndef RGENGC_WB_PROTECTED_HASH
714 #define RGENGC_WB_PROTECTED_HASH 1
715 #endif
716 #ifndef RGENGC_WB_PROTECTED_STRUCT
717 #define RGENGC_WB_PROTECTED_STRUCT 1
718 #endif
719 #ifndef RGENGC_WB_PROTECTED_STRING
720 #define RGENGC_WB_PROTECTED_STRING 1
721 #endif
722 #ifndef RGENGC_WB_PROTECTED_OBJECT
723 #define RGENGC_WB_PROTECTED_OBJECT 1
724 #endif
725 #ifndef RGENGC_WB_PROTECTED_REGEXP
726 #define RGENGC_WB_PROTECTED_REGEXP 1
727 #endif
728 #ifndef RGENGC_WB_PROTECTED_CLASS
729 #define RGENGC_WB_PROTECTED_CLASS 1
730 #endif
731 #ifndef RGENGC_WB_PROTECTED_FLOAT
732 #define RGENGC_WB_PROTECTED_FLOAT 1
733 #endif
734 #ifndef RGENGC_WB_PROTECTED_COMPLEX
735 #define RGENGC_WB_PROTECTED_COMPLEX 1
736 #endif
737 #ifndef RGENGC_WB_PROTECTED_RATIONAL
738 #define RGENGC_WB_PROTECTED_RATIONAL 1
739 #endif
740 #ifndef RGENGC_WB_PROTECTED_BIGNUM
741 #define RGENGC_WB_PROTECTED_BIGNUM 1
742 #endif
743 #ifndef RGENGC_WB_PROTECTED_NODE_CREF
744 #define RGENGC_WB_PROTECTED_NODE_CREF 1
745 #endif
746
747 struct RBasic {
748 VALUE flags;
749 const VALUE klass;
750 }
751 #ifdef __GNUC__
752 __attribute__((aligned(sizeof(VALUE))))
753 #endif
754 ;
755
756 VALUE rb_obj_hide(VALUE obj);
757 VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */
758
759 #define RBASIC_CLASS(obj) (RBASIC(obj)->klass)
760
761 #define ROBJECT_EMBED_LEN_MAX 3
762 struct RObject {
763 struct RBasic basic;
764 union {
765 struct {
766 long numiv;
767 VALUE *ivptr;
768 struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
769 } heap;
770 VALUE ary[ROBJECT_EMBED_LEN_MAX];
771 } as;
772 };
773 #define ROBJECT_EMBED FL_USER1
774 #define ROBJECT_NUMIV(o) \
775 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
776 ROBJECT_EMBED_LEN_MAX : \
777 ROBJECT(o)->as.heap.numiv)
778 #define ROBJECT_IVPTR(o) \
779 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
780 ROBJECT(o)->as.ary : \
781 ROBJECT(o)->as.heap.ivptr)
782 #define ROBJECT_IV_INDEX_TBL(o) \
783 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
784 RCLASS_IV_INDEX_TBL(rb_obj_class(o)) : \
785 ROBJECT(o)->as.heap.iv_index_tbl)
786
788 typedef struct rb_classext_struct rb_classext_t;
789
790 struct RClass {
791 struct RBasic basic;
792 VALUE super;
793 rb_classext_t *ptr;
794 struct method_table_wrapper *m_tbl_wrapper;
795 };
796 #define RCLASS_SUPER(c) rb_class_get_superclass(c)
797 #define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
798 #define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m)
799 #define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
800 #define RMODULE_SUPER(m) RCLASS_SUPER(m)
801 #define RMODULE_IS_OVERLAID FL_USER2
802 #define RMODULE_IS_REFINEMENT FL_USER3
803 #define RMODULE_INCLUDED_INTO_REFINEMENT FL_USER4
804
805 struct RFloat {
806 struct RBasic basic;
807 double float_value;
808 };
809
810 double rb_float_value(VALUE);
811 VALUE rb_float_new(double);
812 VALUE rb_float_new_in_heap(double);
813
814 #define RFLOAT_VALUE(v) rb_float_value(v)
815 #define DBL2NUM(dbl) rb_float_new(dbl)
816
817 #define ELTS_SHARED FL_USER2
818
819 #define RSTRING_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(char)-1))
820 struct RString {
821 struct RBasic basic;
822 union {
823 struct {
824 long len;
825 char *ptr;
826 union {
827 long capa;
828 VALUE shared;
829 } aux;
830 } heap;
831 char ary[RSTRING_EMBED_LEN_MAX + 1];
832 } as;
833 };
834 #define RSTRING_NOEMBED FL_USER1
835 #define RSTRING_FSTR FL_USER17
836 #define RSTRING_EMBED_LEN_MASK (FL_USER2|FL_USER3|FL_USER4|FL_USER5|FL_USER6)
837 #define RSTRING_EMBED_LEN_SHIFT (FL_USHIFT+2)
838 #define RSTRING_EMBED_LEN(str) \
839 (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
840 (RSTRING_EMBED_LEN_MASK >> RSTRING_EMBED_LEN_SHIFT))
841 #define RSTRING_LEN(str) \
842 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
843 RSTRING_EMBED_LEN(str) : \
844 RSTRING(str)->as.heap.len)
845 #define RSTRING_PTR(str) \
846 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
847 RSTRING(str)->as.ary : \
848 RSTRING(str)->as.heap.ptr)
849 #define RSTRING_END(str) \
850 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
851 (RSTRING(str)->as.ary + RSTRING_EMBED_LEN(str)) : \
852 (RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len))
853 #define RSTRING_LENINT(str) rb_long2int(RSTRING_LEN(str))
854 #define RSTRING_GETMEM(str, ptrvar, lenvar) \
855 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
856 ((ptrvar) = RSTRING(str)->as.ary, (lenvar) = RSTRING_EMBED_LEN(str)) : \
857 ((ptrvar) = RSTRING(str)->as.heap.ptr, (lenvar) = RSTRING(str)->as.heap.len))
858
859 #define RARRAY_EMBED_LEN_MAX 3
860 struct RArray {
861 struct RBasic basic;
862 union {
863 struct {
864 long len;
865 union {
866 long capa;
867 VALUE shared;
868 } aux;
869 const VALUE *ptr;
870 } heap;
871 const VALUE ary[RARRAY_EMBED_LEN_MAX];
872 } as;
873 };
874 #define RARRAY_EMBED_FLAG FL_USER1
875 /* FL_USER2 is for ELTS_SHARED */
876 #define RARRAY_EMBED_LEN_MASK (FL_USER4|FL_USER3)
877 #define RARRAY_EMBED_LEN_SHIFT (FL_USHIFT+3)
878 #define RARRAY_LEN(a) \
879 ((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
880 (long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
881 (RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT)) : \
882 RARRAY(a)->as.heap.len)
883
884 #define RARRAY_LENINT(ary) rb_long2int(RARRAY_LEN(ary))
885
886 #define RARRAY_CONST_PTR(a) \
887 ((const VALUE *)((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
888 RARRAY(a)->as.ary : \
889 RARRAY(a)->as.heap.ptr))
890
891 #define RARRAY_PTR_USE_START(a) ((VALUE *)RARRAY_CONST_PTR(a))
892 #define RARRAY_PTR_USE_END(a) /* */
893
894 #define RARRAY_PTR_USE(ary, ptr_name, expr) do { \
895 const VALUE _ary = (ary); \
896 VALUE *ptr_name = (VALUE *)RARRAY_PTR_USE_START(_ary); \
897 expr; \
898 RARRAY_PTR_USE_END(_ary); \
899 } while (0)
900
901 #define RARRAY_AREF(a, i) (RARRAY_CONST_PTR(a)[i])
902 #define RARRAY_ASET(a, i, v) do { \
903 const VALUE _ary_ = (a); \
904 RB_OBJ_WRITE(_ary_, &RARRAY_CONST_PTR(_ary_)[i], (v)); \
905 } while (0)
906
907 #define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_UNPROTECT((VALUE)a) : ((VALUE)a)))
908
909 struct RRegexp {
910 struct RBasic basic;
911 struct re_pattern_buffer *ptr;
912 const VALUE src;
913 unsigned long usecnt;
914 };
915 #define RREGEXP_SRC(r) RREGEXP(r)->src
916 #define RREGEXP_SRC_PTR(r) RSTRING_PTR(RREGEXP(r)->src)
917 #define RREGEXP_SRC_LEN(r) RSTRING_LEN(RREGEXP(r)->src)
918 #define RREGEXP_SRC_END(r) RSTRING_END(RREGEXP(r)->src)
919
920 struct RHash {
921 struct RBasic basic;
922 struct st_table *ntbl; /* possibly 0 */
923 int iter_lev;
924 const VALUE ifnone;
925 };
926 /* RHASH_TBL allocates st_table if not available. */
927 #define RHASH_TBL(h) rb_hash_tbl(h)
928 #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
929 #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
930 #define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
931 #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
932 #define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
933
934 struct RFile {
935 struct RBasic basic;
936 struct rb_io_t *fptr;
937 };
938
939 struct RRational {
940 struct RBasic basic;
941 const VALUE num;
942 const VALUE den;
943 };
944
945 #define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
946 #define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
947
948 struct RComplex {
949 struct RBasic basic;
950 const VALUE real;
951 const VALUE imag;
952 };
953
954 #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
955 #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
956
957 struct RData {
958 struct RBasic basic;
959 void (*dmark)(void*);
960 void (*dfree)(void*);
961 void *data;
962 };
963
964 typedef struct rb_data_type_struct rb_data_type_t;
965
966 struct rb_data_type_struct {
967 const char *wrap_struct_name;
968 struct {
969 void (*dmark)(void*);
970 void (*dfree)(void*);
971 size_t (*dsize)(const void *);
972 void *reserved[2]; /* For future extension.
973 This array *must* be filled with ZERO. */
974 } function;
975 const rb_data_type_t *parent;
976 void *data; /* This area can be used for any purpose
977 by a programmer who define the type. */
978 VALUE flags; /* FL_WB_PROTECTED */
979 };
980
981 #define HAVE_TYPE_RB_DATA_TYPE_T 1
982 #define HAVE_RB_DATA_TYPE_T_FUNCTION 1
983 #define HAVE_RB_DATA_TYPE_T_PARENT 1
984
985 struct RTypedData {
986 struct RBasic basic;
987 const rb_data_type_t *type;
988 VALUE typed_flag; /* 1 or not */
989 void *data;
990 };
991
992 #define DATA_PTR(dta) (RDATA(dta)->data)
993
994 #define RTYPEDDATA_P(v) (RTYPEDDATA(v)->typed_flag == 1)
995 #define RTYPEDDATA_TYPE(v) (RTYPEDDATA(v)->type)
996 #define RTYPEDDATA_DATA(v) (RTYPEDDATA(v)->data)
997
998 /*
999 #define RUBY_DATA_FUNC(func) ((void (*)(void*))(func))
1000 */
1001 typedef void (*RUBY_DATA_FUNC)(void*);
1002
1003 VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
1004 VALUE rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *);
1005 int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent);
1006 int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *);
1007 void *rb_check_typeddata(VALUE, const rb_data_type_t *);
1008 #define Check_TypedStruct(v,t) rb_check_typeddata((VALUE)(v),(t))
1009 #define RUBY_DEFAULT_FREE ((RUBY_DATA_FUNC)-1)
1010 #define RUBY_NEVER_FREE ((RUBY_DATA_FUNC)0)
1011 #define RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE
1012 #define RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE
1013
1014 /* bits for rb_data_type_struct::flags */
1015 #define RUBY_TYPED_FREE_IMMEDIATELY 1 /* TYPE field */
1016 #define RUBY_TYPED_WB_PROTECTED FL_WB_PROTECTED
1017
1018 #define Data_Wrap_Struct(klass,mark,free,sval)\
1019 rb_data_object_alloc((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
1020
1021 #define Data_Make_Struct(klass,type,mark,free,sval) (\
1022 (sval) = ALLOC(type),\
1023 memset((sval), 0, sizeof(type)),\
1024 Data_Wrap_Struct((klass),(mark),(free),(sval))\
1025 )
1026
1027 #define TypedData_Wrap_Struct(klass,data_type,sval)\
1028 rb_data_typed_object_alloc((klass),(sval),(data_type))
1029
1030 #define TypedData_Make_Struct(klass, type, data_type, sval) (\
1031 (sval) = ALLOC(type),\
1032 memset((sval), 0, sizeof(type)),\
1033 TypedData_Wrap_Struct((klass),(data_type),(sval))\
1034 )
1035
1036 #define Data_Get_Struct(obj,type,sval) do {\
1037 Check_Type((obj), T_DATA); \
1038 (sval) = (type*)DATA_PTR(obj);\
1039 } while (0)
1040
1041 #define TypedData_Get_Struct(obj,type,data_type,sval) do {\
1042 (sval) = (type*)rb_check_typeddata((obj), (data_type)); \
1043 } while (0)
1044
1045 #define RSTRUCT_EMBED_LEN_MAX 3
1046 struct RStruct {
1047 struct RBasic basic;
1048 union {
1049 struct {
1050 long len;
1051 const VALUE *ptr;
1052 } heap;
1053 const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
1054 } as;
1055 };
1056 #define RSTRUCT_EMBED_LEN_MASK (FL_USER2|FL_USER1)
1057 #define RSTRUCT_EMBED_LEN_SHIFT (FL_USHIFT+1)
1058 #define RSTRUCT_LEN(st) \
1059 ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
1060 (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
1061 (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT)) : \
1062 RSTRUCT(st)->as.heap.len)
1063 #define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
1064 #define RSTRUCT_CONST_PTR(st) \
1065 ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
1066 RSTRUCT(st)->as.ary : \
1067 RSTRUCT(st)->as.heap.ptr)
1068 #define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RGENGC_WB_PROTECTED_STRUCT ? OBJ_WB_UNPROTECT((VALUE)st) : (VALUE)st))
1069
1070 #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
1071 #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
1072
1073 #define RBIGNUM_EMBED_LEN_NUMBITS 3
1074 #ifndef RBIGNUM_EMBED_LEN_MAX
1075 # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1
1076 # define RBIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
1077 # else
1078 # define RBIGNUM_EMBED_LEN_MAX ((1 << RBIGNUM_EMBED_LEN_NUMBITS)-1)
1079 # endif
1080 #endif
1081 struct RBignum {
1082 struct RBasic basic;
1083 union {
1084 struct {
1085 long len;
1086 BDIGIT *digits;
1087 } heap;
1088 BDIGIT ary[RBIGNUM_EMBED_LEN_MAX];
1089 } as;
1090 };
1091 #define RBIGNUM_SIGN_BIT FL_USER1
1092 /* sign: positive:1, negative:0 */
1093 #define RBIGNUM_SIGN(b) ((RBASIC(b)->flags & RBIGNUM_SIGN_BIT) != 0)
1094 #define RBIGNUM_SET_SIGN(b,sign) \
1095 ((sign) ? (RBASIC(b)->flags |= RBIGNUM_SIGN_BIT) \
1096 : (RBASIC(b)->flags &= ~RBIGNUM_SIGN_BIT))
1097 #define RBIGNUM_POSITIVE_P(b) RBIGNUM_SIGN(b)
1098 #define RBIGNUM_NEGATIVE_P(b) (!RBIGNUM_SIGN(b))
1099
1100 #define RBIGNUM_EMBED_FLAG FL_USER2
1101 #define RBIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
1102 #define RBIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+RBIGNUM_EMBED_LEN_NUMBITS)
1103 #define RBIGNUM_LEN(b) \
1104 ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
1105 (long)((RBASIC(b)->flags >> RBIGNUM_EMBED_LEN_SHIFT) & \
1106 (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT)) : \
1107 RBIGNUM(b)->as.heap.len)
1108 /* LSB:RBIGNUM_DIGITS(b)[0], MSB:RBIGNUM_DIGITS(b)[RBIGNUM_LEN(b)-1] */
1109 #define RBIGNUM_DIGITS(b) \
1110 ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
1111 RBIGNUM(b)->as.ary : \
1112 RBIGNUM(b)->as.heap.digits)
1113 #define RBIGNUM_LENINT(b) rb_long2int(RBIGNUM_LEN(b))
1114
1115 #define R_CAST(st) (struct st*)
1116 #define RBASIC(obj) (R_CAST(RBasic)(obj))
1117 #define ROBJECT(obj) (R_CAST(RObject)(obj))
1118 #define RCLASS(obj) (R_CAST(RClass)(obj))
1119 #define RMODULE(obj) RCLASS(obj)
1120 #define RFLOAT(obj) (R_CAST(RFloat)(obj))
1121 #define RSTRING(obj) (R_CAST(RString)(obj))
1122 #define RREGEXP(obj) (R_CAST(RRegexp)(obj))
1123 #define RARRAY(obj) (R_CAST(RArray)(obj))
1124 #define RHASH(obj) (R_CAST(RHash)(obj))
1125 #define RDATA(obj) (R_CAST(RData)(obj))
1126 #define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj))
1127 #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
1128 #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
1129 #define RFILE(obj) (R_CAST(RFile)(obj))
1130 #define RRATIONAL(obj) (R_CAST(RRational)(obj))
1131 #define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
1132
1133 #define FL_SINGLETON FL_USER0
1134 #define FL_WB_PROTECTED (((VALUE)1)<<5)
1135 #define FL_PROMOTED (((VALUE)1)<<6)
1136 #define FL_FINALIZE (((VALUE)1)<<7)
1137 #define FL_TAINT (((VALUE)1)<<8)
1138 #define FL_UNTRUSTED FL_TAINT
1139 #define FL_EXIVAR (((VALUE)1)<<10)
1140 #define FL_FREEZE (((VALUE)1)<<11)
1141
1142 #define FL_USHIFT 12
1143
1144 #define FL_USER0 (((VALUE)1)<<(FL_USHIFT+0))
1145 #define FL_USER1 (((VALUE)1)<<(FL_USHIFT+1))
1146 #define FL_USER2 (((VALUE)1)<<(FL_USHIFT+2))
1147 #define FL_USER3 (((VALUE)1)<<(FL_USHIFT+3))
1148 #define FL_USER4 (((VALUE)1)<<(FL_USHIFT+4))
1149 #define FL_USER5 (((VALUE)1)<<(FL_USHIFT+5))
1150 #define FL_USER6 (((VALUE)1)<<(FL_USHIFT+6))
1151 #define FL_USER7 (((VALUE)1)<<(FL_USHIFT+7))
1152 #define FL_USER8 (((VALUE)1)<<(FL_USHIFT+8))
1153 #define FL_USER9 (((VALUE)1)<<(FL_USHIFT+9))
1154 #define FL_USER10 (((VALUE)1)<<(FL_USHIFT+10))
1155 #define FL_USER11 (((VALUE)1)<<(FL_USHIFT+11))
1156 #define FL_USER12 (((VALUE)1)<<(FL_USHIFT+12))
1157 #define FL_USER13 (((VALUE)1)<<(FL_USHIFT+13))
1158 #define FL_USER14 (((VALUE)1)<<(FL_USHIFT+14))
1159 #define FL_USER15 (((VALUE)1)<<(FL_USHIFT+15))
1160 #define FL_USER16 (((VALUE)1)<<(FL_USHIFT+16))
1161 #define FL_USER17 (((VALUE)1)<<(FL_USHIFT+17))
1162 #define FL_USER18 (((VALUE)1)<<(FL_USHIFT+18))
1163 #define FL_USER19 (((VALUE)1)<<(FL_USHIFT+19))
1164
1165 #define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
1166
1167 #define FL_ABLE(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) != T_NODE)
1168 #define FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f))
1169 #define FL_TEST(x,f) (FL_ABLE(x)?FL_TEST_RAW((x),(f)):0)
1170 #define FL_ANY(x,f) FL_TEST((x),(f))
1171 #define FL_ALL(x,f) (FL_TEST((x),(f)) == (f))
1172 #define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
1173 #define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
1174 #define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
1175
1176 #define OBJ_TAINTED(x) (!!FL_TEST((x), FL_TAINT))
1177 #define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
1178 #define OBJ_UNTRUSTED(x) OBJ_TAINTED(x)
1179 #define OBJ_UNTRUST(x) OBJ_TAINT(x)
1180 #define OBJ_INFECT(x,s) do { \
1181 if (FL_ABLE(x) && FL_ABLE(s)) \
1182 RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT; \
1183 } while (0)
1184
1185 #define OBJ_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x)||SYMBOL_P(x))))
1186 #define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
1187
1188 #if USE_RGENGC
1189 #define OBJ_PROMOTED(x) (SPECIAL_CONST_P(x) ? 0 : FL_TEST_RAW((x), FL_PROMOTED))
1190 #define OBJ_WB_PROTECTED(x) (SPECIAL_CONST_P(x) ? 1 : FL_TEST_RAW((x), FL_WB_PROTECTED))
1191 #define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
1192
1193 void rb_gc_writebarrier(VALUE a, VALUE b);
1194 void rb_gc_writebarrier_unprotect_promoted(VALUE obj);
1195
1196 #else /* USE_RGENGC */
1197 #define OBJ_PROMOTED(x) 0
1198 #define OBJ_WB_PROTECTED(x) 0
1199 #define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
1200 #endif
1201
1202 /* Write barrier (WB) interfaces:
1203 * - RB_OBJ_WRITE(a, slot, b): WB for new reference from `a' to `b'.
1204 * Write `b' into `*slot'. `slot' is a pointer in `a'.
1205 * - RB_OBJ_WRITTEN(a, oldv, b): WB for new reference from `a' to `b'.
1206 * This doesn't write any values, but only a WB declaration.
1207 * `oldv' is replaced value with `b' (not used in current Ruby).
1208 *
1209 * NOTE: The following core interfaces can be changed in the future.
1210 * Please catch up if you want to insert WB into C-extensions
1211 * correctly.
1212 */
1213 #define RB_OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
1214 #define RB_OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
1215
1216 #ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
1217 #define USE_RGENGC_LOGGING_WB_UNPROTECT 0
1218 #endif
1219
1220 #if USE_RGENGC_LOGGING_WB_UNPROTECT
1221 void rb_gc_unprotect_logging(void *objptr, const char *filename, int line);
1222 #define RGENGC_LOGGING_WB_UNPROTECT rb_gc_unprotect_logging
1223 #endif
1224
1225 static inline VALUE
1226 rb_obj_wb_unprotect(VALUE x, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
1227 {
1228 #ifdef RGENGC_LOGGING_WB_UNPROTECT
1229 RGENGC_LOGGING_WB_UNPROTECT((void *)x, filename, line);
1230 #endif
1231
1232 #if USE_RGENGC
1233 /* `x' should be an RVALUE object */
1234 if (FL_TEST_RAW((x), FL_WB_PROTECTED)) {
1235 if (FL_TEST_RAW((x), FL_PROMOTED)) {
1236 rb_gc_writebarrier_unprotect_promoted(x);
1237 }
1238 RBASIC(x)->flags &= ~FL_WB_PROTECTED;
1239 }
1240 #endif
1241 return x;
1242 }
1243
1244 static inline VALUE
1245 rb_obj_written(VALUE a, RB_UNUSED_VAR(VALUE oldv), VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
1246 {
1247 #ifdef RGENGC_LOGGING_OBJ_WRITTEN
1248 RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
1249 #endif
1250
1251 #if USE_RGENGC
1252 /* `a' should be an RVALUE object */
1253 if (FL_TEST_RAW((a), FL_PROMOTED) && !SPECIAL_CONST_P(b)) {
1254 rb_gc_writebarrier(a, b);
1255 }
1256 #endif
1257
1258 return a;
1259 }
1260
1261 static inline VALUE
1262 rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
1263 {
1264 #ifdef RGENGC_LOGGING_WRITE
1265 RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
1266 #endif
1267
1268 *slot = b;
1269
1270 #if USE_RGENGC
1271 rb_obj_written(a, Qundef /* ignore `oldv' now */, b, filename, line);
1272 #endif
1273 return a;
1274 }
1275
1276 #if SIZEOF_INT < SIZEOF_LONG
1277 # define INT2NUM(v) INT2FIX((int)(v))
1278 # define UINT2NUM(v) LONG2FIX((unsigned int)(v))
1279 #else
1280 static inline VALUE
1281 rb_int2num_inline(int v)
1282 {
1283 if (FIXABLE(v))
1284 return INT2FIX(v);
1285 else
1286 return rb_int2big(v);
1287 }
1288 #define INT2NUM(x) rb_int2num_inline(x)
1289
1290 static inline VALUE
1291 rb_uint2num_inline(unsigned int v)
1292 {
1293 if (POSFIXABLE(v))
1294 return LONG2FIX(v);
1295 else
1296 return rb_uint2big(v);
1297 }
1298 #define UINT2NUM(x) rb_uint2num_inline(x)
1299 #endif
1300
1301 static inline VALUE
1302 rb_long2num_inline(long v)
1303 {
1304 if (FIXABLE(v))
1305 return LONG2FIX(v);
1306 else
1307 return rb_int2big(v);
1308 }
1309 #define LONG2NUM(x) rb_long2num_inline(x)
1310
1311 static inline VALUE
1312 rb_ulong2num_inline(unsigned long v)
1313 {
1314 if (POSFIXABLE(v))
1315 return LONG2FIX(v);
1316 else
1317 return rb_uint2big(v);
1318 }
1319 #define ULONG2NUM(x) rb_ulong2num_inline(x)
1320
1321 static inline char
1322 rb_num2char_inline(VALUE x)
1323 {
1324 if ((TYPE(x) == T_STRING) && (RSTRING_LEN(x)>=1))
1325 return RSTRING_PTR(x)[0];
1326 else
1327 return (char)(NUM2INT(x) & 0xff);
1328 }
1329 #define NUM2CHR(x) rb_num2char_inline(x)
1330
1331 #define CHR2FIX(x) INT2FIX((long)((x)&0xff))
1332
1333 #define ALLOC_N(type,n) ((type*)xmalloc2((n),sizeof(type)))
1334 #define ALLOC(type) ((type*)xmalloc(sizeof(type)))
1335 #define REALLOC_N(var,type,n) ((var)=(type*)xrealloc2((char*)(var),(n),sizeof(type)))
1336
1337 #define ALLOCA_N(type,n) ((type*)alloca(sizeof(type)*(n)))
1338
1339 void *rb_alloc_tmp_buffer(volatile VALUE *store, long len) RUBY_ATTR_ALLOC_SIZE((2));
1340 void rb_free_tmp_buffer(volatile VALUE *store);
1341 /* allocates _n_ bytes temporary buffer and stores VALUE including it
1342 * in _v_. _n_ may be evaluated twice. */
1343 #ifdef C_ALLOCA
1344 # define ALLOCV(v, n) rb_alloc_tmp_buffer(&(v), (n))
1345 #else
1346 # define ALLOCV(v, n) ((n) < 1024 ? (RB_GC_GUARD(v) = 0, alloca(n)) : rb_alloc_tmp_buffer(&(v), (n)))
1347 #endif
1348 #define ALLOCV_N(type, v, n) ((type*)ALLOCV((v), sizeof(type)*(n)))
1349 #define ALLOCV_END(v) rb_free_tmp_buffer(&(v))
1350
1351 #define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
1352 #define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
1353 #define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
1354 #define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
1355
1356 void rb_obj_infect(VALUE,VALUE);
1357
1358 typedef int ruby_glob_func(const char*,VALUE, void*);
1359 void rb_glob(const char*,void(*)(const char*,VALUE,void*),VALUE);
1360 int ruby_glob(const char*,int,ruby_glob_func*,VALUE);
1361 int ruby_brace_glob(const char*,int,ruby_glob_func*,VALUE);
1362
1363 VALUE rb_define_class(const char*,VALUE);
1364 VALUE rb_define_module(const char*);
1365 VALUE rb_define_class_under(VALUE, const char*, VALUE);
1366 VALUE rb_define_module_under(VALUE, const char*);
1367
1368 void rb_include_module(VALUE,VALUE);
1369 void rb_extend_object(VALUE,VALUE);
1370 void rb_prepend_module(VALUE,VALUE);
1371
1372 struct rb_global_variable;
1373
1374 typedef VALUE rb_gvar_getter_t(ID id, void *data, struct rb_global_variable *gvar);
1375 typedef void rb_gvar_setter_t(VALUE val, ID id, void *data, struct rb_global_variable *gvar);
1376 typedef void rb_gvar_marker_t(VALUE *var);
1377
1378 VALUE rb_gvar_undef_getter(ID id, void *data, struct rb_global_variable *gvar);
1379 void rb_gvar_undef_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar);
1380 void rb_gvar_undef_marker(VALUE *var);
1381
1382 VALUE rb_gvar_val_getter(ID id, void *data, struct rb_global_variable *gvar);
1383 void rb_gvar_val_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar);
1384 void rb_gvar_val_marker(VALUE *var);
1385
1386 VALUE rb_gvar_var_getter(ID id, void *data, struct rb_global_variable *gvar);
1387 void rb_gvar_var_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar);
1388 void rb_gvar_var_marker(VALUE *var);
1389
1390 void rb_gvar_readonly_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar);
1391
1392 void rb_define_variable(const char*,VALUE*);
1393 void rb_define_virtual_variable(const char*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
1394 void rb_define_hooked_variable(const char*,VALUE*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
1395 void rb_define_readonly_variable(const char*,VALUE*);
1396 void rb_define_const(VALUE,const char*,VALUE);
1397 void rb_define_global_const(const char*,VALUE);
1398
1399 #define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))(func))
1400 void rb_define_method(VALUE,const char*,VALUE(*)(ANYARGS),int);
1401 void rb_define_module_function(VALUE,const char*,VALUE(*)(ANYARGS),int);
1402 void rb_define_global_function(const char*,VALUE(*)(ANYARGS),int);
1403
1404 void rb_undef_method(VALUE,const char*);
1405 void rb_define_alias(VALUE,const char*,const char*);
1406 void rb_define_attr(VALUE,const char*,int,int);
1407
1408 void rb_global_variable(VALUE*);
1409 void rb_gc_register_mark_object(VALUE);
1410 void rb_gc_register_address(VALUE*);
1411 void rb_gc_unregister_address(VALUE*);
1412
1413 ID rb_intern(const char*);
1414 ID rb_intern2(const char*, long);
1415 ID rb_intern_str(VALUE str);
1416 const char *rb_id2name(ID);
1417 ID rb_check_id(volatile VALUE *);
1418 ID rb_to_id(VALUE);
1419 VALUE rb_id2str(ID);
1420
1421 #define CONST_ID_CACHE(result, str) \
1422 { \
1423 static ID rb_intern_id_cache; \
1424 if (!rb_intern_id_cache) \
1425 rb_intern_id_cache = rb_intern2((str), (long)strlen(str)); \
1426 result rb_intern_id_cache; \
1427 }
1428 #define CONST_ID(var, str) \
1429 do CONST_ID_CACHE((var) =, (str)) while (0)
1430 #ifdef __GNUC__
1431 /* __builtin_constant_p and statement expression is available
1432 * since gcc-2.7.2.3 at least. */
1433 #define rb_intern(str) \
1434 (__builtin_constant_p(str) ? \
1435 __extension__ (CONST_ID_CACHE((ID), (str))) : \
1436 rb_intern(str))
1437 #define rb_intern_const(str) \
1438 (__builtin_constant_p(str) ? \
1439 __extension__ (rb_intern2((str), (long)strlen(str))) : \
1440 (rb_intern)(str))
1441 #else
1442 #define rb_intern_const(str) rb_intern2((str), (long)strlen(str))
1443 #endif
1444
1445 const char *rb_class2name(VALUE);
1446 const char *rb_obj_classname(VALUE);
1447
1448 void rb_p(VALUE);
1449
1450 VALUE rb_eval_string(const char*);
1451 VALUE rb_eval_string_protect(const char*, int*);
1452 VALUE rb_eval_string_wrap(const char*, int*);
1453 VALUE rb_funcall(VALUE, ID, int, ...);
1454 VALUE rb_funcallv(VALUE, ID, int, const VALUE*);
1455 VALUE rb_funcallv_public(VALUE, ID, int, const VALUE*);
1456 #define rb_funcall2 rb_funcallv
1457 #define rb_funcall3 rb_funcallv_public
1458 VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*);
1459 VALUE rb_funcall_with_block(VALUE, ID, int, const VALUE*, VALUE);
1460 int rb_scan_args(int, const VALUE*, const char*, ...);
1461 VALUE rb_call_super(int, const VALUE*);
1462
1463 /* rb_scan_args() format allows ':' for optional hash */
1464 #define HAVE_RB_SCAN_ARGS_OPTIONAL_HASH 1
1465
1466 VALUE rb_gv_set(const char*, VALUE);
1467 VALUE rb_gv_get(const char*);
1468 VALUE rb_iv_get(VALUE, const char*);
1469 VALUE rb_iv_set(VALUE, const char*, VALUE);
1470
1471 VALUE rb_equal(VALUE,VALUE);
1472
1473 VALUE *rb_ruby_verbose_ptr(void);
1474 VALUE *rb_ruby_debug_ptr(void);
1475 #define ruby_verbose (*rb_ruby_verbose_ptr())
1476 #define ruby_debug (*rb_ruby_debug_ptr())
1477
1478 PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
1479 PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
1480 PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
1481 NORETURN(void rb_bug_errno(const char*, int));
1482 NORETURN(void rb_sys_fail(const char*));
1483 NORETURN(void rb_sys_fail_str(VALUE));
1484 NORETURN(void rb_mod_sys_fail(VALUE, const char*));
1485 NORETURN(void rb_mod_sys_fail_str(VALUE, VALUE));
1486 NORETURN(void rb_readwrite_sys_fail(int, const char*));
1487 NORETURN(void rb_iter_break(void));
1488 NORETURN(void rb_iter_break_value(VALUE));
1489 NORETURN(void rb_exit(int));
1490 NORETURN(void rb_notimplement(void));
1491 VALUE rb_syserr_new(int, const char *);
1492 VALUE rb_syserr_new_str(int n, VALUE arg);
1493 NORETURN(void rb_syserr_fail(int, const char*));
1494 NORETURN(void rb_syserr_fail_str(int, VALUE));
1495 NORETURN(void rb_mod_syserr_fail(VALUE, int, const char*));
1496 NORETURN(void rb_mod_syserr_fail_str(VALUE, int, VALUE));
1497
1498 /* reports if `-W' specified */
1499 PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
1500 PRINTF_ARGS(void rb_compile_warning(const char *, int, const char*, ...), 3, 4);
1501 PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
1502 /* reports always */
1503 PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
1504 PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
1505
1506 /* for rb_readwrite_sys_fail first argument */
1507 #define RB_IO_WAIT_READABLE 0
1508 #define RB_IO_WAIT_WRITABLE 1
1509
1510 #define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1
1511 #define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) \
1512 VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg
1513 typedef VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg));
1514
1515 #if defined RB_BLOCK_CALL_FUNC_STRICT && RB_BLOCK_CALL_FUNC_STRICT
1516 typedef rb_block_call_func *rb_block_call_func_t;
1517 #else
1518 typedef VALUE (*rb_block_call_func_t)(ANYARGS);
1519 #endif
1520
1521 VALUE rb_each(VALUE);
1522 VALUE rb_yield(VALUE);
1523 VALUE rb_yield_values(int n, ...);
1524 VALUE rb_yield_values2(int n, const VALUE *argv);
1525 VALUE rb_yield_splat(VALUE);
1526 VALUE rb_yield_block(VALUE, VALUE, int, const VALUE *, VALUE); /* rb_block_call_func */
1527 int rb_block_given_p(void);
1528 void rb_need_block(void);
1529 VALUE rb_iterate(VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE);
1530 VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE);
1531 VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
1532 VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...);
1533 VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
1534 VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE);
1535 VALUE rb_catch_obj(VALUE,VALUE(*)(ANYARGS),VALUE);
1536 NORETURN(void rb_throw(const char*,VALUE));
1537 NORETURN(void rb_throw_obj(VALUE,VALUE));
1538
1539 VALUE rb_require(const char*);
1540
1541 RUBY_EXTERN VALUE rb_mKernel;
1542 RUBY_EXTERN VALUE rb_mComparable;
1543 RUBY_EXTERN VALUE rb_mEnumerable;
1544 RUBY_EXTERN VALUE rb_mErrno;
1545 RUBY_EXTERN VALUE rb_mFileTest;
1546 RUBY_EXTERN VALUE rb_mGC;
1547 RUBY_EXTERN VALUE rb_mMath;
1548 RUBY_EXTERN VALUE rb_mProcess;
1549 RUBY_EXTERN VALUE rb_mWaitReadable;
1550 RUBY_EXTERN VALUE rb_mWaitWritable;
1551
1552 RUBY_EXTERN VALUE rb_cBasicObject;
1553 RUBY_EXTERN VALUE rb_cObject;
1554 RUBY_EXTERN VALUE rb_cArray;
1555 RUBY_EXTERN VALUE rb_cBignum;
1556 RUBY_EXTERN VALUE rb_cBinding;
1557 RUBY_EXTERN VALUE rb_cClass;
1558 RUBY_EXTERN VALUE rb_cCont;
1559 RUBY_EXTERN VALUE rb_cDir;
1560 RUBY_EXTERN VALUE rb_cData;
1561 RUBY_EXTERN VALUE rb_cFalseClass;
1562 RUBY_EXTERN VALUE rb_cEncoding;
1563 RUBY_EXTERN VALUE rb_cEnumerator;
1564 RUBY_EXTERN VALUE rb_cFile;
1565 RUBY_EXTERN VALUE rb_cFixnum;
1566 RUBY_EXTERN VALUE rb_cFloat;
1567 RUBY_EXTERN VALUE rb_cHash;
1568 RUBY_EXTERN VALUE rb_cInteger;
1569 RUBY_EXTERN VALUE rb_cIO;
1570 RUBY_EXTERN VALUE rb_cMatch;
1571 RUBY_EXTERN VALUE rb_cMethod;
1572 RUBY_EXTERN VALUE rb_cModule;
1573 RUBY_EXTERN VALUE rb_cNameErrorMesg;
1574 RUBY_EXTERN VALUE rb_cNilClass;
1575 RUBY_EXTERN VALUE rb_cNumeric;
1576 RUBY_EXTERN VALUE rb_cProc;
1577 RUBY_EXTERN VALUE rb_cRandom;
1578 RUBY_EXTERN VALUE rb_cRange;
1579 RUBY_EXTERN VALUE rb_cRational;
1580 RUBY_EXTERN VALUE rb_cComplex;
1581 RUBY_EXTERN VALUE rb_cRegexp;
1582 RUBY_EXTERN VALUE rb_cStat;
1583 RUBY_EXTERN VALUE rb_cString;
1584 RUBY_EXTERN VALUE rb_cStruct;
1585 RUBY_EXTERN VALUE rb_cSymbol;
1586 RUBY_EXTERN VALUE rb_cThread;
1587 RUBY_EXTERN VALUE rb_cTime;
1588 RUBY_EXTERN VALUE rb_cTrueClass;
1589 RUBY_EXTERN VALUE rb_cUnboundMethod;
1590
1591 RUBY_EXTERN VALUE rb_eException;
1592 RUBY_EXTERN VALUE rb_eStandardError;
1593 RUBY_EXTERN VALUE rb_eSystemExit;
1594 RUBY_EXTERN VALUE rb_eInterrupt;
1595 RUBY_EXTERN VALUE rb_eSignal;
1596 RUBY_EXTERN VALUE rb_eFatal;
1597 RUBY_EXTERN VALUE rb_eArgError;
1598 RUBY_EXTERN VALUE rb_eEOFError;
1599 RUBY_EXTERN VALUE rb_eIndexError;
1600 RUBY_EXTERN VALUE rb_eStopIteration;
1601 RUBY_EXTERN VALUE rb_eKeyError;
1602 RUBY_EXTERN VALUE rb_eRangeError;
1603 RUBY_EXTERN VALUE rb_eIOError;
1604 RUBY_EXTERN VALUE rb_eRuntimeError;
1605 RUBY_EXTERN VALUE rb_eSecurityError;
1606 RUBY_EXTERN VALUE rb_eSystemCallError;
1607 RUBY_EXTERN VALUE rb_eThreadError;
1608 RUBY_EXTERN VALUE rb_eTypeError;
1609 RUBY_EXTERN VALUE rb_eZeroDivError;
1610 RUBY_EXTERN VALUE rb_eNotImpError;
1611 RUBY_EXTERN VALUE rb_eNoMemError;
1612 RUBY_EXTERN VALUE rb_eNoMethodError;
1613 RUBY_EXTERN VALUE rb_eFloatDomainError;
1614 RUBY_EXTERN VALUE rb_eLocalJumpError;
1615 RUBY_EXTERN VALUE rb_eSysStackError;
1616 RUBY_EXTERN VALUE rb_eRegexpError;
1617 RUBY_EXTERN VALUE rb_eEncodingError;
1618 RUBY_EXTERN VALUE rb_eEncCompatError;
1619
1620 RUBY_EXTERN VALUE rb_eScriptError;
1621 RUBY_EXTERN VALUE rb_eNameError;
1622 RUBY_EXTERN VALUE rb_eSyntaxError;
1623 RUBY_EXTERN VALUE rb_eLoadError;
1624
1625 RUBY_EXTERN VALUE rb_eMathDomainError;
1626
1627 RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr;
1628
1629 static inline VALUE
1630 rb_class_of(VALUE obj)
1631 {
1632 if (IMMEDIATE_P(obj)) {
1633 if (FIXNUM_P(obj)) return rb_cFixnum;
1634 if (FLONUM_P(obj)) return rb_cFloat;
1635 if (obj == Qtrue) return rb_cTrueClass;
1636 if (SYMBOL_P(obj)) return rb_cSymbol;
1637 }
1638 else if (!RTEST(obj)) {
1639 if (obj == Qnil) return rb_cNilClass;
1640 if (obj == Qfalse) return rb_cFalseClass;
1641 }
1642 return RBASIC(obj)->klass;
1643 }
1644
1645 static inline int
1646 rb_type(VALUE obj)
1647 {
1648 if (IMMEDIATE_P(obj)) {
1649 if (FIXNUM_P(obj)) return T_FIXNUM;
1650 if (FLONUM_P(obj)) return T_FLOAT;
1651 if (obj == Qtrue) return T_TRUE;
1652 if (SYMBOL_P(obj)) return T_SYMBOL;
1653 if (obj == Qundef) return T_UNDEF;
1654 }
1655 else if (!RTEST(obj)) {
1656 if (obj == Qnil) return T_NIL;
1657 if (obj == Qfalse) return T_FALSE;
1658 }
1659 return BUILTIN_TYPE(obj);
1660 }
1661
1662 #define RB_FLOAT_TYPE_P(obj) (FLONUM_P(obj) || (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == T_FLOAT))
1663
1664 #define RB_TYPE_P(obj, type) ( \
1665 ((type) == T_FIXNUM) ? FIXNUM_P(obj) : \
1666 ((type) == T_TRUE) ? ((obj) == Qtrue) : \
1667 ((type) == T_FALSE) ? ((obj) == Qfalse) : \
1668 ((type) == T_NIL) ? ((obj) == Qnil) : \
1669 ((type) == T_UNDEF) ? ((obj) == Qundef) : \
1670 ((type) == T_SYMBOL) ? SYMBOL_P(obj) : \
1671 ((type) == T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
1672 (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == (type)))
1673
1674 #ifdef __GNUC__
1675 #define rb_type_p(obj, type) \
1676 __extension__ (__builtin_constant_p(type) ? RB_TYPE_P((obj), (type)) : \
1677 rb_type(obj) == (type))
1678 #else
1679 #define rb_type_p(obj, type) (rb_type(obj) == (type))
1680 #endif
1681
1682 #ifdef __GNUC__
1683 #define rb_special_const_p(obj) \
1684 __extension__ ({VALUE special_const_obj = (obj); (int)(SPECIAL_CONST_P(special_const_obj) ? Qtrue : Qfalse);})
1685 #else
1686 static inline int
1687 rb_special_const_p(VALUE obj)
1688 {
1689 if (SPECIAL_CONST_P(obj)) return (int)Qtrue;
1690 return (int)Qfalse;
1691 }
1692 #endif
1693
1694 #include "ruby/intern.h"
1695
1696 #if defined(EXTLIB) && defined(USE_DLN_A_OUT)
1697 /* hook for external modules */
1698 static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
1699 #endif
1700
1701 #define RUBY_VM 1 /* YARV */
1702 #define HAVE_NATIVETHREAD
1703 int ruby_native_thread_p(void);
1704
1705 /* traditional set_trace_func events */
1706 #define RUBY_EVENT_NONE 0x0000
1707 #define RUBY_EVENT_LINE 0x0001
1708 #define RUBY_EVENT_CLASS 0x0002
1709 #define RUBY_EVENT_END 0x0004
1710 #define RUBY_EVENT_CALL 0x0008
1711 #define RUBY_EVENT_RETURN 0x0010
1712 #define RUBY_EVENT_C_CALL 0x0020
1713 #define RUBY_EVENT_C_RETURN 0x0040
1714 #define RUBY_EVENT_RAISE 0x0080
1715 #define RUBY_EVENT_ALL 0x00ff
1716
1717 /* for TracePoint extended events */
1718 #define RUBY_EVENT_B_CALL 0x0100
1719 #define RUBY_EVENT_B_RETURN 0x0200
1720 #define RUBY_EVENT_THREAD_BEGIN 0x0400
1721 #define RUBY_EVENT_THREAD_END 0x0800
1722 #define RUBY_EVENT_TRACEPOINT_ALL 0xffff
1723
1724 /* special events */
1725 #define RUBY_EVENT_SPECIFIED_LINE 0x010000
1726 #define RUBY_EVENT_COVERAGE 0x020000
1727
1728 /* internal events */
1729 #define RUBY_INTERNAL_EVENT_SWITCH 0x040000
1730 #define RUBY_EVENT_SWITCH 0x040000 /* obsolete name. this macro is for compatibility */
1731 /* 0x080000 */
1732 #define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000
1733 #define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000
1734 #define RUBY_INTERNAL_EVENT_GC_START 0x400000
1735 #define RUBY_INTERNAL_EVENT_GC_END_MARK 0x800000
1736 #define RUBY_INTERNAL_EVENT_GC_END_SWEEP 0x1000000
1737 #define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0x1f00000
1738 #define RUBY_INTERNAL_EVENT_MASK 0xfffe0000
1739
1740 typedef unsigned long rb_event_flag_t;
1741 typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass);
1742
1743 #define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
1744 void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
1745 int rb_remove_event_hook(rb_event_hook_func_t func);
1746
1747 /* locale insensitive functions */
1748
1749 #define rb_isascii(c) ((unsigned long)(c) < 128)
1750 int rb_isalnum(int c);
1751 int rb_isalpha(int c);
1752 int rb_isblank(int c);
1753 int rb_iscntrl(int c);
1754 int rb_isdigit(int c);
1755 int rb_isgraph(int c);
1756 int rb_islower(int c);
1757 int rb_isprint(int c);
1758 int rb_ispunct(int c);
1759 int rb_isspace(int c);
1760 int rb_isupper(int c);
1761 int rb_isxdigit(int c);
1762 int rb_tolower(int c);
1763 int rb_toupper(int c);
1764
1765 #ifndef ISPRINT
1766 #define ISASCII(c) rb_isascii((unsigned char)(c))
1767 #undef ISPRINT
1768 #define ISPRINT(c) rb_isprint((unsigned char)(c))
1769 #define ISGRAPH(c) rb_isgraph((unsigned char)(c))
1770 #define ISSPACE(c) rb_isspace((unsigned char)(c))
1771 #define ISUPPER(c) rb_isupper((unsigned char)(c))
1772 #define ISLOWER(c) rb_islower((unsigned char)(c))
1773 #define ISALNUM(c) rb_isalnum((unsigned char)(c))
1774 #define ISALPHA(c) rb_isalpha((unsigned char)(c))
1775 #define ISDIGIT(c) rb_isdigit((unsigned char)(c))
1776 #define ISXDIGIT(c) rb_isxdigit((unsigned char)(c))
1777 #endif
1778 #define TOUPPER(c) rb_toupper((unsigned char)(c))
1779 #define TOLOWER(c) rb_tolower((unsigned char)(c))
1780
1781 int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
1782 int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
1783 #define STRCASECMP(s1, s2) (st_locale_insensitive_strcasecmp((s1), (s2)))
1784 #define STRNCASECMP(s1, s2, n) (st_locale_insensitive_strncasecmp((s1), (s2), (n)))
1785
1786 unsigned long ruby_strtoul(const char *str, char **endptr, int base);
1787 #define STRTOUL(str, endptr, base) (ruby_strtoul((str), (endptr), (base)))
1788
1789 #define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
1790
1791 PRINTF_ARGS(int ruby_snprintf(char *str, size_t n, char const *fmt, ...), 3, 4);
1792 int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
1793
1794 #ifndef RUBY_DONT_SUBST
1795 #include "ruby/subst.h"
1796 #endif
1797
1814 void ruby_sysinit(int *argc, char ***argv);
1815 void ruby_init(void);
1816 void* ruby_options(int argc, char** argv);
1817 int ruby_executable_node(void *n, int *status);
1818 int ruby_run_node(void *n);
1819
1820 /* version.c */
1821 void ruby_show_version(void);
1822 void ruby_show_copyright(void);
1823
1824
1827 #define RUBY_INIT_STACK \
1828 VALUE variable_in_this_stack_frame; \
1829 ruby_init_stack(&variable_in_this_stack_frame);
1830
1832 #ifdef __ia64
1833 void ruby_init_stack(volatile VALUE*, void*);
1834 #define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
1835 #else
1836 void ruby_init_stack(volatile VALUE*);
1837 #endif
1838 #define Init_stack(addr) ruby_init_stack(addr)
1839
1840 int ruby_setup(void);
1841 int ruby_cleanup(volatile int);
1842
1843 void ruby_finalize(void);
1844 NORETURN(void ruby_stop(int));
1845
1846 void ruby_set_stack_size(size_t);
1847 int ruby_stack_check(void);
1848 size_t ruby_stack_length(VALUE**);
1849
1850 int ruby_exec_node(void *n);
1851
1852 void ruby_script(const char* name);
1853 void ruby_set_script_name(VALUE name);
1854
1855 void ruby_prog_init(void);
1856 void ruby_set_argv(int, char**);
1857 void *ruby_process_options(int, char**);
1858 void ruby_init_loadpath(void);
1859 void ruby_incpush(const char*);
1860 void ruby_sig_finalize(void);
1861
1864 RUBY_SYMBOL_EXPORT_END
1865
1866 #if defined(__cplusplus)
1867 #if 0
1868 { /* satisfy cc-mode */
1869 #endif
1870 } /* extern "C" { */
1871 #endif
1872 #endif /* RUBY_RUBY_H */
rb_cString
RUBY_EXTERN VALUE rb_cString
Definition: ruby.h:1583
rb_define_global_const
void rb_define_global_const(const char *, VALUE)
Definition: variable.c:2236
method_table_wrapper
Definition: internal.h:282
ruby_strtoul
unsigned long ruby_strtoul(const char *str, char **endptr, int base)
Definition: util.c:107
RUBY_T_RATIONAL
Definition: ruby.h:459
ruby_run_node
int ruby_run_node(void *n)
Runs the given compiled source and exits this process.
Definition: eval.c:303
T_SYMBOL
#define T_SYMBOL
Definition: ruby.h:494
rb_glob
void rb_glob(const char *, void(*)(const char *, VALUE, void *), VALUE)
Definition: dir.c:1615
rb_mProcess
RUBY_EXTERN VALUE rb_mProcess
Definition: ruby.h:1548
RRational::num
const VALUE num
Definition: ruby.h:941
rb_check_id
ID rb_check_id(volatile VALUE *)
Returns ID for the given name if it is interned already, or 0.
Definition: ripper.c:17324
rb_eRangeError
RUBY_EXTERN VALUE rb_eRangeError
Definition: ruby.h:1602
DEPRECATED
#define DEPRECATED(x)
Definition: ruby.h:36
rb_isdigit
int rb_isdigit(int c)
Definition: encoding.c:1925
rb_cData
RUBY_EXTERN VALUE rb_cData
Definition: ruby.h:1560
RStruct::len
long len
Definition: ruby.h:1050
ruby_cleanup
int ruby_cleanup(volatile int)
Destructs the VM.
Definition: eval.c:157
RFloat
Definition: ruby.h:805
RArray::ary
const VALUE ary[RARRAY_EMBED_LEN_MAX]
Definition: ruby.h:871
rb_cFalseClass
RUBY_EXTERN VALUE rb_cFalseClass
Definition: ruby.h:1561
rb_cFloat
RUBY_EXTERN VALUE rb_cFloat
Definition: ruby.h:1566
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:327
RStruct::as
union RStruct::@116 as
rb_string_value_ptr
char * rb_string_value_ptr(volatile VALUE *)
Definition: string.c:1600
RComplex::basic
struct RBasic basic
Definition: ruby.h:949
RData::dfree
void(* dfree)(void *)
Definition: ruby.h:960
st_locale_insensitive_strncasecmp
int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: st.c:1640
RBignum::digits
BDIGIT * digits
Definition: ruby.h:1086
T_FIXNUM
#define T_FIXNUM
Definition: ruby.h:489
st_table
Definition: st.h:69
rb_gvar_undef_setter
void rb_gvar_undef_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
RObject::heap
struct RObject::@107::@108 heap
rb_free_tmp_buffer
void rb_free_tmp_buffer(volatile VALUE *store)
Definition: string.c:933
rb_syserr_fail
void rb_syserr_fail(int e, const char *mesg)
Definition: error.c:1964
ruby_finalize
void ruby_finalize(void)
Runs the VM finalization processes.
Definition: eval.c:140
rb_define_virtual_variable
void rb_define_virtual_variable(const char *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
Definition: variable.c:616
rb_yield_values
VALUE rb_yield_values(int n,...)
Definition: vm_eval.c:953
NUM2INT
#define NUM2INT(x)
Definition: ruby.h:630
rb_intern2
ID rb_intern2(const char *, long)
Definition: ripper.c:17137
rb_global_variable
void rb_global_variable(VALUE *)
Definition: gc.c:4962
ruby_vsnprintf
int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap)
Definition: vsnprintf.c:1302
rb_throw
void rb_throw(const char *tag, VALUE val)
Definition: vm_eval.c:1755
rb_mGC
RUBY_EXTERN VALUE rb_mGC
Definition: ruby.h:1546
rb_cUnboundMethod
RUBY_EXTERN VALUE rb_cUnboundMethod
Definition: ruby.h:1589
ruby_stack_length
size_t ruby_stack_length(VALUE **)
Definition: gc.c:3250
rb_num2long
SIGNED_VALUE rb_num2long(VALUE)
Definition: numeric.c:2029
intern.h
RObject::iv_index_tbl
struct st_table * iv_index_tbl
Definition: ruby.h:768
rb_str_export
VALUE rb_str_export(VALUE)
Definition: string.c:743
RFloat::basic
struct RBasic basic
Definition: ruby.h:806
ruby_options
void * ruby_options(int argc, char **argv)
Processes command line arguments and compiles the Ruby source to execute.
Definition: eval.c:93
rb_isupper
int rb_isupper(int c)
Definition: encoding.c:1931
rb_typeddata_inherited_p
int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent)
Definition: error.c:500
Qtrue
#define Qtrue
Definition: ruby.h:426
ruby_show_version
void ruby_show_version(void)
Prints the version information of the CRuby interpreter to stdout.
Definition: version.c:78
rb_remove_event_hook
int rb_remove_event_hook(rb_event_hook_func_t func)
Definition: vm_trace.c:204
RUBY_Qtrue
Definition: ruby.h:400
rb_data_type_struct::flags
VALUE flags
Definition: ruby.h:978
rb_io_t
Definition: io.h:61
RFile::fptr
struct rb_io_t * fptr
Definition: ruby.h:936
rb_eNoMethodError
RUBY_EXTERN VALUE rb_eNoMethodError
Definition: ruby.h:1612
rb_gc_register_address
void rb_gc_register_address(VALUE *)
Definition: gc.c:4927
RString::as
union RString::@109 as
rb_cRandom
RUBY_EXTERN VALUE rb_cRandom
Definition: ruby.h:1577
ruby_glob
int ruby_glob(const char *, int, ruby_glob_func *, VALUE)
Definition: dir.c:1578
rb_add_event_hook
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
Definition: vm_trace.c:145
RUBY_SPECIAL_SHIFT
Definition: ruby.h:409
rb_iterate
VALUE rb_iterate(VALUE(*)(VALUE), VALUE, VALUE(*)(ANYARGS), VALUE)
Definition: vm_eval.c:1052
RUBY_T_NODE
Definition: ruby.h:468
RArray::heap
struct RArray::@112::@113 heap
rb_stdin
RUBY_EXTERN VALUE rb_stdin
Definition: ruby.h:1627
FIX2SHORT
#define FIX2SHORT(x)
Definition: ruby.h:640
rb_uint2num_inline
static VALUE rb_uint2num_inline(unsigned int v)
Definition: ruby.h:1291
RArray::as
union RArray::@112 as
rb_catch_obj
VALUE rb_catch_obj(VALUE, VALUE(*)(ANYARGS), VALUE)
ruby_exec_node
int ruby_exec_node(void *n)
Runs the given compiled source.
Definition: eval.c:315
ruby_show_copyright
void ruby_show_copyright(void)
Prints the copyright notice of the CRuby interpreter to stdout and exits this process successfully...
Definition: version.c:88
RUBY_SYMBOL_FLAG
Definition: ruby.h:408
rb_gc_writebarrier_unprotect_promoted
void rb_gc_writebarrier_unprotect_promoted(VALUE obj)
Definition: gc.c:4749
rb_num2short_inline
static short rb_num2short_inline(VALUE x)
Definition: ruby.h:642
RUBY_T_OBJECT
Definition: ruby.h:445
ruby_check_sizeof_voidp
char ruby_check_sizeof_voidp[SIZEOF_VOIDP==sizeof(void *)?1:-1]
Definition: ruby.h:109
rb_eMathDomainError
RUBY_EXTERN VALUE rb_eMathDomainError
Definition: ruby.h:1625
rb_isblank
int rb_isblank(int c)
Definition: encoding.c:1923
RString::capa
long capa
Definition: ruby.h:827
RString::basic
struct RBasic basic
Definition: ruby.h:821
rb_fix2short
short rb_fix2short(VALUE)
Definition: numeric.c:2240
rb_eInterrupt
RUBY_EXTERN VALUE rb_eInterrupt
Definition: ruby.h:1594
rb_isspace
int rb_isspace(int c)
Definition: encoding.c:1930
rb_intern
ID rb_intern(const char *)
Definition: ripper.c:17144
rb_eThreadError
RUBY_EXTERN VALUE rb_eThreadError
Definition: ruby.h:1607
rb_funcall
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:775
rb_iv_set
VALUE rb_iv_set(VALUE, const char *, VALUE)
Definition: variable.c:2609
rb_iv_get
VALUE rb_iv_get(VALUE, const char *)
Definition: variable.c:2601
rb_define_class_under
VALUE rb_define_class_under(VALUE, const char *, VALUE)
Defines a class under the namespace of outer.
Definition: class.c:676
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:1857
rb_cDir
RUBY_EXTERN VALUE rb_cDir
Definition: ruby.h:1559
RString::aux
union RString::@109::@110::@111 aux
rb_funcall_with_block
VALUE rb_funcall_with_block(VALUE, ID, int, const VALUE *, VALUE)
Definition: vm_eval.c:835
rb_data_type_struct::parent
const rb_data_type_t * parent
Definition: ruby.h:975
rb_compile_warn
void rb_compile_warn(const char *file, int line, const char *fmt,...)
Definition: error.c:179
rb_data_type_struct::dsize
size_t(* dsize)(const void *)
Definition: ruby.h:971
rb_check_typeddata
void * rb_check_typeddata(VALUE, const rb_data_type_t *)
Definition: error.c:520
RTypedData::data
void * data
Definition: ruby.h:989
RUBY_T_MATCH
Definition: ruby.h:457
rb_float_new
VALUE rb_float_new(double)
Definition: numeric.c:4115
RUBY_T_FIXNUM
Definition: ruby.h:465
RBignum::heap
struct RBignum::@118::@119 heap
rb_include_module
void rb_include_module(VALUE, VALUE)
Definition: class.c:827
rb_block_call
VALUE rb_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
rb_syserr_new_str
VALUE rb_syserr_new_str(int n, VALUE arg)
Definition: error.c:1958
rb_toupper
int rb_toupper(int c)
Definition: encoding.c:1941
RObject::as
union RObject::@107 as
ruby_snprintf
int ruby_snprintf(char *str, size_t n, char const *fmt,...)
Definition: vsnprintf.c:1320
RBignum
Definition: ruby.h:1081
re_pattern_buffer
Definition: oniguruma.h:658
RUBY_Qundef
Definition: ruby.h:402
rb_define_global_function
void rb_define_global_function(const char *, VALUE(*)(ANYARGS), int)
Defines a global function.
Definition: class.c:1684
RFloat::float_value
double float_value
Definition: ruby.h:807
rb_mMath
RUBY_EXTERN VALUE rb_mMath
Definition: ruby.h:1547
rb_data_type_struct::reserved
void * reserved[2]
Definition: ruby.h:972
rb_rescue
VALUE rb_rescue(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE)
Definition: eval.c:799
rb_cProc
RUBY_EXTERN VALUE rb_cProc
Definition: ruby.h:1576
rb_p
void rb_p(VALUE)
Definition: io.c:7032
RData::dmark
void(* dmark)(void *)
Definition: ruby.h:959
FIXNUM_P
#define FIXNUM_P(f)
Definition: ruby.h:347
rb_gc_register_mark_object
void rb_gc_register_mark_object(VALUE)
Definition: gc.c:4920
rb_data_object_alloc
VALUE rb_data_object_alloc(VALUE, void *, RUBY_DATA_FUNC, RUBY_DATA_FUNC)
Definition: gc.c:1369
ruby_native_thread_p
int ruby_native_thread_p(void)
Definition: thread.c:5190
T_UNDEF
#define T_UNDEF
Definition: ruby.h:497
RUBY_T_ARRAY
Definition: ruby.h:451
RUBY_ATTR_ALLOC_SIZE
#define RUBY_ATTR_ALLOC_SIZE(params)
Definition: defines.h:118
rb_cMethod
RUBY_EXTERN VALUE rb_cMethod
Definition: ruby.h:1571
rb_undef_method
void rb_undef_method(VALUE, const char *)
Definition: class.c:1506
rb_eZeroDivError
RUBY_EXTERN VALUE rb_eZeroDivError
Definition: ruby.h:1609
RUBY_T_STRUCT
Definition: ruby.h:453
RComplex
Definition: ruby.h:948
RData
Definition: ruby.h:957
rb_string_value
VALUE rb_string_value(volatile VALUE *)
Definition: string.c:1589
ruby_stack_check
int ruby_stack_check(void)
Definition: gc.c:3279
rb_iscntrl
int rb_iscntrl(int c)
Definition: encoding.c:1924
RTypedData
Definition: ruby.h:985
rb_obj_classname
const char * rb_obj_classname(VALUE)
Definition: variable.c:406
rb_class_of
static VALUE rb_class_of(VALUE obj)
Definition: ruby.h:1630
rb_gv_set
VALUE rb_gv_set(const char *, VALUE)
Definition: variable.c:810
rb_gvar_var_setter
void rb_gvar_var_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
ruby_incpush
void ruby_incpush(const char *)
Definition: ruby.c:337
rb_cComplex
RUBY_EXTERN VALUE rb_cComplex
Definition: ruby.h:1580
rb_eIndexError
RUBY_EXTERN VALUE rb_eIndexError
Definition: ruby.h:1599
rb_cFile
RUBY_EXTERN VALUE rb_cFile
Definition: ruby.h:1564
rb_long2num_inline
static VALUE rb_long2num_inline(long v)
Definition: ruby.h:1302
NORETURN
#define NORETURN(x)
Definition: ruby.h:33
RB_BLOCK_CALL_FUNC_ARGLIST
#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)
Definition: ruby.h:1511
rb_gc_guarded_ptr
volatile VALUE * rb_gc_guarded_ptr(volatile VALUE *ptr)
Definition: gc.c:93
rb_isprint
int rb_isprint(int c)
Definition: encoding.c:1928
rb_gc_unprotect_logging
void rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
Definition: gc.c:4804
RRational::den
const VALUE den
Definition: ruby.h:942
rb_eEncCompatError
RUBY_EXTERN VALUE rb_eEncCompatError
Definition: ruby.h:1618
rb_prepend_module
void rb_prepend_module(VALUE, VALUE)
Definition: class.c:940
RUBY_T_REGEXP
Definition: ruby.h:450
rb_set_errinfo
void rb_set_errinfo(VALUE)
Definition: eval.c:1504
subst.h
rb_cCont
RUBY_EXTERN VALUE rb_cCont
Definition: ruby.h:1558
rb_block_given_p
int rb_block_given_p(void)
Definition: eval.c:712
POSFIXABLE
#define POSFIXABLE(f)
Definition: ruby.h:348
rb_gv_get
VALUE rb_gv_get(const char *)
Definition: variable.c:819
RString
Definition: ruby.h:820
rb_set_safe_level
void rb_set_safe_level(int)
Definition: safe.c:49
RRegexp::src
const VALUE src
Definition: ruby.h:912
rb_eEncodingError
RUBY_EXTERN VALUE rb_eEncodingError
Definition: ruby.h:1617
rb_require
VALUE rb_require(const char *)
Definition: load.c:1034
rb_mWaitReadable
RUBY_EXTERN VALUE rb_mWaitReadable
Definition: ruby.h:1549
rb_block_call_func
VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
Definition: ruby.h:1513
rb_iter_break
void rb_iter_break(void)
Definition: vm.c:1154
st_locale_insensitive_strcasecmp
int st_locale_insensitive_strcasecmp(const char *s1, const char *s2)
Definition: st.c:1616
rb_data_typed_object_alloc
VALUE rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *)
Definition: gc.c:1376
rb_cBinding
RUBY_EXTERN VALUE rb_cBinding
Definition: ruby.h:1556
RClass::basic
struct RBasic basic
Definition: ruby.h:791
rb_num2dbl
double rb_num2dbl(VALUE)
Definition: object.c:2964
rb_type
static int rb_type(VALUE obj)
Definition: ruby.h:1646
rb_ulong2num_inline
static VALUE rb_ulong2num_inline(unsigned long v)
Definition: ruby.h:1312
ruby_brace_glob
int ruby_brace_glob(const char *, int, ruby_glob_func *, VALUE)
Definition: dir.c:1713
ruby_init
void ruby_init(void)
Definition: eval.c:73
val
#define val
rb_cObject
RUBY_EXTERN VALUE rb_cObject
Definition: ruby.h:1553
rb_cNameErrorMesg
RUBY_EXTERN VALUE rb_cNameErrorMesg
Definition: ruby.h:1573
rb_string_value_cstr
char * rb_string_value_cstr(volatile VALUE *)
Definition: string.c:1644
rb_cArray
RUBY_EXTERN VALUE rb_cArray
Definition: ruby.h:1554
rb_gc_writebarrier
void rb_gc_writebarrier(VALUE a, VALUE b)
Definition: gc.c:4731
rb_eval_string_protect
VALUE rb_eval_string_protect(const char *, int *)
Evaluates the given string in an isolated binding.
Definition: vm_eval.c:1420
rb_obj_infect
void rb_obj_infect(VALUE, VALUE)
Definition: object.c:1047
ruby_safe_level_4_warning
int ruby_safe_level_4_warning(void)
Definition: safe.c:31
rb_eLoadError
RUBY_EXTERN VALUE rb_eLoadError
Definition: ruby.h:1623
T_NIL
#define T_NIL
Definition: ruby.h:476
rb_obj_write
static VALUE rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
Definition: ruby.h:1262
rb_cStat
RUBY_EXTERN VALUE rb_cStat
Definition: ruby.h:1582
RComplex::imag
const VALUE imag
Definition: ruby.h:951
RUBY_T_MODULE
Definition: ruby.h:447
rb_cBasicObject
RUBY_EXTERN VALUE rb_cBasicObject
Definition: ruby.h:1552
T_TRUE
#define T_TRUE
Definition: ruby.h:490
RBasic
Definition: ruby.h:747
rb_cRange
RUBY_EXTERN VALUE rb_cRange
Definition: ruby.h:1578
rb_eFatal
RUBY_EXTERN VALUE rb_eFatal
Definition: ruby.h:1596
rb_mKernel
RUBY_EXTERN VALUE rb_mKernel
Definition: ruby.h:1541
RClass::ptr
rb_classext_t * ptr
Definition: ruby.h:793
RArray
Definition: ruby.h:860
RStruct::basic
struct RBasic basic
Definition: ruby.h:1047
rb_secure_update
void rb_secure_update(VALUE)
Definition: safe.c:104
RComplex::real
const VALUE real
Definition: ruby.h:950
RObject::numiv
long numiv
Definition: ruby.h:766
rb_define_class
VALUE rb_define_class(const char *, VALUE)
Defines a top-level class.
Definition: class.c:630
rb_cTrueClass
RUBY_EXTERN VALUE rb_cTrueClass
Definition: ruby.h:1588
rb_eStopIteration
RUBY_EXTERN VALUE rb_eStopIteration
Definition: ruby.h:1600
rb_define_const
void rb_define_const(VALUE, const char *, VALUE)
Definition: variable.c:2225
PRINTF_ARGS
#define PRINTF_ARGS(decl, string_index, first_to_check)
Definition: ruby.h:49
rb_sys_fail_str
void rb_sys_fail_str(VALUE mesg)
Definition: error.c:1982
rb_eval_string
VALUE rb_eval_string(const char *)
Evaluates the given string in an isolated binding.
Definition: vm_eval.c:1404
RRational::basic
struct RBasic basic
Definition: ruby.h:940
rb_isalnum
int rb_isalnum(int c)
Definition: encoding.c:1921
RUBY_T_STRING
Definition: ruby.h:449
FLONUM_P
#define FLONUM_P(x)
Definition: ruby.h:367
RTypedData::typed_flag
VALUE typed_flag
Definition: ruby.h:988
T_FLOAT
#define T_FLOAT
Definition: ruby.h:481
TYPE
#define TYPE(x)
Definition: ruby.h:505
argc
int argc
Definition: ruby.c:131
rb_eLocalJumpError
RUBY_EXTERN VALUE rb_eLocalJumpError
Definition: ruby.h:1614
rb_num2long_inline
static long rb_num2long_inline(VALUE x)
Definition: ruby.h:593
RString::ary
char ary[RSTRING_EMBED_LEN_MAX+1]
Definition: ruby.h:831
rb_eKeyError
RUBY_EXTERN VALUE rb_eKeyError
Definition: ruby.h:1601
Qfalse
#define Qfalse
Definition: ruby.h:425
ruby_special_consts
ruby_special_consts
Definition: ruby.h:397
rb_eTypeError
RUBY_EXTERN VALUE rb_eTypeError
Definition: ruby.h:1608
defines.h
rb_cModule
RUBY_EXTERN VALUE rb_cModule
Definition: ruby.h:1572
rb_exit
void rb_exit(int status)
Definition: process.c:3647
RRational
Definition: ruby.h:939
rb_mod_syserr_fail_str
void rb_mod_syserr_fail_str(VALUE mod, int e, VALUE mesg)
Definition: error.c:2040
rb_obj_wb_unprotect
static VALUE rb_obj_wb_unprotect(VALUE x, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
Definition: ruby.h:1226
ruby_stop
void ruby_stop(int ex)
Calls ruby_cleanup() and exits the process.
Definition: eval.c:264
rb_ispunct
int rb_ispunct(int c)
Definition: encoding.c:1929
RB_UNUSED_VAR
#define RB_UNUSED_VAR(x)
Definition: ruby.h:528
rb_get_path
VALUE rb_get_path(VALUE)
Definition: file.c:225
rb_event_hook_func_t
void(* rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
Definition: ruby.h:1741
rb_obj_reveal
VALUE rb_obj_reveal(VALUE obj, VALUE klass)
Definition: object.c:62
RUBY_T_TRUE
Definition: ruby.h:462
rb_get_path_no_checksafe
VALUE rb_get_path_no_checksafe(VALUE)
Definition: file.c:219
rb_throw_obj
void rb_throw_obj(VALUE tag, VALUE value)
Definition: vm_eval.c:1733
RArray::basic
struct RBasic basic
Definition: ruby.h:861
rb_eNameError
RUBY_EXTERN VALUE rb_eNameError
Definition: ruby.h:1621
rb_float_new_in_heap
VALUE rb_float_new_in_heap(double)
Definition: numeric.c:637
rb_gvar_getter_t
VALUE rb_gvar_getter_t(ID id, void *data, struct rb_global_variable *gvar)
Definition: ruby.h:1374
RObject::ivptr
VALUE * ivptr
Definition: ruby.h:767
rb_data_type_struct::data
void * data
Definition: ruby.h:976
rb_islower
int rb_islower(int c)
Definition: encoding.c:1927
RHash::ntbl
struct st_table * ntbl
Definition: ruby.h:922
rb_cEnumerator
RUBY_EXTERN VALUE rb_cEnumerator
Definition: ruby.h:1563
RUBY_IMMEDIATE_MASK
Definition: ruby.h:404
rb_gvar_undef_getter
VALUE rb_gvar_undef_getter(ID id, void *data, struct rb_global_variable *gvar)
rb_eRegexpError
RUBY_EXTERN VALUE rb_eRegexpError
Definition: ruby.h:1616
ruby_set_script_name
void ruby_set_script_name(VALUE name)
Sets the current script name to this value.
Definition: ruby.c:1855
rb_num2ulong_inline
static unsigned long rb_num2ulong_inline(VALUE x)
Definition: ruby.h:602
rb_define_alias
void rb_define_alias(VALUE, const char *, const char *)
Defines an alias of a method.
Definition: class.c:1697
rb_cRegexp
RUBY_EXTERN VALUE rb_cRegexp
Definition: ruby.h:1581
rb_cIO
RUBY_EXTERN VALUE rb_cIO
Definition: ruby.h:1569
RRegexp::ptr
struct re_pattern_buffer * ptr
Definition: ruby.h:911
rb_int2big
VALUE rb_int2big(SIGNED_VALUE)
Definition: bignum.c:3164
RSTRING_LEN
#define RSTRING_LEN(str)
Definition: ruby.h:841
rb_define_module_function
void rb_define_module_function(VALUE, const char *, VALUE(*)(ANYARGS), int)
Defines a module function for module.
Definition: class.c:1670
rb_funcallv_public
VALUE rb_funcallv_public(VALUE, ID, int, const VALUE *)
Calls a method.
Definition: vm_eval.c:821
rb_yield
VALUE rb_yield(VALUE)
Definition: vm_eval.c:942
rb_gvar_var_marker
void rb_gvar_var_marker(VALUE *var)
rb_define_readonly_variable
void rb_define_readonly_variable(const char *, VALUE *)
Definition: variable.c:610
rb_mEnumerable
RUBY_EXTERN VALUE rb_mEnumerable
Definition: ruby.h:1543
func
SSL_METHOD *(* func)(void)
Definition: ossl_ssl.c:113
RUBY_T_HASH
Definition: ruby.h:452
rb_cEncoding
RUBY_EXTERN VALUE rb_cEncoding
Definition: ruby.h:1562
RUBY_EXTERN
#define RUBY_EXTERN
Definition: missing.h:67
rb_fix2int
long rb_fix2int(VALUE val)
Definition: numeric.c:2194
rb_cMatch
RUBY_EXTERN VALUE rb_cMatch
Definition: ruby.h:1570
rb_fatal
void rb_fatal(const char *fmt,...)
Definition: error.c:1911
ruby_prog_init
void ruby_prog_init(void)
Defines built-in variables.
Definition: ruby.c:1913
RSTRING_EMBED_LEN_MAX
#define RSTRING_EMBED_LEN_MAX
Definition: ruby.h:819
RBasic::klass
const VALUE klass
Definition: ruby.h:749
RArray::len
long len
Definition: ruby.h:864
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:39
rb_mWaitWritable
RUBY_EXTERN VALUE rb_mWaitWritable
Definition: ruby.h:1550
rb_num2short
short rb_num2short(VALUE)
Definition: numeric.c:2231
RUBY_T_COMPLEX
Definition: ruby.h:458
RUBY_T_UNDEF
Definition: ruby.h:467
RStruct
Definition: ruby.h:1046
ruby_glob_func
int ruby_glob_func(const char *, VALUE, void *)
Definition: ruby.h:1358
rb_gvar_val_getter
VALUE rb_gvar_val_getter(ID id, void *data, struct rb_global_variable *gvar)
rb_scan_args
int rb_scan_args(int, const VALUE *, const char *,...)
Definition: class.c:1728
rb_data_type_struct::dfree
void(* dfree)(void *)
Definition: ruby.h:970
RUBY_FLONUM_MASK
Definition: ruby.h:406
RFile
Definition: ruby.h:934
rb_eArgError
RUBY_EXTERN VALUE rb_eArgError
Definition: ruby.h:1597
ID
unsigned long ID
Definition: ruby.h:89
rb_num2char_inline
static char rb_num2char_inline(VALUE x)
Definition: ruby.h:1322
rb_catch
VALUE rb_catch(const char *, VALUE(*)(ANYARGS), VALUE)
Qnil
#define Qnil
Definition: ruby.h:427
RUBY_T_FALSE
Definition: ruby.h:463
uintptr_t
unsigned int uintptr_t
Definition: win32.h:103
RBIGNUM_EMBED_LEN_MAX
#define RBIGNUM_EMBED_LEN_MAX
Definition: ruby.h:1076
rb_fix2ushort
unsigned short rb_fix2ushort(VALUE)
Definition: numeric.c:2259
rb_eNotImpError
RUBY_EXTERN VALUE rb_eNotImpError
Definition: ruby.h:1610
rb_str_export_locale
VALUE rb_str_export_locale(VALUE)
Definition: string.c:749
type
int type
Definition: tcltklib.c:112
FL_TEST_RAW
#define FL_TEST_RAW(x, f)
Definition: ruby.h:1168
RArray::ptr
const VALUE * ptr
Definition: ruby.h:869
BUILTIN_TYPE
#define BUILTIN_TYPE(x)
Definition: ruby.h:502
VALUE
unsigned long VALUE
Definition: ruby.h:88
RString::shared
VALUE shared
Definition: ruby.h:828
rb_ruby_debug_ptr
VALUE * rb_ruby_debug_ptr(void)
Definition: vm.c:2863
rb_cThread
RUBY_EXTERN VALUE rb_cThread
Definition: ruby.h:1586
rb_eSecurityError
RUBY_EXTERN VALUE rb_eSecurityError
Definition: ruby.h:1605
RBASIC
#define RBASIC(obj)
Definition: ruby.h:1116
rb_readwrite_sys_fail
void rb_readwrite_sys_fail(int writable, const char *mesg)
Definition: io.c:11674
rb_class2name
const char * rb_class2name(VALUE)
Definition: variable.c:397
RBignum::basic
struct RBasic basic
Definition: ruby.h:1082
rb_obj_hide
VALUE rb_obj_hide(VALUE obj)
Definition: object.c:53
rb_cInteger
RUBY_EXTERN VALUE rb_cInteger
Definition: ruby.h:1568
FIX2INT
#define FIX2INT(x)
Definition: ruby.h:632
rb_uint2big
VALUE rb_uint2big(VALUE)
Definition: bignum.c:3142
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:38
rb_intern_str
ID rb_intern_str(VALUE str)
Definition: ripper.c:17150
rb_mod_syserr_fail
void rb_mod_syserr_fail(VALUE mod, int e, const char *mesg)
Definition: error.c:2032
rb_bug_errno
void rb_bug_errno(const char *mesg, int errno_arg)
Definition: error.c:350
rb_uint2inum
VALUE rb_uint2inum(VALUE)
Definition: bignum.c:3185
RUBY_Qfalse
Definition: ruby.h:399
rb_call_super
VALUE rb_call_super(int, const VALUE *)
Definition: vm_eval.c:274
ruby_init_stack
void ruby_init_stack(volatile VALUE *)
rb_id2name
const char * rb_id2name(ID)
Definition: ripper.c:17230
RBasic::flags
VALUE flags
Definition: ruby.h:748
rb_tolower
int rb_tolower(int c)
Definition: encoding.c:1935
rb_mErrno
RUBY_EXTERN VALUE rb_mErrno
Definition: ruby.h:1544
rb_cNumeric
RUBY_EXTERN VALUE rb_cNumeric
Definition: ruby.h:1575
rb_cClass
RUBY_EXTERN VALUE rb_cClass
Definition: ruby.h:1557
rb_sys_fail
void rb_sys_fail(const char *mesg)
Definition: error.c:1976
rb_eScriptError
RUBY_EXTERN VALUE rb_eScriptError
Definition: ruby.h:1620
rb_mFileTest
RUBY_EXTERN VALUE rb_mFileTest
Definition: ruby.h:1545
RBignum::ary
BDIGIT ary[RBIGNUM_EMBED_LEN_MAX]
Definition: ruby.h:1088
RObject::ary
VALUE ary[ROBJECT_EMBED_LEN_MAX]
Definition: ruby.h:770
FIXABLE
#define FIXABLE(f)
Definition: ruby.h:350
rb_isgraph
int rb_isgraph(int c)
Definition: encoding.c:1926
ruby_value_type
ruby_value_type
Definition: ruby.h:442
rb_define_hooked_variable
void rb_define_hooked_variable(const char *, VALUE *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
Definition: variable.c:585
rb_typeddata_is_kind_of
int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *)
Definition: error.c:510
rb_define_module_under
VALUE rb_define_module_under(VALUE, const char *)
Definition: class.c:766
RUBY_T_DATA
Definition: ruby.h:456
IMMEDIATE_P
#define IMMEDIATE_P(x)
Definition: ruby.h:352
rb_set_safe_level_force
void rb_set_safe_level_force(int)
Definition: safe.c:43
RSTRUCT_EMBED_LEN_MAX
#define RSTRUCT_EMBED_LEN_MAX
Definition: ruby.h:1045
RArray::capa
long capa
Definition: ruby.h:866
rb_iter_break_value
void rb_iter_break_value(VALUE val)
Definition: vm.c:1160
rb_syserr_new
VALUE rb_syserr_new(int, const char *)
Definition: error.c:1950
RRegexp::usecnt
unsigned long usecnt
Definition: ruby.h:913
RSTRING_PTR
#define RSTRING_PTR(str)
Definition: ruby.h:845
rb_extend_object
void rb_extend_object(VALUE, VALUE)
Definition: eval.c:1305
rb_equal
VALUE rb_equal(VALUE, VALUE)
Definition: object.c:89
rb_mod_sys_fail_str
void rb_mod_sys_fail_str(VALUE mod, VALUE mesg)
Definition: error.c:2024
rb_obj_setup
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
Definition: object.c:71
rb_insecure_operation
void rb_insecure_operation(void)
Definition: safe.c:109
rb_stderr
RUBY_EXTERN VALUE rb_stderr
Definition: ruby.h:1627
rb_funcallv
VALUE rb_funcallv(VALUE, ID, int, const VALUE *)
Calls a method.
Definition: vm_eval.c:806
RBignum::len
long len
Definition: ruby.h:1085
ruby_set_stack_size
void ruby_set_stack_size(size_t)
rb_obj_written
static VALUE rb_obj_written(VALUE a, RB_UNUSED_VAR(VALUE oldv), VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
Definition: ruby.h:1245
rb_int2inum
VALUE rb_int2inum(SIGNED_VALUE)
Definition: bignum.c:3192
rb_yield_values2
VALUE rb_yield_values2(int n, const VALUE *argv)
Definition: vm_eval.c:975
rb_funcall_passing_block
VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE *)
Definition: vm_eval.c:827
INT2FIX
#define INT2FIX(i)
Definition: ruby.h:231
rb_newobj
VALUE rb_newobj(void)
Definition: gc.c:1348
rb_gc_unregister_address
void rb_gc_unregister_address(VALUE *)
Definition: gc.c:4939
RStruct::heap
struct RStruct::@116::@117 heap
rb_int2num_inline
static VALUE rb_int2num_inline(int v)
Definition: ruby.h:1281
rb_newobj_of
VALUE rb_newobj_of(VALUE, VALUE)
Definition: gc.c:1354
RStruct::ary
const VALUE ary[RSTRUCT_EMBED_LEN_MAX]
Definition: ruby.h:1053
rb_num2int
long rb_num2int(VALUE val)
Definition: numeric.c:2188
rb_eSyntaxError
RUBY_EXTERN VALUE rb_eSyntaxError
Definition: ruby.h:1622
rb_safe_level
int rb_safe_level(void)
Definition: safe.c:37
rb_cStruct
RUBY_EXTERN VALUE rb_cStruct
Definition: ruby.h:1584
ruby_process_options
void * ruby_process_options(int, char **)
Definition: ruby.c:1960
ruby_script
void ruby_script(const char *name)
Sets the current script name to this value.
Definition: ruby.c:1842
RUBY_T_NONE
Definition: ruby.h:443
RHash::iter_lev
int iter_lev
Definition: ruby.h:923
RUBY_Qnil
Definition: ruby.h:401
rb_define_attr
void rb_define_attr(VALUE, const char *, int, int)
Defines (a) public accessor method(s) for an attribute.
Definition: class.c:1710
ROBJECT_EMBED_LEN_MAX
#define ROBJECT_EMBED_LEN_MAX
Definition: ruby.h:761
rb_mod_sys_fail
void rb_mod_sys_fail(VALUE mod, const char *mesg)
Definition: error.c:2016
rb_cBignum
RUBY_EXTERN VALUE rb_cBignum
Definition: ruby.h:1555
RUBY_DATA_FUNC
void(* RUBY_DATA_FUNC)(void *)
Definition: ruby.h:1001
ANYARGS
#define ANYARGS
Definition: defines.h:98
rb_data_type_struct
Definition: ruby.h:966
rb_event_flag_t
unsigned long rb_event_flag_t
Definition: ruby.h:1740
ruby_sig_finalize
void ruby_sig_finalize(void)
Definition: signal.c:1232
rb_syserr_fail_str
void rb_syserr_fail_str(int e, VALUE mesg)
Definition: error.c:1970
RUBY_T_FILE
Definition: ruby.h:455
rb_compile_warning
void rb_compile_warning(const char *file, int line, const char *fmt,...)
Definition: error.c:192
FL_WB_PROTECTED
#define FL_WB_PROTECTED
Definition: ruby.h:1134
ruby_init_loadpath
void ruby_init_loadpath(void)
Definition: ruby.c:380
rb_gvar_readonly_setter
void rb_gvar_readonly_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
rb_gvar_var_getter
VALUE rb_gvar_var_getter(ID id, void *data, struct rb_global_variable *gvar)
rb_special_const_p
static int rb_special_const_p(VALUE obj)
Definition: ruby.h:1687
LONG2FIX
#define LONG2FIX(i)
Definition: ruby.h:232
ruby_set_argv
void ruby_set_argv(int, char **)
Definition: ruby.c:1939
RUBY_T_MASK
Definition: ruby.h:472
rb_eSysStackError
RUBY_EXTERN VALUE rb_eSysStackError
Definition: ruby.h:1615
rb_eRuntimeError
RUBY_EXTERN VALUE rb_eRuntimeError
Definition: ruby.h:1604
RTEST
#define RTEST(v)
Definition: ruby.h:437
rb_gvar_marker_t
void rb_gvar_marker_t(VALUE *var)
Definition: ruby.h:1376
T_STRING
#define T_STRING
Definition: ruby.h:482
rb_rescue2
VALUE rb_rescue2(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE,...)
Definition: eval.c:741
rb_isxdigit
int rb_isxdigit(int c)
Definition: encoding.c:1932
rb_check_safe_str
void rb_check_safe_str(VALUE x)
Definition: safe.c:130
RClass::m_tbl_wrapper
struct method_table_wrapper * m_tbl_wrapper
Definition: ruby.h:794
rb_check_safe_obj
void rb_check_safe_obj(VALUE)
Definition: safe.c:122
rb_ensure
VALUE rb_ensure(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE)
Definition: eval.c:839
rb_define_variable
void rb_define_variable(const char *, VALUE *)
Definition: variable.c:604
T_FALSE
#define T_FALSE
Definition: ruby.h:491
rb_each
VALUE rb_each(VALUE)
Definition: vm_eval.c:1175
rb_check_type
void rb_check_type(VALUE, int)
Definition: error.c:477
rb_eException
RUBY_EXTERN VALUE rb_eException
Definition: ruby.h:1591
RARRAY_EMBED_LEN_MAX
#define RARRAY_EMBED_LEN_MAX
Definition: ruby.h:859
RUBY_FIXNUM_FLAG
Definition: ruby.h:405
RArray::aux
union RArray::@112::@113::@114 aux
rb_notimplement
void rb_notimplement(void)
Definition: error.c:1903
RTypedData::basic
struct RBasic basic
Definition: ruby.h:986
ruby_check_sizeof_long
char ruby_check_sizeof_long[SIZEOF_LONG==sizeof(long)?1:-1]
Definition: ruby.h:105
RFile::basic
struct RBasic basic
Definition: ruby.h:935
rb_eSystemExit
RUBY_EXTERN VALUE rb_eSystemExit
Definition: ruby.h:1593
rb_errinfo
VALUE rb_errinfo(void)
Definition: eval.c:1497
rb_yield_splat
VALUE rb_yield_splat(VALUE)
Definition: vm_eval.c:981
RHash::ifnone
const VALUE ifnone
Definition: ruby.h:924
rb_yield_block
VALUE rb_yield_block(VALUE, VALUE, int, const VALUE *, VALUE)
Definition: vm_eval.c:993
rb_data_type_struct::dmark
void(* dmark)(void *)
Definition: ruby.h:969
rb_eNoMemError
RUBY_EXTERN VALUE rb_eNoMemError
Definition: ruby.h:1611
rb_cRational
RUBY_EXTERN VALUE rb_cRational
Definition: ruby.h:1579
name
const char * name
Definition: nkf.c:208
RStruct::ptr
const VALUE * ptr
Definition: ruby.h:1051
rb_eIOError
RUBY_EXTERN VALUE rb_eIOError
Definition: ruby.h:1603
RHash::basic
struct RBasic basic
Definition: ruby.h:921
rb_eStandardError
RUBY_EXTERN VALUE rb_eStandardError
Definition: ruby.h:1592
rb_eSystemCallError
RUBY_EXTERN VALUE rb_eSystemCallError
Definition: ruby.h:1606
rb_cHash
RUBY_EXTERN VALUE rb_cHash
Definition: ruby.h:1567
rb_need_block
void rb_need_block(void)
Definition: eval.c:733
RString::heap
struct RString::@109::@110 heap
ruby_sysinit
void ruby_sysinit(int *argc, char ***argv)
Initializes the process for ruby(1).
Definition: ruby.c:2018
alloca
RUBY_SYMBOL_EXPORT_BEGIN void * alloca()
rb_eFloatDomainError
RUBY_EXTERN VALUE rb_eFloatDomainError
Definition: ruby.h:1613
RObject
Definition: ruby.h:762
RBignum::as
union RBignum::@118 as
rb_eval_string_wrap
VALUE rb_eval_string_wrap(const char *, int *)
Evaluates the given string under a module binding in an isolated binding.
Definition: vm_eval.c:1437
RTypedData::type
const rb_data_type_t * type
Definition: ruby.h:987
rb_num2ulong
VALUE rb_num2ulong(VALUE)
Definition: numeric.c:2109
rb_classext_struct
Definition: internal.h:264
rb_warning
void rb_warning(const char *fmt,...)
Definition: error.c:236
rb_secure
void rb_secure(int)
Definition: safe.c:88
rb_eEOFError
RUBY_EXTERN VALUE rb_eEOFError
Definition: ruby.h:1598
RHash
Definition: ruby.h:920
RString::len
long len
Definition: ruby.h:824
rb_data_type_struct::wrap_struct_name
const char * wrap_struct_name
Definition: ruby.h:967
RClass::super
VALUE super
Definition: ruby.h:792
rb_stdout
RUBY_EXTERN VALUE rb_stdout
Definition: ruby.h:1627
rb_ruby_verbose_ptr
VALUE * rb_ruby_verbose_ptr(void)
Definition: vm.c:2857
SPECIAL_CONST_P
#define SPECIAL_CONST_P(x)
Definition: ruby.h:1165
rb_define_module
VALUE rb_define_module(const char *)
Definition: class.c:746
rb_cSymbol
RUBY_EXTERN VALUE rb_cSymbol
Definition: ruby.h:1585
RUBY_T_ZOMBIE
Definition: ruby.h:470
rb_mComparable
RUBY_EXTERN VALUE rb_mComparable
Definition: ruby.h:1542
RData::data
void * data
Definition: ruby.h:961
SYMBOL_P
#define SYMBOL_P(x)
Definition: ruby.h:354
rb_float_value
double rb_float_value(VALUE)
Definition: numeric.c:4108
RUBY_T_FLOAT
Definition: ruby.h:448
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
Definition: ruby.h:1375
rb_isalpha
int rb_isalpha(int c)
Definition: encoding.c:1922
RArray::shared
VALUE shared
Definition: ruby.h:867
RClass
Definition: ruby.h:790
RUBY_T_ICLASS
Definition: ruby.h:469
FIX2LONG
#define FIX2LONG(x)
Definition: ruby.h:345
Qundef
#define Qundef
Definition: ruby.h:428
RRegexp::basic
struct RBasic basic
Definition: ruby.h:910
RUBY_FLONUM_FLAG
Definition: ruby.h:407
rb_cFixnum
RUBY_EXTERN VALUE rb_cFixnum
Definition: ruby.h:1565
rb_cTime
RUBY_EXTERN VALUE rb_cTime
Definition: ruby.h:1587
rb_num2ushort
unsigned short rb_num2ushort(VALUE)
Definition: numeric.c:2249
rb_define_method
void rb_define_method(VALUE, const char *, VALUE(*)(ANYARGS), int)
Definition: class.c:1488
rb_id2str
VALUE rb_id2str(ID)
Definition: ripper.c:17160
RUBY_T_BIGNUM
Definition: ruby.h:454
rb_warn
void rb_warn(const char *fmt,...)
Definition: error.c:223
rb_str_to_str
VALUE rb_str_to_str(VALUE)
Definition: string.c:964
rb_gvar_val_setter
void rb_gvar_val_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
rb_to_id
ID rb_to_id(VALUE)
Definition: string.c:8730
rb_eSignal
RUBY_EXTERN VALUE rb_eSignal
Definition: ruby.h:1595
rb_cNilClass
RUBY_EXTERN VALUE rb_cNilClass
Definition: ruby.h:1574
rb_alloc_tmp_buffer
void * rb_alloc_tmp_buffer(volatile VALUE *store, long len) RUBY_ATTR_ALLOC_SIZE((2))
Definition: string.c:925
RUBY_T_SYMBOL
Definition: ruby.h:464
ruby_executable_node
int ruby_executable_node(void *n, int *status)
Checks the return value of ruby_options().
Definition: eval.c:282
RData::basic
struct RBasic basic
Definition: ruby.h:958
FL_PROMOTED
#define FL_PROMOTED
Definition: ruby.h:1135
BDIGIT
#define BDIGIT
Definition: bigdecimal.h:47
RUBY_T_NIL
Definition: ruby.h:461
ruby_setup
int ruby_setup(void)
Definition: eval.c:44
argv
char ** argv
Definition: ruby.c:132
ruby_check_sizeof_int
char ruby_check_sizeof_int[SIZEOF_INT==sizeof(int)?1:-1]
Definition: ruby.h:104
RRegexp
Definition: ruby.h:909
rb_sys_warning
void rb_sys_warning(const char *fmt,...)
Definition: error.c:2048
rb_block_call_func_t
VALUE(* rb_block_call_func_t)(ANYARGS)
Definition: ruby.h:1518
RString::ptr
char * ptr
Definition: ruby.h:825
RObject::basic
struct RBasic basic
Definition: ruby.h:763
rb_gvar_val_marker
void rb_gvar_val_marker(VALUE *var)
SIGNED_VALUE
#define SIGNED_VALUE
Definition: ruby.h:90
RUBY_T_CLASS
Definition: ruby.h:446
rb_gvar_undef_marker
void rb_gvar_undef_marker(VALUE *var)