Example #1
0
static VALUE
rb_thread_inspect(VALUE thread, SEL sel)
{
    const char *status = rb_thread_status_cstr(thread);

    char buf[100];
    snprintf(buf, sizeof buf, "#<%s:%p %s>", rb_obj_classname(thread),
	    (void *)thread, status);

    VALUE str = rb_str_new2(buf);
    OBJ_INFECT(str, thread);

    return str;
}
Example #2
0
PRIMITIVE void *
vm_get_block(VALUE obj)
{
    if (obj == Qnil) {
	return NULL;
    }

    VALUE proc = rb_check_convert_type(obj, T_DATA, "Proc", "to_proc");
    if (NIL_P(proc)) {
	rb_raise(rb_eTypeError,
		"wrong argument type %s (expected Proc)",
		rb_obj_classname(obj));
    }
    return rb_proc_get_block(proc);
}
Example #3
0
/* grpc_rb_op_update_status_from_server adds the values in a ruby status
   struct to the 'send_status_from_server' portion of an op.
*/
static void grpc_rb_op_update_status_from_server(grpc_op *op,
                                                 grpc_metadata_array *md_ary,
                                                 VALUE status) {
  VALUE code = rb_struct_aref(status, sym_code);
  VALUE details = rb_struct_aref(status, sym_details);
  VALUE metadata_hash = rb_struct_aref(status, sym_metadata);

  /* TODO: add check to ensure status is the correct struct type */
  if (TYPE(code) != T_FIXNUM) {
    rb_raise(rb_eTypeError, "invalid code : got <%s>, want <Fixnum>",
             rb_obj_classname(code));
    return;
  }
  if (TYPE(details) != T_STRING) {
    rb_raise(rb_eTypeError, "invalid details : got <%s>, want <String>",
             rb_obj_classname(code));
    return;
  }
  op->data.send_status_from_server.status = NUM2INT(code);
  op->data.send_status_from_server.status_details = StringValueCStr(details);
  grpc_rb_md_ary_convert(metadata_hash, md_ary);
  op->data.send_status_from_server.trailing_metadata_count = md_ary->count;
  op->data.send_status_from_server.trailing_metadata = md_ary->metadata;
}
Example #4
0
/**
 * call-seq:
 *   inspect()  → a_string
 *
 * Human-readable description.
 */
static VALUE inspect(VALUE self)
{
  alpm_handle_t* p_alpm = NULL;
  char buf[256];
  int len;

  Data_Get_Struct(self, alpm_handle_t, p_alpm);

  len = sprintf(buf, "#<%s target=%s db=%s>",
                rb_obj_classname(self),
                alpm_option_get_root(p_alpm),
                alpm_option_get_dbpath(p_alpm));

  return rb_str_new(buf, len);
}
Example #5
0
/*
 *  call-seq:
 *     dir.inspect => string
 *
 *  Return a string describing this Dir object.
 */
static VALUE
dir_inspect(VALUE dir)
{
    struct dir_data *dirp;

    Data_Get_Struct(dir, struct dir_data, dirp);
    if (dirp->path) {
	const char *c = rb_obj_classname(dir);
	int len = strlen(c) + strlen(dirp->path) + 4;
	VALUE s = rb_str_new(0, len);
	snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
	return s;
    }
    return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}
Example #6
0
/*
 * call-seq: put(pointer, value)
 * @param [AbstractMemory] pointer pointer on a {Struct}
 * @param [Object] value this object must be a kind of {#type}
 * @return [self]
 * Put an object to memory pointed by +pointer+.
 */
static VALUE
struct_field_put(VALUE self, VALUE pointer, VALUE value)
{
    StructField* f;
    
    Data_Get_Struct(self, StructField, f);
    if (f->memoryOp == NULL) {
        rb_raise(rb_eArgError, "put not supported for %s", rb_obj_classname(f->rbType));
        return self;
    }

    (*f->memoryOp->put)(MEMORY(pointer), f->offset, value);

    return self;
}
Example #7
0
File: graph.c Project: ged/redleaf
/*
 * call-seq:
 *   graph.store = new_store
 *
 * Associate the given +new_store+ with the receiver, breaking the association between
 * it and any previous Store.
 *
 */
