mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/win32ole/win32ole.c (ole_invoke): call rb_hash_foreach instead
of rb_block_call. * ext/win32ole/win32ole.c: add comment for rdoc of WIN32OLE_VARIANT class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4938045735
commit
8c3fb4929a
2 changed files with 34 additions and 12 deletions
|
@ -1,3 +1,11 @@
|
|||
2014$BG/(B08$B7n(B04$BF|(B 19$B;~(B44$BJ,(B36$BIC(B Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* ext/win32ole/win32ole.c (ole_invoke): call rb_hash_foreach instead
|
||||
of rb_block_call.
|
||||
|
||||
* ext/win32ole/win32ole.c: add comment for rdoc of WIN32OLE_VARIANT
|
||||
class.
|
||||
|
||||
Mon Aug 4 09:12:47 2014 Eric Wong <e@80x24.org>
|
||||
|
||||
* variable.c: cleanup to use rb_const_lookup
|
||||
|
|
|
@ -63,7 +63,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
|
|||
|
||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||
|
||||
#define WIN32OLE_VERSION "1.7.1"
|
||||
#define WIN32OLE_VERSION "1.7.2"
|
||||
|
||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||
|
@ -309,7 +309,7 @@ static VALUE fole_s_create_guid(VALUE self);
|
|||
static VALUE fole_s_ole_initialize(VALUE self);
|
||||
static VALUE fole_s_ole_uninitialize(VALUE self);
|
||||
static VALUE fole_initialize(int argc, VALUE *argv, VALUE self);
|
||||
static VALUE hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIST(pair, op));
|
||||
static int hash2named_arg(VALUE key, VALUE val, VALUE pop);
|
||||
static VALUE set_argv(VARIANTARG* realargs, unsigned int beg, unsigned int end);
|
||||
static VALUE ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket);
|
||||
static VALUE fole_invoke(int argc, VALUE *argv, VALUE self);
|
||||
|
@ -3334,18 +3334,15 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIST(pair, op))
|
||||
static int
|
||||
hash2named_arg(VALUE key, VALUE val, VALUE pop)
|
||||
{
|
||||
struct oleparam* pOp = (struct oleparam *)op;
|
||||
struct oleparam* pOp = (struct oleparam *)pop;
|
||||
unsigned int index, i;
|
||||
VALUE key, value;
|
||||
index = pOp->dp.cNamedArgs;
|
||||
|
||||
/*---------------------------------------------
|
||||
the data-type of key must be String or Symbol
|
||||
-----------------------------------------------*/
|
||||
key = rb_ary_entry(pair, 0);
|
||||
if(!RB_TYPE_P(key, T_STRING) && !RB_TYPE_P(key, T_SYMBOL)) {
|
||||
/* clear name of dispatch parameters */
|
||||
for(i = 1; i < index + 1; i++) {
|
||||
|
@ -3365,12 +3362,11 @@ hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIST(pair, op))
|
|||
/* pNamedArgs[0] is <method name>, so "index + 1" */
|
||||
pOp->pNamedArgs[index + 1] = ole_vstr2wc(key);
|
||||
|
||||
value = rb_ary_entry(pair, 1);
|
||||
VariantInit(&(pOp->dp.rgvarg[index]));
|
||||
ole_val2variant(value, &(pOp->dp.rgvarg[index]));
|
||||
ole_val2variant(val, &(pOp->dp.rgvarg[index]));
|
||||
|
||||
pOp->dp.cNamedArgs += 1;
|
||||
return Qnil;
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -3464,7 +3460,8 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|||
op.dp.cArgs = cNamedArgs + argc - 2;
|
||||
op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
|
||||
op.dp.rgvarg = ALLOCA_N(VARIANTARG, op.dp.cArgs);
|
||||
rb_block_call(param, rb_intern("each"), 0, 0, hash2named_arg, (VALUE)&op);
|
||||
|
||||
rb_hash_foreach(param, hash2named_arg, (VALUE)&op);
|
||||
|
||||
pDispID = ALLOCA_N(DISPID, cNamedArgs + 1);
|
||||
op.pNamedArgs[0] = ole_vstr2wc(cmd);
|
||||
|
@ -8833,6 +8830,23 @@ check_type_val2variant(VALUE val)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: WIN32OLE_VARIANT
|
||||
*
|
||||
* <code>WIN32OLE_VARIANT</code> objects represents OLE variant.
|
||||
*
|
||||
* Win32OLE converts Ruby object into OLE variant automatically when
|
||||
* invoking OLE methods. If OLE method requires the argument which is
|
||||
* different from the variant by automatic conversion of Win32OLE, you
|
||||
* can convert the specfied variant type by using WIN32OLE_VARIANT class.
|
||||
*
|
||||
* param = WIN32OLE_VARIANT.new(10, WIN32OLE::VARIANT::VT_R4)
|
||||
* oleobj.method(param)
|
||||
*
|
||||
* WIN32OLE_VARIANT does not support VT_RECORD variant. Use WIN32OLE_RECORD
|
||||
* class instead of WIN32OLE_VARIANT if the VT_RECORD variant is needed.
|
||||
*/
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object.
|
||||
|
|
Loading…
Add table
Reference in a new issue