Class: Bug::TypedData

Inherits:
Object show all
Defined in:
ext/-test-/typeddata/typeddata.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check(obj) ⇒ Object



17
18
19
20
21
22
# File 'ext/-test-/typeddata/typeddata.c', line 17

static VALUE
test_check(VALUE self, VALUE obj)
{
    rb_check_typeddata(obj, &test_data);
    return obj;
}

.encoding_index(str) ⇒ Object



10
11
12
13
14
15
# File 'ext/-test-/string/enc_associate.c', line 10

VALUE
bug_str_encoding_index(VALUE self, VALUE str)
{
    int idx = rb_enc_get_index(str);
    return INT2NUM(idx);
}

.make(num) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'ext/-test-/typeddata/typeddata.c', line 24

static VALUE
test_make(VALUE klass, VALUE num)
{
    unsigned long i, n = NUM2UINT(num);

    for (i = 0; i < n; i++) {
        test_alloc(klass);
    }

    return Qnil;
}

.parse_depth_limitObject



4
5
6
7
8
9
# File 'ext/-test-/regexp/parse_depth_limit.c', line 4

static VALUE
get_parse_depth_limit(VALUE self)
{
    unsigned int depth = onig_get_parse_depth_limit();
    return UINT2NUM(depth);
}

.parse_depth_limit=(depth) ⇒ Object



11
12
13
14
15
16
# File 'ext/-test-/regexp/parse_depth_limit.c', line 11

static VALUE
set_parse_depth_limit(VALUE self, VALUE depth)
{
    onig_set_parse_depth_limit(NUM2UINT(depth));
    return depth;
}

.profile_frames(start_v, num_v) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'ext/-test-/debug/profile_frames.c', line 6

static VALUE
profile_frames(VALUE self, VALUE start_v, VALUE num_v)
{
    int i, collected_size;
    int start = NUM2INT(start_v);
    int buff_size = NUM2INT(num_v);
    VALUE buff[MAX_BUF_SIZE];
    int lines[MAX_BUF_SIZE];
    VALUE result = rb_ary_new();

    if (buff_size > MAX_BUF_SIZE) rb_raise(rb_eRuntimeError, "too long buff_size");

    collected_size = rb_profile_frames(start, buff_size, buff, lines);

    for (i=0; i<collected_size; i++) {
        VALUE ary = rb_ary_new();
        rb_ary_push(ary, rb_profile_frame_path(buff[i]));
        rb_ary_push(ary, rb_profile_frame_absolute_path(buff[i]));
        rb_ary_push(ary, rb_profile_frame_label(buff[i]));
        rb_ary_push(ary, rb_profile_frame_base_label(buff[i]));
        rb_ary_push(ary, rb_profile_frame_full_label(buff[i]));
        rb_ary_push(ary, rb_profile_frame_first_lineno(buff[i]));
        rb_ary_push(ary, rb_profile_frame_classpath(buff[i]));
        rb_ary_push(ary, rb_profile_frame_singleton_method_p(buff[i]));
        rb_ary_push(ary, rb_profile_frame_method_name(buff[i]));
        rb_ary_push(ary, rb_profile_frame_qualified_method_name(buff[i]));
        rb_ary_push(ary, INT2NUM(lines[i]));

        rb_ary_push(result, ary);
    }

    return result;
}

.profile_thread_frames(thread, start_v, num_v) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'ext/-test-/debug/profile_frames.c', line 40

static VALUE
profile_thread_frames(VALUE self, VALUE thread, VALUE start_v, VALUE num_v)
{
    int i, collected_size;
    int start = NUM2INT(start_v);
    int buff_size = NUM2INT(num_v);
    VALUE buff[MAX_BUF_SIZE];
    int lines[MAX_BUF_SIZE];
    VALUE result = rb_ary_new();

    if (buff_size > MAX_BUF_SIZE) rb_raise(rb_eRuntimeError, "too long buff_size");

    collected_size = rb_profile_thread_frames(thread, start, buff_size, buff, lines);
    for (i=0; i<collected_size; i++) {
        rb_ary_push(result, rb_profile_frame_full_label(buff[i]));
    }

    return result;
}

.rb_interned_str_dup(str) ⇒ Object



3
4
5
6
7
8
# File 'ext/-test-/string/rb_interned_str.c', line 3

static VALUE
bug_rb_interned_str_dup(VALUE self, VALUE str)
{
    Check_Type(str, T_STRING);
    return rb_interned_str(RSTRING_PTR(str), RSTRING_LEN(str));
}

Instance Method Details

#associate_encoding!(enc) ⇒ Object



4
5
6
7
8
# File 'ext/-test-/string/enc_associate.c', line 4

VALUE
bug_str_enc_associate(VALUE str, VALUE enc)
{
    return rb_enc_associate(str, rb_to_encoding(enc));
}

#enc_str_buf_cat(str2) ⇒ Object



4
5
6
7
8
# File 'ext/-test-/string/enc_str_buf_cat.c', line 4

static VALUE
enc_str_buf_cat(VALUE str, VALUE str2)
{
    return rb_enc_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2), rb_enc_get(str2));
}

#str_conv_enc_opts(from, to, ecflags, ecopts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'ext/-test-/string/enc_str_buf_cat.c', line 10

static VALUE
str_conv_enc_opts(VALUE str, VALUE from, VALUE to, VALUE ecflags, VALUE ecopts)
{
    rb_encoding *from_enc = NIL_P(from) ? NULL : rb_to_encoding(from);
    rb_encoding *to_enc = NIL_P(to) ? NULL : rb_to_encoding(to);
    int flags = NUM2INT(ecflags);
    if (!NIL_P(ecopts)) {
        Check_Type(ecopts, T_HASH);
        OBJ_FREEZE(ecopts);
    }
    return rb_str_conv_enc_opts(str, from_enc, to_enc, flags, ecopts);
}