static void error_pos(void) { int sourceline; VALUE sourcefile = rb_source_location(&sourceline); if (sourcefile) { ID caller_name; if (sourceline == 0) { warn_printf("%"PRIsVALUE, sourcefile); } else if ((caller_name = rb_frame_callee()) != 0) { warn_printf("%"PRIsVALUE":%d:in `%"PRIsVALUE"'", sourcefile, sourceline, rb_id2str(caller_name)); } else { warn_printf("%"PRIsVALUE":%d", sourcefile, sourceline); } } }
static VALUE error_pos_str(void) { int sourceline; VALUE sourcefile = rb_source_location(&sourceline); if (sourcefile) { ID caller_name; if (sourceline == 0) { return rb_sprintf("%"PRIsVALUE": ", sourcefile); } else if ((caller_name = rb_frame_callee()) != 0) { return rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ", sourcefile, sourceline, rb_id2str(caller_name)); } else { return rb_sprintf("%"PRIsVALUE":%d: ", sourcefile, sourceline); } } return Qnil; }