static VALUE
rleaf_redleaf_graph_store_eq( VALUE self, VALUE storeobj ) {
	rleaf_GRAPH *ptr = rleaf_get_graph( self );

	if ( storeobj == Qnil ) {
		rleaf_log_with_context( self, "info",
			"Graph <0x%x>'s store cleared. Setting it to a new %s.",
		 	self, rb_class2name(DEFAULT_STORE_CLASS) );
		storeobj = rb_class_new_instance( 0, NULL, DEFAULT_STORE_CLASS );
	}

	if ( rb_obj_is_kind_of(storeobj, rleaf_cRedleafStore) ) {
		rleaf_log_with_context( self, "info", "Graph <0x%x>'s store is now %s <0x%x>",
			self, rb_obj_classname(storeobj), storeobj );
		rb_funcall( storeobj, graph_eq, 1, self );
	} else {
		rb_raise( rb_eArgError, "cannot convert %s to Redleaf::Store",
			rb_obj_classname(storeobj) );
	}

	ptr->store = storeobj;

	return storeobj;
}
Example #8
0
void mochilo_pack_one(mochilo_buf *buf, VALUE rb_object)
{
	switch (rb_type(rb_object)) {
	case T_NIL:
		mochilo_buf_putc(buf, MSGPACK_T_NIL);
		return;

	case T_TRUE:
		mochilo_buf_putc(buf, MSGPACK_T_TRUE);
		return;

	case T_FALSE:
		mochilo_buf_putc(buf, MSGPACK_T_FALSE);
		return;

	case T_FIXNUM:
		mochilo_pack_fixnum(buf, rb_object);
		return;

	case T_STRING:
		if (ENCODING_GET(rb_object) != 0)
			mochilo_pack_str(buf, rb_object);
		else
			mochilo_pack_bytes(buf, rb_object);
		return;

	case T_HASH:
		mochilo_pack_hash(buf, rb_object);
		return;

	case T_ARRAY:
		mochilo_pack_array(buf, rb_object);
		return;

	case T_FLOAT:
		mochilo_pack_double(buf, rb_object);
		return;

	case T_BIGNUM:
		mochilo_pack_bignum(buf, rb_object);
		return;

	default:
		rb_raise(rb_eMochiloPackError,
				"Unsupported object type: %s", rb_obj_classname(rb_object));
		return;
	}
}
Example #9
0
static VALUE
range_each(VALUE range, SEL sel)
{
    VALUE beg, end;

    RETURN_ENUMERATOR(range, 0, 0);

    beg = RANGE_BEG(range);
    end = RANGE_END(range);

    if (FIXNUM_P(beg) && FIXNUM_P(end)) { /* fixnums are special */
	long lim = FIX2LONG(end);
	long i;

	if (!EXCL(range))
	    lim += 1;
	for (i = FIX2LONG(beg); i < lim; i++) {
	    rb_yield(LONG2FIX(i));
	    RETURN_IF_BROKEN();
	}
    }
    else if (SYMBOL_P(beg) && SYMBOL_P(end)) { /* symbols are special */
	VALUE args[2];

	args[0] = rb_sym_to_s(end);
	args[1] = EXCL(range) ? Qtrue : Qfalse;
	rb_objc_block_call(rb_sym_to_s(beg), selUpto, 2, args, sym_each_i, 0);
    }
    else {
	VALUE tmp = rb_check_string_type(beg);

	if (!NIL_P(tmp)) {
	    VALUE args[2];

	    args[0] = end;
	    args[1] = EXCL(range) ? Qtrue : Qfalse;
	    rb_objc_block_call(beg, selUpto, 2, args, rb_yield, 0);
	}
	else {
	    if (!discrete_object_p(beg)) {
		rb_raise(rb_eTypeError, "can't iterate from %s",
			 rb_obj_classname(beg));
	    }
	    range_each_func(range, each_i, NULL);
	}
    }
    return range;
}
Example #10
0
static VALUE
inspect_enumerator(VALUE obj, VALUE dummy, int recur)
{
    struct enumerator *e = enumerator_ptr(obj);
    const char *cname = rb_obj_classname(obj);
    VALUE eobj, str;
    int tainted, untrusted;

    if (recur) {
	str = rb_sprintf("#<%s: ...>", cname);
	OBJ_TAINT(str);
	return str;
    }

    eobj = e->obj;

    tainted   = OBJ_TAINTED(eobj);
    untrusted = OBJ_UNTRUSTED(eobj);

    /* (1..100).each_cons(2) => "#<Enumerator: 1..100:each_cons(2)>" */
    str = rb_sprintf("#<%s: ", cname);
    rb_str_concat(str, rb_inspect(eobj));
    rb_str_buf_cat2(str, ":");
    rb_str_buf_cat2(str, rb_id2name(e->meth));

    if (e->args) {
	long   argc = RARRAY_LEN(e->args);
	VALUE *argv = RARRAY_PTR(e->args);

	rb_str_buf_cat2(str, "(");

	while (argc--) {
	    VALUE arg = *argv++;

	    rb_str_concat(str, rb_inspect(arg));
	    rb_str_buf_cat2(str, argc > 0 ? ", " : ")");

	    if (OBJ_TAINTED(arg)) tainted = TRUE;
	    if (OBJ_UNTRUSTED(arg)) untrusted = TRUE;
	}
    }

    rb_str_buf_cat2(str, ">");

    if (tainted) OBJ_TAINT(str);
    if (untrusted) OBJ_UNTRUST(str);
    return str;
}
Example #11
0
/*
 * call-seq:
 *    coder.encode( value [, encoding] )
 *
 * Encodes the given Ruby object into string representation, without
 * sending data to/from the database server.
 *
 * A nil value is passed through.
 *
 */
