Esempio n. 1
0
static void
sax_drive_init(SaxDrive dr, VALUE handler, VALUE io, SaxOptions options) {
    ox_sax_buf_init(&dr->buf, io);
    dr->buf.dr = dr;
    stack_init(&dr->stack);
    dr->handler = handler;
    dr->value_obj = rb_data_object_alloc(ox_sax_value_class, dr, 0, 0);
    rb_gc_register_address(&dr->value_obj);
    dr->options = *options;
    dr->hints = 0;
    dr->err = 0;
    has_init(&dr->has, handler);
#if HAS_ENCODING_SUPPORT
    if ('\0' == *ox_default_options.encoding) {
	VALUE	encoding;

	dr->encoding = 0;
	if (rb_respond_to(io, ox_external_encoding_id) && Qnil != (encoding = rb_funcall(io, ox_external_encoding_id, 0))) {
	    int	e = rb_enc_get_index(encoding);
	    if (0 <= e) {
		dr->encoding = rb_enc_from_index(e);
	    }
	}
    } else {
        dr->encoding = rb_enc_find(ox_default_options.encoding);
    }
#elif HAS_PRIVATE_ENCODING
    if ('\0' == *ox_default_options.encoding) {
	VALUE	encoding;

	if (rb_respond_to(io, ox_external_encoding_id) && Qnil != (encoding = rb_funcall(io, ox_external_encoding_id, 0))) {
	    dr->encoding = encoding;
	} else {
	    dr->encoding = Qnil;
	}
    } else {
        dr->encoding = rb_str_new2(ox_default_options.encoding);
    }
#else
    dr->encoding = 0;
#endif
}
VALUE atomic_fixnum_allocate(VALUE klass) {
  return rb_data_object_alloc(klass, (void *) Qnil, atomic_fixnum_mark, NULL);
}
VALUE atomic_boolean_allocate(VALUE klass) {
  return rb_data_object_alloc(klass, (void *) Qfalse, atomic_boolean_mark, NULL);
}
Esempio n. 4
0
static VALUE Target_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Target_mark, Target_free);
}
Esempio n. 5
0
static VALUE Parameter_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Parameter_mark, Parameter_free);
}
Esempio n. 6
0
static VALUE Node_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Node_mark, Node_free);
}
Esempio n. 7
0
static VALUE Buffer_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Buffer_mark, Buffer_free);
}
Esempio n. 8
0
static VALUE Scalar_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Reference_mark, Reference_free);
}
Esempio n. 9
0
static VALUE Kernel_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Kernel_mark, Kernel_free);
}
Esempio n. 10
0
static VALUE Graph_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, NULL, Graph_mark, Graph_free);
}
Esempio n. 11
0
static VALUE Reference_allocate(VALUE klass)
{
    return rb_data_object_alloc(klass, (void *)NULL, Reference_mark, Reference_free);
}
Esempio n. 12
0
static VALUE socket_alloc (VALUE class_)
{
    return rb_data_object_alloc (class_, NULL, 0, socket_free);
}
Esempio n. 13
0
static VALUE context_alloc (VALUE class_)
{
    return rb_data_object_alloc (class_, NULL, 0, context_free);
}
Esempio n. 14
0
static VALUE ir_alloc(VALUE klass) {
    return rb_data_object_alloc(klass, (void *) Qnil, ir_mark, NULL);
}