mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ext/win32ole/win32ole_variable.c: use typed data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c8d7d587ac
commit
b61cb94e94
2 changed files with 28 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Oct 8 21:44:10 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* ext/win32ole/win32ole_variable.c: use typed data.
|
||||
|
||||
Wed Oct 8 16:36:47 2014 gogo tanaka <mail@tanakakazuki.com>
|
||||
|
||||
* test/ruby/test_syntax.rb: added syntax tests of underscore
|
||||
|
|
|
@ -5,7 +5,8 @@ struct olevariabledata {
|
|||
UINT index;
|
||||
};
|
||||
|
||||
static void olevariable_free(struct olevariabledata *polevar);
|
||||
static void olevariable_free(void *ptr);
|
||||
static size_t olevariable_size(const void *ptr);
|
||||
static VALUE folevariable_name(VALUE self);
|
||||
static VALUE ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index);
|
||||
static VALUE folevariable_ole_type(VALUE self);
|
||||
|
@ -21,13 +22,26 @@ static VALUE ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index);
|
|||
static VALUE folevariable_varkind(VALUE self);
|
||||
static VALUE folevariable_inspect(VALUE self);
|
||||
|
||||
static const rb_data_type_t olevariable_datatype = {
|
||||
"win32ole_variable",
|
||||
{NULL, olevariable_free, olevariable_size,},
|
||||
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
||||
};
|
||||
|
||||
static void
|
||||
olevariable_free(struct olevariabledata *polevar)
|
||||
olevariable_free(void *ptr)
|
||||
{
|
||||
struct olevariabledata *polevar = ptr;
|
||||
OLE_FREE(polevar->pTypeInfo);
|
||||
free(polevar);
|
||||
}
|
||||
|
||||
static size_t
|
||||
olevariable_size(const void *ptr)
|
||||
{
|
||||
return ptr ? sizeof(struct olevariabledata) : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: WIN32OLE_VARIABLE
|
||||
*
|
||||
|
@ -38,8 +52,8 @@ VALUE
|
|||
create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
VALUE obj = Data_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
|
||||
0,olevariable_free,pvar);
|
||||
VALUE obj = TypedData_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
|
||||
&olevariable_datatype, pvar);
|
||||
pvar->pTypeInfo = pTypeInfo;
|
||||
OLE_ADDREF(pTypeInfo);
|
||||
pvar->index = index;
|
||||
|
@ -111,7 +125,7 @@ static VALUE
|
|||
folevariable_ole_type(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
@ -145,7 +159,7 @@ static VALUE
|
|||
folevariable_ole_type_detail(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
@ -189,7 +203,7 @@ static VALUE
|
|||
folevariable_value(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_value(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
@ -235,7 +249,7 @@ static VALUE
|
|||
folevariable_visible(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_visible(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
@ -291,7 +305,7 @@ static VALUE
|
|||
folevariable_variable_kind(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_kind(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
@ -331,7 +345,7 @@ static VALUE
|
|||
folevariable_varkind(VALUE self)
|
||||
{
|
||||
struct olevariabledata *pvar;
|
||||
Data_Get_Struct(self, struct olevariabledata, pvar);
|
||||
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
|
||||
return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue