Ruby: eval_error.c Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

eval_error.c
Go to the documentation of this file.
1/* -*-c-*- */
2/*
3 * included by eval.c
4 */
5
6#define write_warn(str, x) \
7 (NIL_P(str) ? warn_print(x) : (void)rb_str_cat_cstr(str, x))
8#define write_warn2(str, x, l) \
9 (NIL_P(str) ? warn_print2(x, l) : (void)rb_str_cat(str, x, l))
10#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
11#define warn_print(x) RB_GNUC_EXTENSION_BLOCK( \
12 (__builtin_constant_p(x)) ? \
13 rb_write_error2((x), (long)strlen(x)) : \
14 rb_write_error(x) \
15)
16#else
17#define warn_print(x) rb_write_error(x)
18#endif
19
20#define warn_print2(x,l) rb_write_error2((x),(l))
21
22#define write_warn_str(str,x) NIL_P(str) ? rb_write_error_str(x) : (void)rb_str_concat((str), (x))
23#define warn_print_str(x) rb_write_error_str(x)
24
25static VALUE error_pos_str(void);
26
27static void
28error_pos(const VALUE str)
29{
30 VALUE pos = error_pos_str();
31 if (!NIL_P(pos)) {
32 write_warn_str(str, pos);
33 }
34}
35
36static VALUE
37error_pos_str(void)
38{
39 int sourceline;
40 VALUE sourcefile = rb_source_location(&sourceline);
41
42 if (!NIL_P(sourcefile)) {
43 ID caller_name;
44 if (sourceline == 0) {
45 return rb_sprintf("%"PRIsVALUE": ", sourcefile);
46 }
47 else if ((caller_name = rb_frame_callee()) != 0) {
48 return rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ",
49 sourcefile, sourceline,
50 rb_id2str(caller_name));
51 }
52 else {
53 return rb_sprintf("%"PRIsVALUE":%d: ", sourcefile, sourceline);
54 }
55 }
56 return Qnil;
57}
58
59static void
60set_backtrace(VALUE info, VALUE bt)
61{
62 ID set_backtrace = rb_intern("set_backtrace");
63
64 if (rb_backtrace_p(bt)) {
65 if (rb_method_basic_definition_p(CLASS_OF(info), set_backtrace)) {
66 rb_exc_set_backtrace(info, bt);
67 return;
68 }
69 else {
70 bt = rb_backtrace_to_str_ary(bt);
71 }
72 }
73 rb_check_funcall(info, set_backtrace, 1, &bt);
74}
75
76static void
77error_print(rb_execution_context_t *ec)
78{
79 rb_ec_error_print(ec, ec->errinfo);
80}
81
82static void
83write_warnq(VALUE out, VALUE str, const char *ptr, long len)
84{
85 if (NIL_P(out)) {
86 const char *beg = ptr;
87 const long olen = len;
88 for (; len > 0; --len, ++ptr) {
89 unsigned char c = *ptr;
90 switch (c) {
91 case '\n': case '\t': continue;
92 }
93 if (rb_iscntrl(c)) {
94 char buf[5];
95 const char *cc = 0;
96 if (ptr > beg) rb_write_error2(beg, ptr - beg);
97 beg = ptr + 1;
98 cc = ruby_escaped_char(c);
99 if (cc) {
100 rb_write_error2(cc, strlen(cc));
101 }
102 else {
103 rb_write_error2(buf, snprintf(buf, sizeof(buf), "\\x%02X", c));
104 }
105 }
106 else if (c == '\\') {
107 rb_write_error2(beg, ptr - beg + 1);
108 beg = ptr;
109 }
110 }
111 if (ptr > beg) {
112 if (beg == RSTRING_PTR(str) && olen == RSTRING_LEN(str))
113 rb_write_error_str(str);
114 else
115 rb_write_error2(beg, ptr - beg);
116 }
117 }
118 else {
119 rb_str_cat(out, ptr, len);
120 }
121}
122
123#define CSI_BEGIN "\033["
124#define CSI_SGR "m"
125
126static const char underline[] = CSI_BEGIN"1;4"CSI_SGR;
127static const char bold[] = CSI_BEGIN"1"CSI_SGR;
128static const char reset[] = CSI_BEGIN""CSI_SGR;
129
130static void
131print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg, const VALUE str, int highlight)
132{
133 const char *einfo = "";
134 long elen = 0;
135 VALUE mesg;
136
137 if (emesg != Qundef) {
138 if (NIL_P(errat) || RARRAY_LEN(errat) == 0 ||
139 NIL_P(mesg = RARRAY_AREF(errat, 0))) {
140 error_pos(str);
141 }
142 else {
143 write_warn_str(str, mesg);
144 write_warn(str, ": ");
145 }
146
147 if (!NIL_P(emesg)) {
148 einfo = RSTRING_PTR(emesg);
149 elen = RSTRING_LEN(emesg);
150 }
151 }
152
153 if (eclass == rb_eRuntimeError && elen == 0) {
154 if (highlight) write_warn(str, underline);
155 write_warn(str, "unhandled exception");
156 if (highlight) write_warn(str, reset);
157 write_warn2(str, "\n", 1);
158 }
159 else {
160 VALUE epath;
161
162 epath = rb_class_name(eclass);
163 if (elen == 0) {
164 if (highlight) write_warn(str, underline);
165 write_warn_str(str, epath);
166 if (highlight) write_warn(str, reset);
167 write_warn(str, "\n");
168 }
169 else {
170 /* emesg is a String instance */
171 const char *tail = 0;
172
173 if (highlight) write_warn(str, bold);
174 if (RSTRING_PTR(epath)[0] == '#')
175 epath = 0;
176 if ((tail = memchr(einfo, '\n', elen)) != 0) {
177 write_warnq(str, emesg, einfo, tail - einfo);
178 tail++; /* skip newline */
179 }
180 else {
181 write_warnq(str, emesg, einfo, elen);
182 }
183 if (epath) {
184 write_warn(str, " (");
185 if (highlight) write_warn(str, underline);
186 write_warn_str(str, epath);
187 if (highlight) {
188 write_warn(str, reset);
189 write_warn(str, bold);
190 }
191 write_warn2(str, ")", 1);
192 if (highlight) write_warn(str, reset);
193 write_warn2(str, "\n", 1);
194 }
195 if (tail && einfo+elen > tail) {
196 if (!highlight) {
197 write_warnq(str, emesg, tail, einfo+elen-tail);
198 if (einfo[elen-1] != '\n') write_warn2(str, "\n", 1);
199 }
200 else {
201 elen -= tail - einfo;
202 einfo = tail;
203 while (elen > 0) {
204 tail = memchr(einfo, '\n', elen);
205 if (!tail || tail > einfo) {
206 write_warn(str, bold);
207 write_warnq(str, emesg, einfo, tail ? tail-einfo : elen);
208 write_warn(str, reset);
209 if (!tail) {
210 write_warn2(str, "\n", 1);
211 break;
212 }
213 }
214 elen -= tail - einfo;
215 einfo = tail;
216 do ++tail; while (tail < einfo+elen && *tail == '\n');
217 write_warnq(str, emesg, einfo, tail-einfo);
218 elen -= tail - einfo;
219 einfo = tail;
220 }
221 }
222 }
223 else if (!epath) {
224 write_warn2(str, "\n", 1);
225 }
226 }
227 }
228}
229
230static void
231print_backtrace(const VALUE eclass, const VALUE errat, const VALUE str, int reverse)
232{
233 if (!NIL_P(errat)) {
234 long i;
235 long len = RARRAY_LEN(errat);
236 const int threshold = 1000000000;
237 int width = (len <= 1) ? INT_MIN : ((int)log10((double)(len > threshold ?
238 ((len - 1) / threshold) :
239 len - 1)) +
240 (len < threshold ? 0 : 9) + 1);
241
242 long skip_start = -1, skip_len = 0;
243
244 // skip for stackoverflow
245 if (eclass == rb_eSysStackError) {
246 long trace_head = 9;
247 long trace_tail = 4;
248 long trace_max = trace_head + trace_tail + 5;
249 if (len > trace_max) {
250 skip_start = trace_head;
251 skip_len = len - trace_max + 5;
252 }
253 }
254
255 // skip for explicit limit
256 if (rb_backtrace_length_limit >= 0 && len > rb_backtrace_length_limit + 2) {
257 skip_start = rb_backtrace_length_limit + 1;
258 skip_len = len - skip_start;
259 }
260
261 for (i = 1; i < len; i++) {
262 if (i == skip_start) {
263 write_warn_str(str, rb_sprintf("\t ... %ld levels...\n", skip_len));
264 i += skip_len;
265 if (i >= len) break;
266 }
267 VALUE line = RARRAY_AREF(errat, reverse ? len - i : i);
268 if (RB_TYPE_P(line, T_STRING)) {
269 VALUE bt = rb_str_new_cstr("\t");
270 if (reverse) rb_str_catf(bt, "%*ld: ", width, len - i);
271 write_warn_str(str, rb_str_catf(bt, "from %"PRIsVALUE"\n", line));
272 }
273 }
274 }
275}
276
277 VALUE rb_get_message(VALUE exc);
278
279static int
280shown_cause_p(VALUE cause, VALUE *shown_causes)
281{
282 VALUE shown = *shown_causes;
283 if (!shown) {
284 *shown_causes = shown = rb_obj_hide(rb_ident_hash_new());
285 }
286 if (rb_hash_has_key(shown, cause)) return TRUE;
287 rb_hash_aset(shown, cause, Qtrue);
288 return FALSE;
289}
290
291static void
292show_cause(VALUE errinfo, VALUE str, VALUE highlight, VALUE reverse, VALUE *shown_causes)
293{
294 VALUE cause = rb_attr_get(errinfo, id_cause);
295 if (!NIL_P(cause) && rb_obj_is_kind_of(cause, rb_eException) &&
296 !shown_cause_p(cause, shown_causes)) {
297 volatile VALUE eclass = CLASS_OF(cause);
298 VALUE errat = rb_get_backtrace(cause);
299 VALUE emesg = rb_get_message(cause);
300 if (reverse) {
301 show_cause(cause, str, highlight, reverse, shown_causes);
302 print_backtrace(eclass, errat, str, TRUE);
303 print_errinfo(eclass, errat, emesg, str, highlight!=0);
304 }
305 else {
306 print_errinfo(eclass, errat, emesg, str, highlight!=0);
307 print_backtrace(eclass, errat, str, FALSE);
308 show_cause(cause, str, highlight, reverse, shown_causes);
309 }
310 }
311}
312
313void
314rb_error_write(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE highlight, VALUE reverse)
315{
316 volatile VALUE eclass;
317 VALUE shown_causes = 0;
318
319 if (NIL_P(errinfo))
320 return;
321
322 if (errat == Qundef) {
323 errat = Qnil;
324 }
325 eclass = CLASS_OF(errinfo);
326 if (NIL_P(reverse)) reverse = Qfalse;
327 if (NIL_P(highlight)) {
328 VALUE tty = (VALUE)rb_stderr_tty_p();
329 if (NIL_P(highlight)) highlight = tty;
330 }
331 if (reverse) {
332 static const char traceback[] = "Traceback "
333 "(most recent call last):\n";
334 const int bold_part = rb_strlen_lit("Traceback");
335 char buff[sizeof(traceback)+sizeof(bold)+sizeof(reset)-2], *p = buff;
336 const char *msg = traceback;
337 long len = sizeof(traceback) - 1;
338 if (highlight) {
339#define APPEND(s, l) (memcpy(p, s, l), p += (l))
340 APPEND(bold, sizeof(bold)-1);
341 APPEND(traceback, bold_part);
342 APPEND(reset, sizeof(reset)-1);
343 APPEND(traceback + bold_part, sizeof(traceback)-bold_part-1);
344#undef APPEND
345 len = p - (msg = buff);
346 }
347 write_warn2(str, msg, len);
348 show_cause(errinfo, str, highlight, reverse, &shown_causes);
349 print_backtrace(eclass, errat, str, TRUE);
350 print_errinfo(eclass, errat, emesg, str, highlight!=0);
351 }
352 else {
353 print_errinfo(eclass, errat, emesg, str, highlight!=0);
354 print_backtrace(eclass, errat, str, FALSE);
355 show_cause(errinfo, str, highlight, reverse, &shown_causes);
356 }
357}
358
359void
360rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
361{
362 volatile uint8_t raised_flag = ec->raised_flag;
363 volatile VALUE errat = Qundef;
364 volatile VALUE emesg = Qundef;
365 volatile bool written = false;
366
367 if (NIL_P(errinfo))
368 return;
369 rb_ec_raised_clear(ec);
370
371 EC_PUSH_TAG(ec);
372 if (EC_EXEC_TAG() == TAG_NONE) {
373 errat = rb_get_backtrace(errinfo);
374 }
375 if (emesg == Qundef) {
376 emesg = Qnil;
377 emesg = rb_get_message(errinfo);
378 }
379
380 if (!written) {
381 written = true;
382 rb_error_write(errinfo, emesg, errat, Qnil, Qnil, Qfalse);
383 }
384
385 EC_POP_TAG();
386 ec->errinfo = errinfo;
387 rb_ec_raised_set(ec, raised_flag);
388}
389
390#define undef_mesg_for(v, k) rb_fstring_lit("undefined"v" method `%1$s' for "k" `%2$s'")
391#define undef_mesg(v) ( \
392 is_mod ? \
393 undef_mesg_for(v, "module") : \
394 undef_mesg_for(v, "class"))
395
396void
397rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
398{
399 const int is_mod = RB_TYPE_P(klass, T_MODULE);
400 VALUE mesg;
401 switch (visi & METHOD_VISI_MASK) {
402 case METHOD_VISI_UNDEF:
403 case METHOD_VISI_PUBLIC: mesg = undef_mesg(""); break;
404 case METHOD_VISI_PRIVATE: mesg = undef_mesg(" private"); break;
405 case METHOD_VISI_PROTECTED: mesg = undef_mesg(" protected"); break;
406 default: UNREACHABLE;
407 }
408 rb_name_err_raise_str(mesg, klass, ID2SYM(id));
409}
410
411void
412rb_print_undef_str(VALUE klass, VALUE name)
413{
414 const int is_mod = RB_TYPE_P(klass, T_MODULE);
415 rb_name_err_raise_str(undef_mesg(""), klass, name);
416}
417
418#define inaccessible_mesg_for(v, k) rb_fstring_lit("method `%1$s' for "k" `%2$s' is "v)
419#define inaccessible_mesg(v) ( \
420 is_mod ? \
421 inaccessible_mesg_for(v, "module") : \
422 inaccessible_mesg_for(v, "class"))
423
424void
425rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
426{
427 const int is_mod = RB_TYPE_P(klass, T_MODULE);
428 VALUE mesg;
429 switch (visi & METHOD_VISI_MASK) {
430 case METHOD_VISI_UNDEF:
431 case METHOD_VISI_PUBLIC: mesg = inaccessible_mesg(""); break;
432 case METHOD_VISI_PRIVATE: mesg = inaccessible_mesg(" private"); break;
433 case METHOD_VISI_PROTECTED: mesg = inaccessible_mesg(" protected"); break;
434 default: UNREACHABLE;
435 }
436 rb_name_err_raise_str(mesg, klass, ID2SYM(id));
437}
438
439static int
440sysexit_status(VALUE err)
441{
442 VALUE st = rb_ivar_get(err, id_status);
443 return NUM2INT(st);
444}
445
446#define unknown_longjmp_status(status) \
447 rb_bug("Unknown longjmp status %d", status)
448
449static int
450error_handle(rb_execution_context_t *ec, int ex)
451{
452 int status = EXIT_FAILURE;
453
454 if (rb_ec_set_raised(ec))
455 return EXIT_FAILURE;
456 switch (ex & TAG_MASK) {
457 case 0:
458 status = EXIT_SUCCESS;
459 break;
460
461 case TAG_RETURN:
462 error_pos(Qnil);
463 warn_print("unexpected return\n");
464 break;
465 case TAG_NEXT:
466 error_pos(Qnil);
467 warn_print("unexpected next\n");
468 break;
469 case TAG_BREAK:
470 error_pos(Qnil);
471 warn_print("unexpected break\n");
472 break;
473 case TAG_REDO:
474 error_pos(Qnil);
475 warn_print("unexpected redo\n");
476 break;
477 case TAG_RETRY:
478 error_pos(Qnil);
479 warn_print("retry outside of rescue clause\n");
480 break;
481 case TAG_THROW:
482 /* TODO: fix me */
483 error_pos(Qnil);
484 warn_print("unexpected throw\n");
485 break;
486 case TAG_RAISE: {
487 VALUE errinfo = ec->errinfo;
488 if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
489 status = sysexit_status(errinfo);
490 }
491 else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
492 rb_ivar_get(errinfo, id_signo) != INT2FIX(SIGSEGV)) {
493 /* no message when exiting by signal */
494 }
495 else if (rb_obj_is_kind_of(errinfo, rb_eSystemCallError) &&
496 FIXNUM_P(rb_attr_get(errinfo, id_signo))) {
497 /* no message when exiting by error to be mapped to signal */
498 }
499 else {
500 rb_ec_error_print(ec, errinfo);
501 }
502 break;
503 }
504 case TAG_FATAL:
505 error_print(ec);
506 break;
507 default:
508 unknown_longjmp_status(ex);
509 break;
510 }
511 rb_ec_reset_raised(ec);
512 return status;
513}
UNREACHABLE
#define UNREACHABLE
Definition: assume.h:30
ptr
struct RIMemo * ptr
Definition: debug.c:88
out
string_t out
Definition: enough.c:230
len
uint8_t len
Definition: escape.c:17
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
rb_eSysStackError
VALUE rb_eSysStackError
Definition: eval.c:49
undef_mesg
#define undef_mesg(v)
Definition: eval_error.c:391
rb_ec_error_print
void rb_ec_error_print(rb_execution_context_t *volatile ec, volatile VALUE errinfo)
Definition: eval_error.c:360
warn_print
#define warn_print(x)
Definition: eval_error.c:17
inaccessible_mesg
#define inaccessible_mesg(v)
Definition: eval_error.c:419
write_warn
#define write_warn(str, x)
Definition: eval_error.c:6
rb_print_undef
void rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
Definition: eval_error.c:397
write_warn_str
#define write_warn_str(str, x)
Definition: eval_error.c:22
rb_print_inaccessible
void rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
Definition: eval_error.c:425
rb_print_undef_str
void rb_print_undef_str(VALUE klass, VALUE name)
Definition: eval_error.c:412
write_warn2
#define write_warn2(str, x, l)
Definition: eval_error.c:8
unknown_longjmp_status
#define unknown_longjmp_status(status)
Definition: eval_error.c:446
CSI_BEGIN
#define CSI_BEGIN
Definition: eval_error.c:123
CSI_SGR
#define CSI_SGR
Definition: eval_error.c:124
APPEND
#define APPEND(s, l)
rb_ec_set_raised
int rb_ec_set_raised(rb_execution_context_t *ec)
Definition: thread.c:2587
rb_ec_raised_set
#define rb_ec_raised_set(ec, f)
Definition: eval_intern.h:270
EC_EXEC_TAG
#define EC_EXEC_TAG()
Definition: eval_intern.h:193
EC_PUSH_TAG
#define EC_PUSH_TAG(ec)
Definition: eval_intern.h:130
EXIT_FAILURE
#define EXIT_FAILURE
Definition: eval_intern.h:32
rb_ec_raised_clear
#define rb_ec_raised_clear(ec)
Definition: eval_intern.h:273
EC_POP_TAG
#define EC_POP_TAG()
Definition: eval_intern.h:138
rb_ec_reset_raised
int rb_ec_reset_raised(rb_execution_context_t *ec)
Definition: thread.c:2597
RSTRING_LEN
#define RSTRING_LEN(string)
Definition: fbuffer.h:22
RSTRING_PTR
#define RSTRING_PTR(string)
Definition: fbuffer.h:19
PRIsVALUE
#define PRIsVALUE
Definition: function.c:10
CLASS_OF
#define CLASS_OF
Definition: globals.h:153
rb_frame_callee
ID rb_frame_callee(void)
The name of the current method.
Definition: eval.c:1233
rb_get_backtrace
VALUE rb_get_backtrace(VALUE exc)
Definition: error.c:1365
rb_exc_set_backtrace
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
Definition: error.c:1446
rb_error_write
void rb_error_write(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE highlight, VALUE reverse)
Definition: eval_error.c:314
rb_eSystemExit
VALUE rb_eSystemExit
Definition: error.c:1050
rb_ident_hash_new
VALUE rb_ident_hash_new(void)
Definition: hash.c:4443
EXIT_SUCCESS
#define EXIT_SUCCESS
Definition: error.c:52
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:1055
rb_eException
VALUE rb_eException
Definition: error.c:1049
rb_get_message
VALUE rb_get_message(VALUE exc)
Definition: error.c:1187
rb_backtrace_length_limit
long rb_backtrace_length_limit
Definition: error.c:68
id_cause
#define id_cause
Definition: error.c:1081
rb_eSystemCallError
VALUE rb_eSystemCallError
Definition: error.c:1076
rb_eSignal
VALUE rb_eSignal
Definition: error.c:1052
rb_obj_hide
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
Definition: object.c:92
rb_obj_is_instance_of
VALUE rb_obj_is_instance_of(VALUE, VALUE)
Determines if obj is an instance of c.
Definition: object.c:707
rb_obj_is_kind_of
VALUE rb_obj_is_kind_of(VALUE, VALUE)
Determines if obj is a kind of c.
Definition: object.c:724
rb_hash_has_key
VALUE rb_hash_has_key(VALUE hash, VALUE key)
Definition: hash.c:3638
rb_hash_aset
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
Definition: hash.c:2901
rb_write_error2
void rb_write_error2(const char *, long)
Definition: io.c:8058
rb_str_cat
VALUE rb_str_cat(VALUE, const char *, long)
Definition: string.c:2962
rb_strlen_lit
#define rb_strlen_lit(str)
Definition: string.h:286
rb_str_new_cstr
#define rb_str_new_cstr(str)
Definition: string.h:219
rb_class_name
VALUE rb_class_name(VALUE)
Definition: variable.c:293
rb_ivar_get
VALUE rb_ivar_get(VALUE, ID)
Definition: variable.c:1234
rb_attr_get
VALUE rb_attr_get(VALUE, ID)
Definition: variable.c:1242
rb_check_funcall
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
Definition: vm_eval.c:619
ID2SYM
#define ID2SYM
Definition: symbol.h:44
rb_intern
ID rb_intern(const char *)
Definition: symbol.c:785
NUM2INT
#define NUM2INT
Definition: int.h:44
id_status
#define id_status
Definition: eval.h:17
id_signo
#define id_signo
Definition: eval.h:16
rb_stderr_tty_p
int rb_stderr_tty_p(void)
Definition: io.c:8105
ruby_escaped_char
const char * ruby_escaped_char(int c)
Definition: string.c:6117
rb_backtrace_to_str_ary
VALUE rb_backtrace_to_str_ary(VALUE obj)
Definition: vm_backtrace.c:809
rb_backtrace_p
int rb_backtrace_p(VALUE obj)
Definition: vm_backtrace.c:471
rb_source_location
VALUE rb_source_location(int *pline)
Definition: vm.c:1600
rb_method_basic_definition_p
#define rb_method_basic_definition_p(...)
Definition: internal.h:78
buf
voidpf void * buf
Definition: ioapi.h:138
INT2FIX
#define INT2FIX
Definition: long.h:48
rb_method_visibility_t
rb_method_visibility_t
Definition: method.h:29
METHOD_VISI_PRIVATE
@ METHOD_VISI_PRIVATE
Definition: method.h:32
METHOD_VISI_MASK
@ METHOD_VISI_MASK
Definition: method.h:35
METHOD_VISI_PROTECTED
@ METHOD_VISI_PROTECTED
Definition: method.h:33
METHOD_VISI_PUBLIC
@ METHOD_VISI_PUBLIC
Definition: method.h:31
METHOD_VISI_UNDEF
@ METHOD_VISI_UNDEF
Definition: method.h:30
name
const char * name
Definition: nkf.c:208
TRUE
#define TRUE
Definition: nkf.h:175
FALSE
#define FALSE
Definition: nkf.h:174
RARRAY_AREF
#define RARRAY_AREF(a, i)
Definition: psych_emitter.c:7
RARRAY_LEN
#define RARRAY_LEN
Definition: rarray.h:52
uint8_t
unsigned char uint8_t
Definition: sha2.h:100
Qundef
#define Qundef
Definition: special_consts.h:53
Qtrue
#define Qtrue
Definition: special_consts.h:52
Qnil
#define Qnil
Definition: special_consts.h:51
Qfalse
#define Qfalse
Definition: special_consts.h:50
NIL_P
#define NIL_P
Definition: special_consts.h:46
FIXNUM_P
#define FIXNUM_P
Definition: special_consts.h:44
rb_str_catf
VALUE rb_str_catf(VALUE, const char *,...)
Definition: sprintf.c:1243
rb_sprintf
VALUE rb_sprintf(const char *,...)
Definition: sprintf.c:1203
strlen
size_t strlen(const char *)
rb_execution_context_struct
Definition: vm_core.h:854
rb_execution_context_struct::raised_flag
uint8_t raised_flag
Definition: vm_core.h:892
rb_execution_context_struct::errinfo
VALUE errinfo
Definition: vm_core.h:889
snprintf
#define snprintf
Definition: subst.h:14
VALUE
unsigned long VALUE
Definition: value.h:38
ID
unsigned long ID
Definition: value.h:39
T_STRING
#define T_STRING
Definition: value_type.h:77
T_MODULE
#define T_MODULE
Definition: value_type.h:69
rb_id2str
#define rb_id2str(id)
Definition: vm_backtrace.c:30
TAG_RAISE
#define TAG_RAISE
Definition: vm_core.h:204
TAG_NONE
#define TAG_NONE
Definition: vm_core.h:198
TAG_RETRY
#define TAG_RETRY
Definition: vm_core.h:202
TAG_MASK
#define TAG_MASK
Definition: vm_core.h:207
TAG_THROW
#define TAG_THROW
Definition: vm_core.h:205
TAG_FATAL
#define TAG_FATAL
Definition: vm_core.h:206
TAG_REDO
#define TAG_REDO
Definition: vm_core.h:203
TAG_BREAK
#define TAG_BREAK
Definition: vm_core.h:200
TAG_RETURN
#define TAG_RETURN
Definition: vm_core.h:199
TAG_NEXT
#define TAG_NEXT
Definition: vm_core.h:201
err
int err
Definition: win32.c:142
rb_write_error_str
void rb_write_error_str(VALUE mesg)
Definition: io.c:8083