Skip to content

Commit

Permalink
* ext/win32ole/win32ole.c (ole_invoke, add_event_callback,
Browse files Browse the repository at this point in the history
  rescue_callback): refactoring.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
suke committed Jul 25, 2008
1 parent 87f80a7 commit 148d575
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Fri Jul 25 21:09:32 2008 Masaki Suketa <[email protected]>

* ext/win32ole/win32ole.c (ole_invoke, add_event_callback,
rescue_callback): refactoring.

Fri Jul 25 20:52:44 2008 Masaki Suketa <[email protected]>

* test/win32ole/err_in_callback.rb : add test of raising
Expand Down
13 changes: 4 additions & 9 deletions ext/win32ole/win32ole.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

#define WC2VSTR(x) ole_wc2vstr((x), TRUE)

#define WIN32OLE_VERSION "1.2.8"
#define WIN32OLE_VERSION "1.2.9"

typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
Expand Down Expand Up @@ -3229,7 +3229,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
if (is_bracket) {
DispID = DISPID_VALUE;
argc += 1;
rb_funcall(paramS, rb_intern("unshift"), 1, cmd);
rb_ary_unshift(paramS, cmd);
} else {
wcmdname = ole_vstr2wc(cmd);
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
Expand Down Expand Up @@ -7511,12 +7511,10 @@ rescue_callback(VALUE arg)
{

VALUE e = rb_errinfo();
VALUE c = rb_funcall(e, rb_intern("class"), 0);
VALUE bt = rb_funcall(e, rb_intern("backtrace"), 0);
VALUE msg = rb_funcall(e, rb_intern("message"), 0);
c = rb_funcall(c, rb_intern("to_s"), 0);
bt = rb_ary_entry(bt, 0);
fprintf(stdout, "%s: %s (%s)\n", StringValuePtr(bt), StringValuePtr(msg), StringValuePtr(c));
fprintf(stdout, "%s: %s (%s)\n", StringValuePtr(bt), StringValuePtr(msg), rb_obj_classname(e));
rb_backtrace();
ruby_finalize();
exit(-1);
Expand Down Expand Up @@ -8097,10 +8095,7 @@ add_event_call_back(VALUE obj, VALUE event, VALUE data)
events = rb_ary_new();
rb_ivar_set(obj, id_events, events);
}
at = ole_search_event_at(events, event);
if (at >= 0) {
rb_ary_delete_at(events, at);
}
ole_delete_event(events, event);
rb_ary_push(events, data);
}

Expand Down

0 comments on commit 148d575

Please sign in to comment.