static VALUE
pg_coder_encode(int argc, VALUE *argv, VALUE self)
{
	VALUE res;
	VALUE intermediate;
	VALUE value;
	int len, len2;
	int enc_idx;
	t_pg_coder *this = DATA_PTR(self);

	if(argc < 1 || argc > 2){
		rb_raise(rb_eArgError, "wrong number of arguments (%i for 1..2)", argc);
	}else if(argc == 1){
		enc_idx = rb_ascii8bit_encindex();
	}else{
		enc_idx = rb_to_encoding_index(argv[1]);
	}
	value = argv[0];

	if( NIL_P(value) )
		return Qnil;

	if( !this->enc_func ){
		rb_raise(rb_eRuntimeError, "no encoder function defined");
	}

	len = this->enc_func( this, value, NULL, &intermediate, enc_idx );

	if( len == -1 ){
		/* The intermediate value is a String that can be used directly. */
		OBJ_INFECT(intermediate, value);
		return intermediate;
	}

	res = rb_str_new(NULL, len);
	PG_ENCODING_SET_NOCHECK(res, enc_idx);
	len2 = this->enc_func( this, value, RSTRING_PTR(res), &intermediate, enc_idx );
	if( len < len2 ){
		rb_bug("%s: result length of first encoder run (%i) is less than second run (%i)",
			rb_obj_classname( self ), len, len2 );
	}
	rb_str_set_len( res, len2 );
	OBJ_INFECT(res, value);

	RB_GC_GUARD(intermediate);

	return res;
}
Example #12
0
/* :nodoc: */
static VALUE
name_err_mesg_to_str(VALUE obj, SEL sel)
{
    VALUE *ptr, mesg;
    Data_Get_Struct(obj, VALUE, ptr);

    mesg = ptr[0];
    if (NIL_P(mesg)) {
	return Qnil;
    }
    else {
	const char *desc = 0;
	VALUE d = 0, args[3];

	obj = ptr[1];
	switch (TYPE(obj)) {
	  case T_NIL:
	    desc = "nil";
	    break;
	  case T_TRUE:
	    desc = "true";
	    break;
	  case T_FALSE:
	    desc = "false";
	    break;
	  default:
	    d = rb_protect(safe_inspect, obj, NULL);
	    if (NIL_P(d) || RSTRING_LEN(d) > 65) {
		d = rb_any_to_s(obj);
	    }
	    desc = RSTRING_PTR(d);
	    break;
	}
	if (desc && desc[0] != '#') {
	    d = d ? rb_str_dup(d) : rb_str_new2(desc);
	    rb_str_cat2(d, ":");
	    rb_str_cat2(d, rb_obj_classname(obj));
	}
	args[0] = mesg;
	args[1] = ptr[2];
	args[2] = d;
	mesg = rb_f_sprintf(3, args);
    }
    if (OBJ_TAINTED(obj)) {
	OBJ_TAINT(mesg);
    }
    return mesg;
}
Example #13
0
static struct generator *
generator_ptr(VALUE obj)
{
    struct generator *ptr;

    Data_Get_Struct(obj, struct generator, ptr);
    if (RDATA(obj)->dmark != generator_mark) {
        rb_raise(rb_eTypeError,
                 "wrong argument type %s (expected %s)",
                 rb_obj_classname(obj), rb_class2name(rb_cGenerator));
    }
    if (!ptr || ptr->proc == Qundef) {
        rb_raise(rb_eArgError, "uninitialized generator");
    }
    return ptr;
}
Example #14
0
static VALUE
rhash_set_default_proc(VALUE hash, SEL sel, VALUE proc)
{
    rhash_modify(hash);
    VALUE tmp = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
    if (NIL_P(tmp)) {
        rb_raise(rb_eTypeError,
		"wrong default_proc type %s (expected Proc)",
		rb_obj_classname(proc));
    }
    proc = tmp;
    default_proc_arity_check(proc);
    GC_WB(&RHASH(hash)->ifnone, proc);
    RHASH(hash)->has_proc_default = true;
    return proc;
}
Example #15
0
VALUE
subextSubletInit(VALUE self,
  VALUE name)
{
  if(T_STRING != rb_type(name))
    rb_raise(rb_eArgError, "Unexpected value-type `%s'",
      rb_obj_classname(name));

  /* Init object */
  rb_iv_set(self, "@id",   Qnil);
  rb_iv_set(self, "@name", name);

  subextSubtlextConnect(NULL); ///< Implicit open connection

  return self;
} /* }}} */
Example #16
0
int VALUE2bool (VALUE v,const char *msg) {
  if (v==Qtrue)
	return 1;
  if (v==Qfalse)
	return 0;
  char total_msg[250];
  if (TYPE(v)!= T_ICLASS) {
	sprintf(total_msg,"%s (%x)",msg,TYPE(v));
  } else {
	sprintf(total_msg,"%s (%s)",msg,rb_obj_classname(v));

  }
  
  rb_raise(rb_amq_error,total_msg);
  return 0;
}
Example #17
0
static VALUE
eval_string_with_should_push_outer(VALUE self, VALUE klass, VALUE src,
	VALUE scope, const char *file, const int line,
	bool should_push_outer)
{
    rb_vm_binding_t *binding = NULL;
    if (scope != Qnil) {
	if (!rb_obj_is_kind_of(scope, rb_cBinding)) {
	    rb_raise(rb_eTypeError, "wrong argument type %s (expected Binding)",
		     rb_obj_classname(scope));
	}
	binding = GetBindingPtr(scope);
    }
    return rb_vm_eval_string(self, klass, src, binding, file, line,
	    should_push_outer);
}
static struct enumerator *
enumerator_ptr(VALUE obj)
{
    struct enumerator *ptr;

    Data_Get_Struct(obj, struct enumerator, ptr);
    if (RDATA(obj)->dmark != enumerator_mark) {
	rb_raise(rb_eTypeError,
		 "wrong argument type %s (expected Enumerable::Enumerator)",
		 rb_obj_classname(obj));
    }
    if (!ptr) {
	rb_raise(rb_eArgError, "uninitialized enumerator");
    }
    return ptr;
}
Example #19
0
File: graph.c Project: ged/redleaf
/*
 * Allocation function
 */
