6 #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P 7 #define warn_print(x) RB_GNUC_EXTENSION_BLOCK( \ 8 (__builtin_constant_p(x)) ? \ 9 rb_write_error2((x), (long)strlen(x)) : \ 13 #define warn_print(x) rb_write_error(x) 15 #define warn_print2(x,l) rb_write_error2((x),(l)) 16 #define warn_print_str(x) rb_write_error_str(x) 18 static VALUE error_pos_str(
void);
23 VALUE str = error_pos_str();
37 if (sourceline == 0) {
42 sourcefile, sourceline,
78 const char *einfo =
"";
110 const char *tail = 0;
115 if ((tail = memchr(einfo,
'\n', elen)) != 0) {
128 if (tail ? einfo[elen-1] !=
'\n' : !epath)
warn_print2(
"\n", 1);
134 print_backtrace(
const VALUE eclass,
const VALUE errat,
int reverse)
140 const int threshold = 1000000000;
141 int width = ((int)log10((
double)(len > threshold ?
142 ((len - 1) / threshold) :
144 (len < threshold ? 0 : 9) + 1);
146 #define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5) 150 for (i = 1; i <
len; i++) {
154 if (reverse)
rb_str_catf(str,
"%*ld: ", width, len - i);
181 else if (errat ==
Qundef) {
195 warn_print(
"Traceback (most recent call last):\n");
196 print_backtrace(eclass, errat,
TRUE);
197 print_errinfo(eclass, errat, emesg);
200 print_errinfo(eclass, errat, emesg);
201 print_backtrace(eclass, errat,
FALSE);
209 #define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'") 210 #define undef_mesg(v) ( \ 212 undef_mesg_for(v, "module") : \ 213 undef_mesg_for(v, "class")) 237 #define inaccessible_mesg_for(v, k) rb_fstring_cstr("method `%1$s' for "k" `%2$s' is "v) 238 #define inaccessible_mesg(v) ( \ 240 inaccessible_mesg_for(v, "module") : \ 241 inaccessible_mesg_for(v, "class")) 265 #define unknown_longjmp_status(status) \ 266 rb_bug("Unknown longjmp status %d", status) 299 warn_print(
"retry outside of rescue clause\n");
309 status = sysexit_status(errinfo);
int rb_stderr_tty_p(void)
#define warn_print2(x, l)
void rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
#define rb_name_err_raise_str(mesg, recv, name)
void rb_print_undef_str(VALUE klass, VALUE name)
VALUE rb_ivar_get(VALUE, ID)
#define RB_TYPE_P(obj, type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
call-seq: obj.is_a?(class) -> true or false obj.kind_of?(class) -> true or false
VALUE rb_class_name(VALUE)
int rb_threadptr_set_raised(rb_thread_t *th)
void rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
#define warn_print_str(x)
VALUE rb_obj_is_instance_of(VALUE, VALUE)
call-seq: obj.instance_of?(class) -> true or false
void rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo)
int rb_backtrace_p(VALUE obj)
#define rb_thread_raised_clear(th)
VALUE rb_backtrace_to_str_ary(VALUE obj)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_sprintf(const char *format,...)
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
#define rb_thread_raised_set(th, f)
int rb_threadptr_reset_raised(rb_thread_t *th)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
VALUE rb_str_new_cstr(const char *)
register unsigned int len
VALUE rb_get_backtrace(VALUE exc)
#define RARRAY_AREF(a, i)
ID rb_frame_callee(void)
The name of the current method.
VALUE rb_str_catf(VALUE str, const char *format,...)
VALUE rb_check_string_type(VALUE)
#define inaccessible_mesg(v)
int rb_method_basic_definition_p(VALUE, ID)
rb_execution_context_t ec
VALUE rb_source_location(int *pline)
#define unknown_longjmp_status(status)