Class: Sollya::Object

Inherits:
Object
  • Object
show all
Defined in:
ext/sollya_rb.c

Instance Method Summary collapse

Instance Method Details

#!=(other) ⇒ Object



2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
# File 'ext/sollya_rb.c', line 2805

static VALUE sollyarb_object_cmp_not_equal(VALUE self, VALUE other)
{
	sollya_obj_t y = SOLLYARB_TO_SOLLYA(other);
	sollya_obj_t x = sollyarb_object_rb2ref(self);
	sollya_obj_t r = sollya_lib_cmp_not_equal(x, y);
	VALUE b;
	if (sollya_lib_is_true(r)) {
		b = Qtrue;
	} else if (sollya_lib_is_false(r)) {
		b = Qfalse;
	} else {
		b = Qnil;
	}
	sollya_lib_clear_obj(r);
	return b;
}

#&(other) ⇒ Object



2169
2170
2171
2172
# File 'ext/sollya_rb.c', line 2169

static VALUE sollyarb_object_and(VALUE self, VALUE other)
{
	return sollyarb_autowrap_object(sollya_lib_and(sollyarb_object_rb2ref(self), SOLLYARB_TO_SOLLYA(other)));
}

#==(other) ⇒ Object



2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
# File 'ext/sollya_rb.c', line 2787

static VALUE sollyarb_object_cmp_equal(VALUE self, VALUE other)
{
	sollya_obj_t y = SOLLYARB_TO_SOLLYA(other);
	sollya_obj_t x = sollyarb_object_rb2ref(self);
	sollya_obj_t r = sollya_lib_cmp_equal(x, y);
	VALUE b;
	if (sollya_lib_is_true(r)) {
		b = Qtrue;
	} else if (sollya_lib_is_false(r)) {
		b = Qfalse;
	} else {
		b = Qnil;
	}
	sollya_lib_clear_obj(r);
	return b;
}

#concat(other) ⇒ Object



2245
2246
2247
2248
# File 'ext/sollya_rb.c', line 2245

static VALUE sollyarb_object_concat(VALUE self, VALUE other)
{
	return sollyarb_autowrap_object(sollya_lib_concat(sollyarb_object_rb2ref(self), SOLLYARB_TO_SOLLYA(other)));
}

#inspectObject



596
597
598
599
# File 'ext/sollya_rb.c', line 596

static VALUE sollyarb_object_inspect(VALUE self)
{
	return rb_sprintf("#<%s %" PRIsVALUE ">", rb_obj_classname(self), rb_funcallv(self, id_to_s, 0, NULL));
}


220
221
222
223
224
225
# File 'ext/sollya_rb.c', line 220

static VALUE sollyarb_object_print(VALUE self)
{
	sollya_obj_t sol = sollyarb_object_rb2ref(self);
	sollya_lib_autoprint(sol, NULL);
	return Qnil;
}

#to_sObject



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'ext/sollya_rb.c', line 228

static VALUE sollyarb_object_to_s(VALUE self)
{
	char buf[64];
	sollya_obj_t sol = sollyarb_object_rb2ref(self);
	int s = sollya_lib_snprintf(buf, sizeof(buf), "%b", sol);
	if (s < (int)sizeof(buf)) {
		return rb_str_new(buf, s);
	}
	char *strp = malloc(s+1);
	if (!strp) return Qnil;
	s = sollya_lib_snprintf(strp, s+1, "%b", sol);
	VALUE rbstr = rb_str_new(strp, s);
	free(strp);
	return rbstr;
}

#to_sollyaObject



245
246
247
248
# File 'ext/sollya_rb.c', line 245

static VALUE sollyarb_object_to_sollya(VALUE self)
{
	return self;
}

#|(other) ⇒ Object



2175
2176
2177
2178
# File 'ext/sollya_rb.c', line 2175

static VALUE sollyarb_object_or(VALUE self, VALUE other)
{
	return sollyarb_autowrap_object(sollya_lib_or(sollyarb_object_rb2ref(self), SOLLYARB_TO_SOLLYA(other)));
}

#~Object



2181
2182
2183
2184
# File 'ext/sollya_rb.c', line 2181

static VALUE sollyarb_object_negate(VALUE self)
{
	return sollyarb_autowrap_object(sollya_lib_negate(sollyarb_object_rb2ref(self)));
}