static rleaf_GRAPH *
rleaf_graph_alloc( VALUE storeobj ) {
	rleaf_GRAPH *ptr = ALLOC( rleaf_GRAPH );
	rleaf_STORE *store = rleaf_get_store( storeobj );

	/* :TODO: Figure out what the options argument of librdf_new_model does and support it. */
	if ( !store->storage )
		rb_raise( rb_eArgError, "Ack! Tried to create a graph with an uninitialized %s",
		          rb_obj_classname(storeobj) );

	ptr->store = storeobj;
	ptr->model = librdf_new_model( rleaf_rdf_world, store->storage, NULL );

	rleaf_log( "debug", "initialized a rleaf_GRAPH <%p>", ptr );
	return ptr;
}
static t_pg_coder *
pg_tmir_query_param( t_typemap *p_typemap, VALUE param_value, int field )
{
	t_tmir *this = (t_tmir *) p_typemap;

	VALUE coder = rb_funcall( this->self, s_id_typecast_query_param, 2, param_value, INT2NUM(field) );

	if ( NIL_P(coder) ){
		return NULL;
	} else if( rb_obj_is_kind_of(coder, rb_cPG_Coder) ) {
		return DATA_PTR(coder);
	} else {
		rb_raise( rb_eTypeError, "wrong return type from typecast_query_param: %s expected nil or kind of PG::Coder",
				rb_obj_classname( coder ) );
	}
}
Example #21
0
static VALUE parse_date(VALUE r_value) {
  int year, month, day;

  if (rb_obj_class(r_value) == rb_cDate) {
    return r_value;
  } else if (rb_obj_class(r_value) == rb_cTime ||
             rb_obj_class(r_value) == rb_cDateTime) {
    year = NUM2INT(rb_funcall(r_value, rb_intern("year"), 0));
    month = NUM2INT(rb_funcall(r_value, rb_intern("month"), 0));
    day = NUM2INT(rb_funcall(r_value, rb_intern("day"), 0));
    return rb_funcall(rb_cDate, DO_ID_NEW, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
  } else {
    // Something went terribly wrong
    rb_raise(eDO_DataError, "Couldn't parse date from class %s object", rb_obj_classname(r_value));
  }
}
Example #22
0
static VALUE
inst_put_sarray(VALUE self, VALUE arg, const char *field)
{
  struct ngraph_instance *inst;
  ngraph_value ary;
  int num, i;
  VALUE str, tmpstr;

  inst = check_id(self);
  if (inst == NULL) {
    return Qnil;
  }

  if (NIL_P(arg)) {
    num = 0;
  } else {
    if (!RB_TYPE_P(arg, T_ARRAY)) {
      rb_raise(rb_eArgError, "%s#%s: the argument must be an Array", rb_obj_classname(self), field);
    }

    num = RARRAY_LEN(arg);
  }

  ary.ary = NULL;
  if (num > 0) {
    ary.ary =  rb_alloc_tmp_buffer(&tmpstr, sizeof(*ary.ary) + sizeof(ngraph_value) * num);
    ary.ary->num = num;
    if (ary.ary) {
      for (i = 0; i < num; i++) {
        str = rb_ary_entry(arg, i);
        ary.ary->ary[i].str = StringValueCStr(str);
      }
    }
  }

  inst->rcode = ngraph_object_put(inst->obj, field, inst->id, &ary);

  if (ary.ary) {
    rb_free_tmp_buffer(&tmpstr);
  }

  if (inst->rcode < 0) {
    return Qnil;
  }

  return arg;
}
Example #23
0
File: Struct.c Project: mjaric/ffi
/*
 * call-seq: layout= layout
 * @param [StructLayout] layout
 * @return [self]
 * Set the Struct's layout.
 */
static VALUE
struct_set_layout(VALUE self, VALUE layout)
{
    Struct* s;
    Data_Get_Struct(self, Struct, s);

    if (!rb_obj_is_kind_of(layout, rbffi_StructLayoutClass)) {
        rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
                rb_obj_classname(layout), rb_class2name(rbffi_StructLayoutClass));
        return Qnil;
    }

    Data_Get_Struct(layout, StructLayout, s->layout);
    rb_ivar_set(self, id_layout_ivar, layout);

    return self;
}
Example #24
0
/*
 * Returns a string containing a human-readable representation of the
 * Timer.
 *
 * @since 1.2.0.dp6
 *
 * @return [String]
 */
    VALUE
