Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ecaa7285
Commit
ecaa7285
authored
Oct 28, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Factor out variant_call.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
25248362
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
36 deletions
+52
-36
interp.c
dlls/vbscript/interp.c
+52
-36
No files found.
dlls/vbscript/interp.c
View file @
ecaa7285
...
...
@@ -515,6 +515,52 @@ static HRESULT array_access(exec_ctx_t *ctx, SAFEARRAY *array, DISPPARAMS *dp, V
return
hres
;
}
static
HRESULT
variant_call
(
exec_ctx_t
*
ctx
,
VARIANT
*
v
,
unsigned
arg_cnt
,
VARIANT
*
res
)
{
SAFEARRAY
*
array
=
NULL
;
DISPPARAMS
dp
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_variant
(
v
));
if
(
V_VT
(
v
)
==
(
VT_VARIANT
|
VT_BYREF
))
v
=
V_VARIANTREF
(
v
);
switch
(
V_VT
(
v
))
{
case
VT_ARRAY
|
VT_BYREF
|
VT_VARIANT
:
array
=
*
V_ARRAYREF
(
v
);
break
;
case
VT_ARRAY
|
VT_VARIANT
:
array
=
V_ARRAY
(
v
);
break
;
case
VT_DISPATCH
:
vbstack_to_dp
(
ctx
,
arg_cnt
,
FALSE
,
&
dp
);
hres
=
disp_call
(
ctx
->
script
,
V_DISPATCH
(
v
),
DISPID_VALUE
,
&
dp
,
res
);
break
;
default:
FIXME
(
"unsupported on %s
\n
"
,
debugstr_variant
(
v
));
return
E_NOTIMPL
;
}
if
(
array
)
{
if
(
!
res
)
{
FIXME
(
"no res
\n
"
);
return
E_NOTIMPL
;
}
vbstack_to_dp
(
ctx
,
arg_cnt
,
FALSE
,
&
dp
);
hres
=
array_access
(
ctx
,
array
,
&
dp
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
V_VT
(
res
)
=
VT_BYREF
|
VT_VARIANT
;
V_BYREF
(
res
)
=
v
;
}
stack_popn
(
ctx
,
arg_cnt
);
return
S_OK
;
}
static
HRESULT
do_icall
(
exec_ctx_t
*
ctx
,
VARIANT
*
res
)
{
BSTR
identifier
=
ctx
->
instr
->
arg1
.
bstr
;
...
...
@@ -523,56 +569,26 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
ref_t
ref
;
HRESULT
hres
;
TRACE
(
"%s %u
\n
"
,
debugstr_w
(
identifier
),
arg_cnt
);
hres
=
lookup_identifier
(
ctx
,
identifier
,
VBDISP_CALLGET
,
&
ref
);
if
(
FAILED
(
hres
))
return
hres
;
switch
(
ref
.
type
)
{
case
REF_VAR
:
case
REF_CONST
:
{
VARIANT
*
v
;
case
REF_CONST
:
if
(
arg_cnt
)
return
variant_call
(
ctx
,
ref
.
u
.
v
,
arg_cnt
,
res
);
if
(
!
res
)
{
FIXME
(
"REF_VAR no res
\n
"
);
return
E_NOTIMPL
;
}
v
=
V_VT
(
ref
.
u
.
v
)
==
(
VT_VARIANT
|
VT_BYREF
)
?
V_VARIANTREF
(
ref
.
u
.
v
)
:
ref
.
u
.
v
;
if
(
arg_cnt
)
{
SAFEARRAY
*
array
=
NULL
;
switch
(
V_VT
(
v
))
{
case
VT_ARRAY
|
VT_BYREF
|
VT_VARIANT
:
array
=
*
V_ARRAYREF
(
v
);
break
;
case
VT_ARRAY
|
VT_VARIANT
:
array
=
V_ARRAY
(
v
);
break
;
case
VT_DISPATCH
:
vbstack_to_dp
(
ctx
,
arg_cnt
,
FALSE
,
&
dp
);
hres
=
disp_call
(
ctx
->
script
,
V_DISPATCH
(
v
),
DISPID_VALUE
,
&
dp
,
res
);
if
(
FAILED
(
hres
))
return
hres
;
break
;
default:
FIXME
(
"arguments not implemented
\n
"
);
return
E_NOTIMPL
;
}
if
(
!
array
)
break
;
vbstack_to_dp
(
ctx
,
arg_cnt
,
FALSE
,
&
dp
);
hres
=
array_access
(
ctx
,
array
,
&
dp
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
}
V_VT
(
res
)
=
VT_BYREF
|
VT_VARIANT
;
V_BYREF
(
res
)
=
v
;
V_BYREF
(
res
)
=
V_VT
(
ref
.
u
.
v
)
==
(
VT_VARIANT
|
VT_BYREF
)
?
V_VARIANTREF
(
ref
.
u
.
v
)
:
ref
.
u
.
v
;
break
;
}
case
REF_DISP
:
vbstack_to_dp
(
ctx
,
arg_cnt
,
FALSE
,
&
dp
);
hres
=
disp_call
(
ctx
->
script
,
ref
.
u
.
d
.
disp
,
ref
.
u
.
d
.
id
,
&
dp
,
res
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment