Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c846a592
Commit
c846a592
authored
Sep 14, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added interpreter support for sub arguments.
parent
0c0b252c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
7 deletions
+68
-7
interp.c
dlls/vbscript/interp.c
+63
-7
vbscript.h
dlls/vbscript/vbscript.h
+5
-0
No files found.
dlls/vbscript/interp.c
View file @
c846a592
...
@@ -31,6 +31,8 @@ typedef struct {
...
@@ -31,6 +31,8 @@ typedef struct {
script_ctx_t
*
script
;
script_ctx_t
*
script
;
function_t
*
func
;
function_t
*
func
;
VARIANT
*
args
;
unsigned
stack_size
;
unsigned
stack_size
;
unsigned
top
;
unsigned
top
;
VARIANT
*
stack
;
VARIANT
*
stack
;
...
@@ -82,9 +84,18 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, ref_t *ref)
...
@@ -82,9 +84,18 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, ref_t *ref)
{
{
named_item_t
*
item
;
named_item_t
*
item
;
function_t
*
func
;
function_t
*
func
;
unsigned
i
;
DISPID
id
;
DISPID
id
;
HRESULT
hres
;
HRESULT
hres
;
for
(
i
=
0
;
i
<
ctx
->
func
->
arg_cnt
;
i
++
)
{
if
(
!
strcmpiW
(
ctx
->
func
->
args
[
i
].
name
,
name
))
{
ref
->
type
=
REF_VAR
;
ref
->
u
.
v
=
ctx
->
args
+
i
;
return
S_OK
;
}
}
if
(
lookup_dynamic_vars
(
ctx
->
script
->
global_vars
,
name
,
ref
))
if
(
lookup_dynamic_vars
(
ctx
->
script
->
global_vars
,
name
,
ref
))
return
S_OK
;
return
S_OK
;
...
@@ -814,9 +825,22 @@ OP_LIST
...
@@ -814,9 +825,22 @@ OP_LIST
#undef X
#undef X
};
};
static
void
release_exec
(
exec_ctx_t
*
ctx
)
{
if
(
ctx
->
args
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
ctx
->
func
->
arg_cnt
;
i
++
)
VariantClear
(
ctx
->
args
+
i
);
}
heap_free
(
ctx
->
args
);
heap_free
(
ctx
->
stack
);
}
HRESULT
exec_script
(
script_ctx_t
*
ctx
,
function_t
*
func
,
DISPPARAMS
*
dp
,
VARIANT
*
res
)
HRESULT
exec_script
(
script_ctx_t
*
ctx
,
function_t
*
func
,
DISPPARAMS
*
dp
,
VARIANT
*
res
)
{
{
exec_ctx_t
exec
;
exec_ctx_t
exec
=
{
func
->
code_ctx
}
;
vbsop_t
op
;
vbsop_t
op
;
HRESULT
hres
=
S_OK
;
HRESULT
hres
=
S_OK
;
...
@@ -825,18 +849,50 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT
...
@@ -825,18 +849,50 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
if
(
dp
&&
arg_cnt
(
dp
))
{
exec
.
code
=
func
->
code_ctx
;
FIXME
(
"arguments not implemented
\n
"
);
return
E_NOTIMPL
;
if
(
dp
?
func
->
arg_cnt
!=
arg_cnt
(
dp
)
:
func
->
arg_cnt
)
{
FIXME
(
"wrong arg_cnt %d, expected %d
\n
"
,
dp
?
arg_cnt
(
dp
)
:
0
,
func
->
arg_cnt
);
return
E_FAIL
;
}
if
(
func
->
arg_cnt
)
{
VARIANT
*
v
;
unsigned
i
;
exec
.
args
=
heap_alloc_zero
(
func
->
arg_cnt
*
sizeof
(
VARIANT
));
if
(
!
exec
.
args
)
{
release_exec
(
&
exec
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
func
->
arg_cnt
;
i
++
)
{
v
=
get_arg
(
dp
,
i
);
if
(
V_VT
(
v
)
==
(
VT_VARIANT
|
VT_BYREF
))
{
if
(
func
->
args
[
i
].
by_ref
)
exec
.
args
[
i
]
=
*
v
;
else
hres
=
VariantCopy
(
exec
.
args
+
i
,
V_VARIANTREF
(
v
));
}
else
{
hres
=
VariantCopy
(
exec
.
args
+
i
,
v
);
}
if
(
FAILED
(
hres
))
{
release_exec
(
&
exec
);
return
hres
;
}
}
}
else
{
exec
.
args
=
NULL
;
}
}
exec
.
stack_size
=
16
;
exec
.
stack_size
=
16
;
exec
.
top
=
0
;
exec
.
top
=
0
;
exec
.
stack
=
heap_alloc
(
exec
.
stack_size
*
sizeof
(
VARIANT
));
exec
.
stack
=
heap_alloc
(
exec
.
stack_size
*
sizeof
(
VARIANT
));
if
(
!
exec
.
stack
)
if
(
!
exec
.
stack
)
{
release_exec
(
&
exec
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
exec
.
code
=
func
->
code_ctx
;
exec
.
instr
=
exec
.
code
->
instrs
+
func
->
code_off
;
exec
.
instr
=
exec
.
code
->
instrs
+
func
->
code_off
;
exec
.
script
=
ctx
;
exec
.
script
=
ctx
;
exec
.
func
=
func
;
exec
.
func
=
func
;
...
@@ -854,7 +910,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT
...
@@ -854,7 +910,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT
}
}
assert
(
!
exec
.
top
);
assert
(
!
exec
.
top
);
heap_free
(
exec
.
stack
);
release_exec
(
&
exec
);
return
hres
;
return
hres
;
}
}
dlls/vbscript/vbscript.h
View file @
c846a592
...
@@ -70,6 +70,11 @@ static inline unsigned arg_cnt(const DISPPARAMS *dp)
...
@@ -70,6 +70,11 @@ static inline unsigned arg_cnt(const DISPPARAMS *dp)
return
dp
->
cArgs
-
dp
->
cNamedArgs
;
return
dp
->
cArgs
-
dp
->
cNamedArgs
;
}
}
static
inline
VARIANT
*
get_arg
(
DISPPARAMS
*
dp
,
DWORD
i
)
{
return
dp
->
rgvarg
+
dp
->
cArgs
-
i
-
1
;
}
typedef
struct
_dynamic_var_t
{
typedef
struct
_dynamic_var_t
{
struct
_dynamic_var_t
*
next
;
struct
_dynamic_var_t
*
next
;
VARIANT
v
;
VARIANT
v
;
...
...
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