cb_timer_inspect(VALUE self)
{
    VALUE str;
    struct timer_st *tm = DATA_PTR(self);
    char buf[200];

    str = rb_str_buf_new2("#<");
    rb_str_buf_cat2(str, rb_obj_classname(self));
    snprintf(buf, 20, ":%p", (void *)self);
    rb_str_buf_cat2(str, buf);
    snprintf(buf, 100, " timeout:%u periodic:%s>",
            tm->usec, tm->periodic ? "true" : "false");
    rb_str_buf_cat2(str, buf);

    return str;
}
Example #25
0
VALUE
rb_define_module_under(VALUE outer, const char *name)
{
    ID id = rb_intern(name);
    if (rb_const_defined_at(outer, id)) {
	VALUE module = rb_const_get_at(outer, id);
	if (TYPE(module) == T_MODULE) {
	    return module;
	}
	rb_raise(rb_eTypeError, "%s::%s:%s is not a module",
		 rb_class2name(outer), name, rb_obj_classname(module));
    }
    VALUE module = rb_define_module_id(id);
    rb_const_set(outer, id, module);
    rb_set_class_path(module, outer, name);
    return module;
}
Example #26
0
static VALUE
rescue_callback(VALUE arg)
{

    VALUE error;
    VALUE e = rb_errinfo();
    VALUE bt = rb_funcall(e, rb_intern("backtrace"), 0);
    VALUE msg = rb_funcall(e, rb_intern("message"), 0);
    bt = rb_ary_entry(bt, 0);
    error = rb_sprintf("%"PRIsVALUE": %"PRIsVALUE" (%s)\n", bt, msg, rb_obj_classname(e));
    rb_write_error(StringValuePtr(error));
    rb_backtrace();
    ruby_finalize();
    exit(-1);

    return Qnil;
}
Example #27
0
/*
 * call-seq:
 *    coder.elements_type = coder
 *
 * Specifies the PG::Coder object that is used to encode or decode
 * the single elementes of this composite type.
 *
 * If set to +nil+ all values are encoded and decoded as String objects.
 */
