Class: Debase::Breakpoint

Inherits:
Object show all
Defined in:
lib/debase/rbx/breakpoint.rb,
ext/breakpoint.c

Constant Summary collapse

@@global_id =
1

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, pos, expr) ⇒ Breakpoint

Returns a new instance of Breakpoint.



59
60
61
62
63
64
65
# File 'ext/breakpoint.c', line 59

def initialize(file, line, expr=nil)
  @source = file
  @pos = line
  @expr = expr
  @id = @@global_id
  @@global_id = @@global_id + 1
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



99
100
101
# File 'ext/breakpoint.c', line 99

def id
  @id
end

#posObject

Returns the value of attribute pos.



117
118
119
# File 'ext/breakpoint.c', line 117

def pos
  @pos
end

#sourceObject

Returns the value of attribute source.



108
109
110
# File 'ext/breakpoint.c', line 108

def source
  @source
end

Class Method Details

.find(breakpoints, source, pos) ⇒ Object



194
195
196
197
198
# File 'ext/breakpoint.c', line 194

static VALUE
Breakpoint_find(VALUE self, VALUE breakpoints, VALUE source, VALUE pos)
{
  return breakpoint_find(breakpoints, source, pos);
}

.remove(breakpoints, id_value) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'ext/breakpoint.c', line 74

static VALUE
Breakpoint_remove(VALUE self, VALUE breakpoints, VALUE id_value)
{
  int i;
  int id;
  VALUE breakpoint_object;
  breakpoint_t *breakpoint;

  if (breakpoints == Qnil) return Qnil;

  id = FIX2INT(id_value);

  for(i = 0; i < RARRAY_LEN(breakpoints); i++)
  {
    breakpoint_object = rb_ary_entry(breakpoints, i);
    Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
    if(breakpoint->id == id)
    {
      rb_ary_delete_at(breakpoints, i);
      return breakpoint_object;
    }
  }
  return Qnil;
}