ruby-changes:35025
From: suke <ko1@a...>
Date: Sat, 9 Aug 2014 00:37:47 +0900 (JST)
Subject: [ruby-changes:35025] suke:r47107 (trunk): * ext/win32ole/win32ole.c: separate WIN32OLE_TYPE src from win32ole.c.
suke 2014-08-09 00:37:32 +0900 (Sat, 09 Aug 2014) New Revision: 47107 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47107 Log: * ext/win32ole/win32ole.c: separate WIN32OLE_TYPE src from win32ole.c. * ext/win32ole/win32ole.h: ditto. * ext/win32ole/win32ole_type.c: ditto. * ext/win32ole/win32ole_type.h: ditto. * ext/win32ole/depend: ditto. Added files: trunk/ext/win32ole/win32ole_type.c trunk/ext/win32ole/win32ole_type.h Modified files: trunk/ChangeLog trunk/ext/win32ole/depend trunk/ext/win32ole/win32ole.c trunk/ext/win32ole/win32ole.h Index: ChangeLog =================================================================== --- ChangeLog (revision 47106) +++ ChangeLog (revision 47107) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Aug 9 00:34:37 2014 Masaki Suketa <masaki.suketa@n...> + + * ext/win32ole/win32ole.c: separate WIN32OLE_TYPE src from win32ole.c. + * ext/win32ole/win32ole.h: ditto. + * ext/win32ole/win32ole_type.c: ditto. + * ext/win32ole/win32ole_type.h: ditto. + * ext/win32ole/depend: ditto. + Fri Aug 8 01:53:37 2014 Masaki Matsushita <glass.saga@g...> * lib/securerandom.rb: use OpenSSL::BN for performance improvement. Index: ext/win32ole/depend =================================================================== --- ext/win32ole/depend (revision 47106) +++ ext/win32ole/depend (revision 47107) @@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32ole/depend#L1 WIN32OLE_HEADERS = $(HDRS) $(ruby_headers) win32ole.o : win32ole.c $(WIN32OLE_HEADERS) win32ole_variant_m.o : win32ole_variant_m.c $(WIN32OLE_HEADERS) -win32ole_error.o : win32ole_error.c $(WIN32OLE_HEADERS) win32ole_typelib.o : win32ole_typelib.c $(WIN32OLE_HEADERS) +win32ole_type.o : win32ole_type.c $(WIN32OLE_HEADERS) +win32ole_error.o : win32ole_error.c $(WIN32OLE_HEADERS) Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 47106) +++ ext/win32ole/win32ole.c (revision 47107) @@ -27,10 +27,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L27 #endif -#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0 -#define OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y))) -#define OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y))) #define OLEData_Get_Struct(obj, pole) {\ @@ -110,7 +107,6 @@ typedef struct tagIEVENTSINKOBJ { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L107 }IEVENTSINKOBJ, *PIEVENTSINKOBJ; VALUE cWIN32OLE; -VALUE cWIN32OLE_VARIABLE; VALUE cWIN32OLE_METHOD; VALUE cWIN32OLE_PARAM; VALUE cWIN32OLE_EVENT; @@ -161,8 +157,9 @@ struct oledata { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L157 IDispatch *pDispatch; }; -struct oletypedata { +struct olevariabledata { ITypeInfo *pTypeInfo; + UINT index; }; struct olemethoddata { @@ -171,10 +168,6 @@ struct olemethoddata { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L168 UINT index; }; -struct olevariabledata { - ITypeInfo *pTypeInfo; - UINT index; -}; struct oleparamdata { ITypeInfo *pTypeInfo; @@ -225,7 +218,6 @@ static void ole_freeexceptinfo(EXCEPINFO https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L218 static VALUE ole_excepinfo2msg(EXCEPINFO *pExInfo); static void ole_msg_loop(void); static void ole_free(struct oledata *pole); -static void oletype_free(struct oletypedata *poletype); static void olemethod_free(struct olemethoddata *polemethod); static void olevariable_free(struct olevariabledata *polevar); static void oleparam_free(struct oleparamdata *pole); @@ -295,65 +287,20 @@ static VALUE fole_missing(int argc, VALU https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L287 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 VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, 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); static VALUE fole_get_methods(VALUE self); static VALUE fole_put_methods(VALUE self); static VALUE fole_func_methods(VALUE self); -static VALUE ole_type_from_itypeinfo(ITypeInfo *pTypeInfo); static VALUE fole_type(VALUE self); -static VALUE ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo); static VALUE fole_typelib(VALUE self); static VALUE fole_query_interface(VALUE self, VALUE str_iid); static VALUE fole_respond_to(VALUE self, VALUE method); -static HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile); static VALUE ole_usertype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails); static VALUE ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails); -static VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails); static VALUE fole_method_help(VALUE self, VALUE cmdname); static VALUE fole_activex_initialize(VALUE self); -static VALUE foletype_s_ole_classes(VALUE self, VALUE typelib); -static VALUE foletype_s_typelibs(VALUE self); -static VALUE foletype_s_progids(VALUE self); -static VALUE foletype_s_allocate(VALUE klass); -static VALUE oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name); -static VALUE oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass); -static VALUE foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass); -static VALUE foletype_name(VALUE self); -static VALUE ole_ole_type(ITypeInfo *pTypeInfo); -static VALUE foletype_ole_type(VALUE self); -static VALUE ole_type_guid(ITypeInfo *pTypeInfo); -static VALUE foletype_guid(VALUE self); -static VALUE ole_type_progid(ITypeInfo *pTypeInfo); -static VALUE foletype_progid(VALUE self); -static VALUE ole_type_visible(ITypeInfo *pTypeInfo); -static VALUE foletype_visible(VALUE self); -static VALUE ole_type_major_version(ITypeInfo *pTypeInfo); -static VALUE foletype_major_version(VALUE self); -static VALUE ole_type_minor_version(ITypeInfo *pTypeInfo); -static VALUE foletype_minor_version(VALUE self); -static VALUE ole_type_typekind(ITypeInfo *pTypeInfo); -static VALUE foletype_typekind(VALUE self); -static VALUE ole_type_helpstring(ITypeInfo *pTypeInfo); -static VALUE foletype_helpstring(VALUE self); -static VALUE ole_type_src_type(ITypeInfo *pTypeInfo); -static VALUE foletype_src_type(VALUE self); -static VALUE ole_type_helpfile(ITypeInfo *pTypeInfo); -static VALUE foletype_helpfile(VALUE self); -static VALUE ole_type_helpcontext(ITypeInfo *pTypeInfo); -static VALUE foletype_helpcontext(VALUE self); -static VALUE foletype_ole_typelib(VALUE self); -static VALUE ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags); -static VALUE foletype_impl_ole_types(VALUE self); -static VALUE foletype_source_ole_types(VALUE self); -static VALUE foletype_default_event_sources(VALUE self); -static VALUE foletype_default_ole_types(VALUE self); -static VALUE foletype_inspect(VALUE self); -static VALUE ole_variables(ITypeInfo *pTypeInfo); -static VALUE foletype_variables(VALUE self); -static VALUE foletype_methods(VALUE self); static VALUE folevariable_name(VALUE self); static VALUE ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index); static VALUE folevariable_ole_type(VALUE self); @@ -1112,13 +1059,6 @@ ole_free(struct oledata *pole) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1059 } static void -oletype_free(struct oletypedata *poletype) -{ - OLE_FREE(poletype->pTypeInfo); - free(poletype); -} - -static void olemethod_free(struct olemethoddata *polemethod) { OLE_FREE(polemethod->pTypeInfo); @@ -4009,7 +3949,7 @@ ole_methods_sub(ITypeInfo *pOwnerTypeInf https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3949 return methods; } -static VALUE +VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask) { HRESULT hr; @@ -4164,7 +4104,7 @@ fole_func_methods(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4104 return ole_methods( self, INVOKE_FUNC); } -static VALUE +VALUE ole_type_from_itypeinfo(ITypeInfo *pTypeInfo) { ITypeLib *pTypeLib; @@ -4183,8 +4123,7 @@ ole_type_from_itypeinfo(ITypeInfo *pType https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4123 if (FAILED(hr)) { return Qnil; } - type = foletype_s_allocate(cWIN32OLE_TYPE); - oletype_set_member(type, pTypeInfo, WC2VSTR(bstr)); + type = create_win32ole_type(pTypeInfo, WC2VSTR(bstr)); return type; } @@ -4220,7 +4159,7 @@ fole_type(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4159 return type; } -static VALUE +VALUE ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo) { HRESULT hr; @@ -4346,7 +4285,7 @@ fole_respond_to(VALUE self, VALUE method https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4285 return SUCCEEDED(hr) ? Qtrue : Qfalse; } -static HRESULT +HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile) { HRESULT hr; @@ -4407,7 +4346,7 @@ ole_ptrtype2val(ITypeInfo *pTypeInfo, TY https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4346 return type; } -static VALUE +VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) { VALUE str; @@ -4606,822 +4545,27 @@ fole_activex_initialize(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4545 return Qnil; } -/* - * call-seq: - * WIN32OLE_TYPE.ole_classes(typelib) - * - * Returns array of WIN32OLE_TYPE objects defined by the <i>typelib</i> type library. - * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead. - */ -static VALUE -foletype_s_ole_classes(VALUE self, VALUE typelib) -{ - VALUE obj; - - /* - rb_warn("%s is obsolete; use %s instead.", - "WIN32OLE_TYPE.ole_classes", - "WIN32OLE_TYPELIB.new(typelib).ole_types"); - */ - obj = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("new"), 1, typelib); - return rb_funcall(obj, rb_intern("ole_types"), 0); -} - -/* - * call-seq: - * WIN32OLE_TYPE.typelibs - * - * Returns array of type libraries. - * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead. - * - */ -static VALUE -foletype_s_typelibs(VALUE self) -{ - /* - rb_warn("%s is obsolete. use %s instead.", - "WIN32OLE_TYPE.typelibs", - "WIN32OLE_TYPELIB.typelibs.collect{t|t.name}"); - */ - return rb_eval_string("WIN32OLE_TYPELIB.typelibs.collect{|t|t.name}"); -} /* - * call-seq: - * WIN32OLE_TYPE.progids + * Document-class: WIN32OLE_VARIABLE * - * Returns array of ProgID. + * <code>WIN32OLE_VARIABLE</code> objects represent OLE variable information. */ -static VALUE -foletype_s_progids(VALUE self) -{ - HKEY hclsids, hclsid; - DWORD i; - LONG err; - VALUE clsid; - VALUE v = rb_str_new2(""); - VALUE progids = rb_ary_new(); - - err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hclsids); - if(err != ERROR_SUCCESS) { - return progids; - } - for(i = 0; ; i++) { - clsid = reg_enum_key(hclsids, i); - if (clsid == Qnil) - break; - err = reg_open_vkey(hclsids, clsid, &hclsid); - if (err != ERROR_SUCCESS) - continue; - if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil) - rb_ary_push(progids, v); - if ((v = reg_get_val2(hclsid, "VersionIndependentProgID")) != Qnil) - rb_ary_push(progids, v); - RegCloseKey(hclsid); - } - RegCloseKey(hclsids); - return progids; -} - -static VALUE -foletype_s_allocate(VALUE klass) -{ - struct oletypedata *poletype; - VALUE obj; - ole_initialize(); - obj = Data_Make_Struct(klass,struct oletypedata,0,oletype_free,poletype); - poletype->pTypeInfo = NULL; - return obj; -} - -static VALUE -oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name) -{ - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - rb_ivar_set(self, rb_intern("name"), name); - ptype->pTypeInfo = pTypeInfo; - if(pTypeInfo) OLE_ADDREF(pTypeInfo); - return self; -} VALUE -create_win32ole_type(ITypeInfo *pTypeInfo, VALUE name) -{ - VALUE obj = foletype_s_allocate(cWIN32OLE_TYPE); - oletype_set_member(obj, pTypeInfo, name); - return obj; -} - -static VALUE -oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) -{ - - long count; - int i; - HRESULT hr; - BSTR bstr; - VALUE typelib; - ITypeInfo *pTypeInfo; - - VALUE found = Qfalse; - - count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib); - for (i = 0; i < count && found == Qfalse; i++) { - hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo); - if (FAILED(hr)) - continue; - hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i, - &bstr, NULL, NULL, NULL); - if (FAILED(hr)) - continue; - typelib = WC2VSTR(bstr); - if (rb_str_cmp(oleclass, typelib) == 0) { - oletype_set_member(self, pTypeInfo, typelib); - found = Qtrue; - } - OLE_RELEASE(pTypeInfo); - } - return found; -} - -/* - * Document-class: WIN32OLE_TYPE - * - * <code>WIN32OLE_TYPE</code> objects represent OLE type libarary information. - */ - -/* - * call-seq: - * WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object - * - * Returns a new WIN32OLE_TYPE object. - * The first argument <i>typelib</i> specifies OLE type library name. - * The second argument specifies OLE class name. - * - * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * # => WIN32OLE_TYPE object of Application class of Excel. - */ -static VALUE -foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass) -{ - VALUE file; - OLECHAR * pbuf; - ITypeLib *pTypeLib; - HRESULT hr; - - SafeStringValue(oleclass); - SafeStringValue(typelib); - file = typelib_file(typelib); - if (file == Qnil) { - file = typelib; - } - pbuf = ole_vstr2wc(file); - hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib); - if (FAILED(hr)) - ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx"); - SysFreeString(pbuf); - if (oleclass_from_typelib(self, pTypeLib, oleclass) == Qfalse) { - OLE_RELEASE(pTypeLib); - rb_raise(eWIN32OLERuntimeError, "not found `%s` in `%s`", - StringValuePtr(oleclass), StringValuePtr(typelib)); - } - OLE_RELEASE(pTypeLib); - return self; -} - -/* - * call-seq: - * WIN32OLE_TYPE#name #=> OLE type name - * - * Returns OLE type name. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * puts tobj.name # => Application - */ -static VALUE -foletype_name(VALUE self) -{ - return rb_ivar_get(self, rb_intern("name")); -} - -static VALUE -ole_ole_type(ITypeInfo *pTypeInfo) -{ - HRESULT hr; - TYPEATTR *pTypeAttr; - VALUE type = Qnil; - hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if(FAILED(hr)){ - return type; - } - switch(pTypeAttr->typekind) { - case TKIND_ENUM: - type = rb_str_new2("Enum"); - break; - case TKIND_RECORD: - type = rb_str_new2("Record"); - break; - case TKIND_MODULE: - type = rb_str_new2("Module"); - break; - case TKIND_INTERFACE: - type = rb_str_new2("Interface"); - break; - case TKIND_DISPATCH: - type = rb_str_new2("Dispatch"); - break; - case TKIND_COCLASS: - type = rb_str_new2("Class"); - break; - case TKIND_ALIAS: - type = rb_str_new2("Alias"); - break; - case TKIND_UNION: - type = rb_str_new2("Union"); - break; - case TKIND_MAX: - type = rb_str_new2("Max"); - break; - default: - type = Qnil; - break; - } - OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); - return type; -} - -/* - * call-seq: - * WIN32OLE_TYPE#ole_type #=> OLE type string. - * - * returns type of OLE class. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * puts tobj.ole_type # => Class - */ -static VALUE -foletype_ole_type(VALUE self) -{ - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_ole_type(ptype->pTypeInfo); -} - -static VALUE -ole_type_guid(ITypeInfo *pTypeInfo) -{ - HRESULT hr; - TYPEATTR *pTypeAttr; - int len; - OLECHAR bstr[80]; - VALUE guid = Qnil; - hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) - return guid; - len = StringFromGUID2(&pTypeAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR)); - if (len > 3) { - guid = ole_wc2vstr(bstr, FALSE); - } - OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); - return guid; -} - -/* - * call-seq: - * WIN32OLE_TYPE#guid #=> GUID - * - * Returns GUID. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * puts tobj.guid # => {0002????-????-????-C000-000000000046} - */ -static VALUE -foletype_guid(VALUE self) -{ - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_guid(ptype->pTypeInfo); -} - -static VALUE -ole_type_progid(ITypeInfo *pTypeInfo) -{ - HRESULT hr; - TYPEATTR *pTypeAttr; - OLECHAR *pbuf; - VALUE progid = Qnil; - hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) - return progid; - hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf); - if (SUCCEEDED(hr)) { - progid = ole_wc2vstr(pbuf, FALSE); - CoTaskMemFree(pbuf); - } - OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); - return progid; -} - -/* - * call-seq: - * WIN32OLE_TYPE#progid #=> ProgID - * - * Returns ProgID if it exists. If not found, then returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * puts tobj.progid # => Excel.Application.9 - */ -static VALUE -foletype_progid(VALUE self) -{ - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_progid(ptype->pTypeInfo); -} - - -static VALUE -ole_type_visible(ITypeInfo *pTypeInfo) -{ - HRESULT hr; - TYPEATTR *pTypeAttr; - VALUE visible; - hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) - return Qtrue; - if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) { - visible = Qfalse; - } else { - visible = Qtrue; - } - OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); - return visible; -} - -/* - * call-seq: - * WIN32OLE_TYPE#visible? #=> true or false - * - * Returns true if the OLE class is public. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * puts tobj.visible # => true - */ -static VALUE -foletype_visible(VALUE self) -{ - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_visible(ptype->pTypeInfo); -} - -static VALUE -ole_type_major_version(ITypeInfo *pTypeInfo) -{ - VALUE ver; - TYPEATTR *pTypeAttr; - HRESULT hr; - hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr); - if (FAILED(hr)) - ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr"); - ver = INT2FIX(pTypeAttr->wMajorVerNum); - OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr); - return ver; -} - -/* - * call-seq: - * WIN32OLE_TYPE#major_version - * - * Returns major version. - * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') - * puts tobj.major_version # => 8 - */ -static VALUE -foletype_major_version(VALUE self) +create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_major_version(ptype->pTypeInfo); -} - -static VALUE -ole_type_minor_version(IT (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/