static VALUE
pg_coder_elements_type_set(VALUE self, VALUE elem_type)
{
	t_pg_composite_coder *this = DATA_PTR( self );

	if ( NIL_P(elem_type) ){
		this->elem = NULL;
	} else if ( rb_obj_is_kind_of(elem_type, rb_cPG_Coder) ){
		this->elem = DATA_PTR( elem_type );
	} else {
		rb_raise( rb_eTypeError, "wrong elements type %s (expected some kind of PG::Coder)",
				rb_obj_classname( elem_type ) );
	}

	rb_iv_set( self, "@elements_type", elem_type );
	return elem_type;
}
Example #28
0
/*
 * Returns a string containing a human-readable representation of the
 * CouchRequest.
 *
 * @since 1.2.0
 *
 * @return [String]
 */
VALUE
cb_http_request_inspect(VALUE self)
{
    VALUE str;
    struct cb_http_request_st *req = DATA_PTR(self);
    char buf[200];

    str = rb_str_buf_new2("#<");
    rb_str_buf_cat2(str, rb_obj_classname(self));
    snprintf(buf, 20, ":%p \"", (void *)self);
    rb_str_buf_cat2(str, buf);
    rb_str_buf_cat2(str, req->cmd.v.v0.path);
    snprintf(buf, 100, "\" chunked:%s>", req->cmd.v.v0.chunked ? "true" : "false");
    rb_str_buf_cat2(str, buf);

    return str;
}
Example #29
0
File: icon.c Project: guns/subtle
VALUE
subIconOperatorMult(VALUE self,
  VALUE value)
{
  VALUE ret = Qnil;

  /* Check id and name */
  if(FIXNUM_P(value))
    {
      /* Passthru to string class */
      ret = rb_funcall(subIconToString(self), rb_intern("*"), 1, value);
    }
  else rb_raise(rb_eArgError, "Unexpected value-type `%s'",
    rb_obj_classname(value));

  return ret;
} /* }}} */
Example #30
0
static VALUE
method_inspect(VALUE method)
{
    struct METHOD *data;
    VALUE str;
    const char *s;
    char *sharp = "#";

    Data_Get_Struct(method, struct METHOD, data);
    str = rb_str_buf_new2("#<");
    s = rb_obj_classname(method);
    rb_str_buf_cat2(str, s);
    rb_str_buf_cat2(str, ": ");

    if (FL_TEST(data->klass, FL_SINGLETON)) {
	VALUE v = rb_iv_get(data->klass, "__attached__");

	if (data->recv == Qundef) {
	    rb_str_buf_append(str, rb_inspect(data->klass));
	}
	else if (data->recv == v) {
	    rb_str_buf_append(str, rb_inspect(v));
	    sharp = ".";
	}
	else {
	    rb_str_buf_append(str, rb_inspect(data->recv));
	    rb_str_buf_cat2(str, "(");
	    rb_str_buf_append(str, rb_inspect(v));
	    rb_str_buf_cat2(str, ")");
	    sharp = ".";
	}
    }
    else {
	rb_str_buf_cat2(str, rb_class2name(data->rklass));
	if (data->rklass != data->klass) {
	    rb_str_buf_cat2(str, "(");
	    rb_str_buf_cat2(str, rb_class2name(data->klass));
	    rb_str_buf_cat2(str, ")");
	}
    }
    rb_str_buf_cat2(str, sharp);
    rb_str_buf_cat2(str, rb_id2name(data->oid));
    rb_str_buf_cat2(str, ">");

    return str;
}