translate (@scroll_x, @scroll_y) { return }
rb_ensure(rb_yield, Qnil, hypotheticalPopTransformWrapperThatAcceptsAnInstanceOfGraphics, (VALUE)&($self->graphics() ) );
rb_ensure(…)
nonsense is that I posted below the problem code. I guess I forgot to change the topic after I peeked at Gosu's source. :DVALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
VALUE
rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE data2)
{
int state;
volatile VALUE result = Qnil;
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*b_proc) (data1);
}
POP_TAG();
/* TODO: fix me */
/* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
(*e_proc) (data2);
if (state)
JUMP_TAG(state);
return result;
}
def rb_ensure b_proc, data1, e_proc, data2
result = nil
begin
result = b_proc.call data1
ensure
e_proc.call data2
end
return result
end
# Recursively tests whether +point+ falls within one of the container's
# subviews. Returns the first subview that tested positively, +self+ if
# no subviews contain the point, or +nil+ if the container does not
# contain the point.
def point_query point
if frame.include? point
# query each subview and return the first non-nil result
point -= frame.offset
@subviews.each do |subview|
found_view = subview.point_query point
return found_view if found_view
end
# fall back on self if no subview contains the point
self
else
nil
end
end
@subviews
and the method would eventually return self. If I wanted to return the result of the subview's point_query
, I'd have to write something significantly nastier using a catch/throw or something. I'm sure if it worked that way I'd figure something out.Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill