[前][次][番号順一覧][スレッド一覧]

ruby-changes:35063

From: suke <ko1@a...>
Date: Tue, 12 Aug 2014 06:20:24 +0900 (JST)
Subject: [ruby-changes:35063] suke:r47145 (trunk): * ext/win32ole/win32ole.c: seperate WIN32OLE_METHOD src from

suke	2014-08-12 06:20:10 +0900 (Tue, 12 Aug 2014)

  New Revision: 47145

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47145

  Log:
    * ext/win32ole/win32ole.c: seperate WIN32OLE_METHOD src from
      win32ole.c.
    * ext/win32ole/win32ole.h: ditto.
    * ext/win32ole/win32ole_method.c: ditto.
    * ext/win32ole/win32ole_method.h: ditto.
    * ext/win32ole/depend: ditto.

  Added files:
    trunk/ext/win32ole/win32ole_method.c
    trunk/ext/win32ole/win32ole_method.h
  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/depend
    trunk/ext/win32ole/win32ole.c
    trunk/ext/win32ole/win32ole.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47144)
+++ ChangeLog	(revision 47145)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Aug 12 06:16:09 2014  Masaki Suketa <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c: seperate WIN32OLE_METHOD src from
+	  win32ole.c.
+	* ext/win32ole/win32ole.h: ditto.
+	* ext/win32ole/win32ole_method.c: ditto.
+	* ext/win32ole/win32ole_method.h: ditto.
+	* ext/win32ole/depend: ditto.
+
 Mon Aug 11 22:19:15 2014  Masaki Suketa <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole_variable.c (folevariable_inspect): refactoring.
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 47144)
+++ ext/win32ole/win32ole.c	(revision 47145)
@@ -26,10 +26,6 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L26
 const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
 #endif
 
-
-
-
-
 #define OLEData_Get_Struct(obj, pole) {\
     Data_Get_Struct(obj, struct oledata, pole);\
     if(!pole->pDispatch) {\
@@ -157,12 +153,6 @@ struct oledata { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L153
     IDispatch *pDispatch;
 };
 
-struct olemethoddata {
-    ITypeInfo *pOwnerTypeInfo;
-    ITypeInfo *pTypeInfo;
-    UINT index;
-};
-
 struct oleparamdata {
     ITypeInfo *pTypeInfo;
     UINT method_index;
@@ -212,7 +202,6 @@ static void ole_freeexceptinfo(EXCEPINFO https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L202
 static VALUE ole_excepinfo2msg(EXCEPINFO *pExInfo);
 static void ole_msg_loop(void);
 static void ole_free(struct oledata *pole);
-static void olemethod_free(struct olemethoddata *polemethod);
 static void oleparam_free(struct oleparamdata *pole);
 static LPWSTR ole_mb2wc(char *pm, int len);
 static VALUE ole_ary_m_entry(VALUE val, LONG *pid);
@@ -275,9 +264,6 @@ static VALUE ole_each_sub(VALUE pEnumV); https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L264
 static VALUE ole_ienum_free(VALUE pEnumV);
 static VALUE fole_each(VALUE self);
 static VALUE fole_missing(int argc, VALUE *argv, VALUE self);
-static VALUE ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name);
-static VALUE olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name);
-static VALUE ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask);
 static HRESULT typeinfo_from_ole(struct oledata *pole, ITypeInfo **ppti);
 static VALUE ole_methods(VALUE self, int mask);
 static VALUE fole_methods(VALUE self);
@@ -292,43 +278,7 @@ static VALUE ole_usertype2val(ITypeInfo https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L278
 static VALUE ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
 static VALUE fole_method_help(VALUE self, VALUE cmdname);
 static VALUE fole_activex_initialize(VALUE self);
-static VALUE olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name);
-static VALUE folemethod_s_allocate(VALUE klass);
-static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method);
-static VALUE folemethod_name(VALUE self);
-static VALUE ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_type(VALUE self);
-static VALUE ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_vtype(VALUE self);
-static VALUE ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_type_detail(VALUE self);
-static VALUE ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_invkind(VALUE self);
-static VALUE folemethod_invoke_kind(VALUE self);
-static VALUE ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_visible(VALUE self);
-static VALUE ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name);
-static VALUE folemethod_event(VALUE self);
-static VALUE folemethod_event_interface(VALUE self);
-static HRESULT ole_method_docinfo_from_type(ITypeInfo *pTypeInfo, UINT method_index, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
-static VALUE ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpstring(VALUE self);
-static VALUE ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpfile(VALUE self);
-static VALUE ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpcontext(VALUE self);
-static VALUE ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_dispid(VALUE self);
-static VALUE ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_offset_vtbl(VALUE self);
-static VALUE ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_size_params(VALUE self);
-static VALUE ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_size_opt_params(VALUE self);
-static VALUE ole_method_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_params(VALUE self);
-static VALUE folemethod_inspect(VALUE self);
+
 static VALUE foleparam_s_allocate(VALUE klass);
 static VALUE oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index);
 static VALUE oleparam_ole_param(VALUE self, VALUE olemethod, int n);
@@ -1036,14 +986,6 @@ ole_free(struct oledata *pole) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L986
 }
 
 static void
-olemethod_free(struct olemethoddata *polemethod)
-{
-    OLE_FREE(polemethod->pTypeInfo);
-    OLE_FREE(polemethod->pOwnerTypeInfo);
-    free(polemethod);
-}
-
-static void
 oleparam_free(struct oleparamdata *pole)
 {
     OLE_FREE(pole->pTypeInfo);
@@ -3812,112 +3754,6 @@ fole_missing(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3754
     }
 }
 
-static VALUE
-ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name)
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    BSTR bstr;
-    FUNCDESC *pFuncDesc;
-    WORD i;
-    VALUE fname;
-    VALUE method = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
-    }
-    for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
-        hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
-        if (FAILED(hr))
-             continue;
-
-        hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
-                                                 &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) {
-            pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-            continue;
-        }
-        fname = WC2VSTR(bstr);
-        if (strcasecmp(StringValuePtr(name), StringValuePtr(fname)) == 0) {
-            olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, i, fname);
-            method = self;
-        }
-        pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-        pFuncDesc=NULL;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return method;
-}
-
-static VALUE
-olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    WORD i;
-    HREFTYPE href;
-    ITypeInfo *pRefTypeInfo;
-    VALUE method = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
-    }
-    method = ole_method_sub(self, 0, pTypeInfo, name);
-    if (method != Qnil) {
-       return method;
-    }
-    for(i=0; i < pTypeAttr->cImplTypes && method == Qnil; i++){
-       hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
-       if(FAILED(hr))
-           continue;
-       hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
-       if (FAILED(hr))
-           continue;
-       method = ole_method_sub(self, pTypeInfo, pRefTypeInfo, name);
-       OLE_RELEASE(pRefTypeInfo);
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return method;
-}
-
-static VALUE
-ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask)
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    BSTR bstr;
-    FUNCDESC *pFuncDesc;
-    VALUE method;
-    WORD i;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
-    }
-    for(i = 0; i < pTypeAttr->cFuncs; i++) {
-        hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
-        if (FAILED(hr))
-             continue;
-
-        hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
-                                                 &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) {
-            pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-            continue;
-        }
-        if(pFuncDesc->invkind & mask) {
-            method = folemethod_s_allocate(cWIN32OLE_METHOD);
-            olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo,
-                                 i, WC2VSTR(bstr));
-            rb_ary_push(methods, method);
-        }
-        pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-        pFuncDesc=NULL;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-
-    return methods;
-}
-
 VALUE
 ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask)
 {
@@ -4457,8 +4293,10 @@ fole_method_help(VALUE self, VALUE cmdna https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4293
     hr = typeinfo_from_ole(pole, &pTypeInfo);
     if(FAILED(hr))
         ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
+
     method = folemethod_s_allocate(cWIN32OLE_METHOD);
     obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
+
     OLE_RELEASE(pTypeInfo);
     if (obj == Qnil)
         rb_raise(eWIN32OLERuntimeError, "not found %s",
@@ -4514,721 +4352,21 @@ fole_activex_initialize(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4352
     return Qnil;
 }
 
-/*
- * Document-class: WIN32OLE_METHOD
- *
- *   <code>WIN32OLE_METHOD</code> objects represent OLE method information.
- */
-
-static VALUE
-olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    pmethod->pTypeInfo = pTypeInfo;
-    OLE_ADDREF(pTypeInfo);
-    pmethod->pOwnerTypeInfo = pOwnerTypeInfo;
-    if(pOwnerTypeInfo) OLE_ADDREF(pOwnerTypeInfo);
-    pmethod->index = index;
-    rb_ivar_set(self, rb_intern("name"), name);
-    return self;
-}
-
-static VALUE
-folemethod_s_allocate(VALUE klass)
-{
-    struct olemethoddata *pmethod;
-    VALUE obj;
-    obj = Data_Make_Struct(klass,
-                           struct olemethoddata,
-                           0, olemethod_free, pmethod);
-    pmethod->pTypeInfo = NULL;
-    pmethod->pOwnerTypeInfo = NULL;
-    pmethod->index = 0;
-    return obj;
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD.new(ole_type,  method) -> WIN32OLE_METHOD object
- *
- *  Returns a new WIN32OLE_METHOD object which represents the information
- *  about OLE method.
- *  The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object.
- *  The second argument <i>method</i> specifies OLE method name defined OLE class
- *  which represents WIN32OLE_TYPE object.
- *
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- */
-static VALUE
-folemethod_initialize(VALUE self, VALUE oletype, VALUE method)
-{
-    VALUE obj = Qnil;
-    ITypeInfo *pTypeInfo;
-    if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
-        SafeStringValue(method);
-        pTypeInfo = itypeinfo(oletype);
-        obj = olemethod_from_typeinfo(self, pTypeInfo, method);
-        if (obj == Qnil) {
-            rb_raise(eWIN32OLERuntimeError, "not found %s",
-                     StringValuePtr(method));
-        }
-    }
-    else {
-        rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object");
-    }
-    return obj;
-}
-
-/*
- *  call-seq
- *     WIN32OLE_METHOD#name
- *
- *  Returns the name of the method.
- *
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- *     puts method.name # => SaveAs
- *
- */
-static VALUE
-folemethod_name(VALUE self)
-{
-    return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE type;
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
-
-    type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return type;
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD#return_type
- *
- *  Returns string of return value type of method.
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     puts method.return_type # => Workbook
- *
- */
-static VALUE
-folemethod_return_type(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_type(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE vvt;
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
-
-    vvt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return vvt;
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD#return_vtype
- *
- *  Returns number of return value type of method.
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     puts method.return_vtype # => 26
- *
- */
-static VALUE
-folemethod_return_vtype(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE type = rb_ary_new();
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return type;
-
-    ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), type);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return type;
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD#return_type_detail
- *
- *  Returns detail information of return value type of method.
- *  The information is array.
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]
- */
-static VALUE
-folemethod_return_type_detail(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE invkind;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if(FAILED(hr))
-        ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
-    invkind = INT2FIX(pFuncDesc->invkind);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return invkind;
-}
-
-static VALUE
-ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    VALUE type = rb_str_new2("UNKNOWN");
-    VALUE invkind = ole_method_invkind(pTypeInfo, method_index);
-    if((FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
-       (FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
-        type = rb_str_new2("PROPERTY");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYGET) {
-        type =  rb_str_new2("PROPERTYGET");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
-        type = rb_str_new2("PROPERTYPUT");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
-        type = rb_str_new2("PROPERTYPUTREF");
-    } else if(FIX2INT(invkind) & INVOKE_FUNC) {
-        type = rb_str_new2("FUNC");
-    }
-    return type;
-}
-
-/*
- *   call-seq:
- *      WIN32OLE_MTHOD#invkind
- *
- *   Returns the method invoke kind.
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     puts method.invkind # => 1
- *
- */
-static VALUE
-folemethod_invkind(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_invkind(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD#invoke_kind
- *
- *  Returns the method kind string. The string is "UNKNOWN" or "PROPERTY"
- *  or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF"
- *  or "FUNC".
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     puts method.invoke_kind # => "FUNC"
- */
-static VALUE
-folemethod_invoke_kind(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index)
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE visible;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if(FAILED(hr))
-        return Qfalse;
-    if (pFuncDesc->wFuncFlags & (FUNCFLAG_FRESTRICTED |
-                                 FUNCFLAG_FHIDDEN |
-                                 FUNCFLAG_FNONBROWSABLE)) {
-        visible = Qfalse;
-    } else {
-        visible = Qtrue;
-    }
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return visible;
-}
-
-/*
- *  call-seq:
- *     WIN32OLE_METHOD#visible?
- *
- *  Returns true if the method is public.
- *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- *     method = WIN32OLE_METHOD.new(tobj, 'Add')
- *     puts method.visible? # => true
- */
-static VALUE
-folemethod_visible(VALUE self)
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name)
-{
-    TYPEATTR *pTypeAttr;
-    HRESULT hr;
-    WORD i;
-    int flags;
-    HREFTYPE href;
-    ITypeInfo *pRefTypeInfo;
-    FUNCDESC *pFuncDesc;
-    BSTR bstr;
-    VALUE name;
-    VALUE event = Qfalse;
-
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr))
-        return event;
-    if(pTypeAttr->typekind != TKIND_COCLASS) {
-        pTypeInfo->lpVtbl- (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]