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
3dea7bd7
Commit
3dea7bd7
authored
Nov 06, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Store global static arrays together with global variables.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d8e8d163
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
19 deletions
+42
-19
compile.c
dlls/vbscript/compile.c
+1
-0
interp.c
dlls/vbscript/interp.c
+40
-19
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/compile.c
View file @
3dea7bd7
...
...
@@ -1496,6 +1496,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
V_VT
(
&
new_var
->
v
)
=
VT_EMPTY
;
new_var
->
is_const
=
FALSE
;
new_var
->
array
=
NULL
;
new_var
->
next
=
ctx
->
global_vars
;
ctx
->
global_vars
=
new_var
;
...
...
dlls/vbscript/interp.c
View file @
3dea7bd7
...
...
@@ -223,6 +223,7 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
memcpy
(
str
,
name
,
size
);
new_var
->
name
=
str
;
new_var
->
is_const
=
is_const
;
new_var
->
array
=
NULL
;
V_VT
(
&
new_var
->
v
)
=
VT_EMPTY
;
if
(
ctx
->
func
->
type
==
FUNC_GLOBAL
)
{
...
...
@@ -1108,43 +1109,61 @@ static HRESULT interp_dim(exec_ctx_t *ctx)
const
BSTR
ident
=
ctx
->
instr
->
arg1
.
bstr
;
const
unsigned
array_id
=
ctx
->
instr
->
arg2
.
uint
;
const
array_desc_t
*
array_desc
;
ref_t
ref
;
SAFEARRAY
**
array_ref
;
VARIANT
*
v
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
ident
));
assert
(
array_id
<
ctx
->
func
->
array_cnt
);
if
(
!
ctx
->
arrays
)
{
ctx
->
arrays
=
heap_alloc_zero
(
ctx
->
func
->
array_cnt
*
sizeof
(
SAFEARRAY
*
));
if
(
!
ctx
->
arrays
)
return
E_OUTOFMEMORY
;
}
hres
=
lookup_identifier
(
ctx
,
ident
,
VBDISP_LET
,
&
ref
);
if
(
FAILED
(
hres
))
{
FIXME
(
"lookup %s failed: %08x
\n
"
,
debugstr_w
(
ident
),
hres
);
return
hres
;
}
if
(
ctx
->
func
->
type
==
FUNC_GLOBAL
)
{
dynamic_var_t
*
var
;
for
(
var
=
ctx
->
script
->
global_vars
;
var
;
var
=
var
->
next
)
{
if
(
!
wcsicmp
(
var
->
name
,
ident
))
break
;
}
assert
(
var
!=
NULL
);
v
=
&
var
->
v
;
array_ref
=
&
var
->
array
;
}
else
{
ref_t
ref
;
if
(
ref
.
type
!=
REF_VAR
)
{
FIXME
(
"got ref.type = %d
\n
"
,
ref
.
type
);
return
E_FAIL
;
if
(
!
ctx
->
arrays
)
{
ctx
->
arrays
=
heap_alloc_zero
(
ctx
->
func
->
array_cnt
*
sizeof
(
SAFEARRAY
*
));
if
(
!
ctx
->
arrays
)
return
E_OUTOFMEMORY
;
}
hres
=
lookup_identifier
(
ctx
,
ident
,
VBDISP_LET
,
&
ref
);
if
(
FAILED
(
hres
))
{
FIXME
(
"lookup %s failed: %08x
\n
"
,
debugstr_w
(
ident
),
hres
);
return
hres
;
}
if
(
ref
.
type
!=
REF_VAR
)
{
FIXME
(
"got ref.type = %d
\n
"
,
ref
.
type
);
return
E_FAIL
;
}
v
=
ref
.
u
.
v
;
array_ref
=
ctx
->
arrays
+
array_id
;
}
if
(
ctx
->
arrays
[
array_id
]
)
{
if
(
*
array_ref
)
{
FIXME
(
"Array already initialized
\n
"
);
return
E_FAIL
;
}
array_desc
=
ctx
->
func
->
array_descs
+
array_id
;
if
(
array_desc
->
dim_cnt
)
{
ctx
->
arrays
[
array_id
]
=
SafeArrayCreate
(
VT_VARIANT
,
array_desc
->
dim_cnt
,
array_desc
->
bounds
);
if
(
!
ctx
->
arrays
[
array_id
]
)
*
array_ref
=
SafeArrayCreate
(
VT_VARIANT
,
array_desc
->
dim_cnt
,
array_desc
->
bounds
);
if
(
!
*
array_ref
)
return
E_OUTOFMEMORY
;
}
V_VT
(
ref
.
u
.
v
)
=
VT_ARRAY
|
VT_BYREF
|
VT_VARIANT
;
V_ARRAYREF
(
ref
.
u
.
v
)
=
ctx
->
arrays
+
array_id
;
V_VT
(
v
)
=
VT_ARRAY
|
VT_BYREF
|
VT_VARIANT
;
V_ARRAYREF
(
v
)
=
array_ref
;
return
S_OK
;
}
...
...
@@ -2201,6 +2220,8 @@ void release_dynamic_vars(dynamic_var_t *var)
{
while
(
var
)
{
VariantClear
(
&
var
->
v
);
if
(
var
->
array
)
SafeArrayDestroy
(
var
->
array
);
var
=
var
->
next
;
}
}
...
...
dlls/vbscript/vbscript.h
View file @
3dea7bd7
...
...
@@ -169,6 +169,7 @@ typedef struct _dynamic_var_t {
VARIANT
v
;
const
WCHAR
*
name
;
BOOL
is_const
;
SAFEARRAY
*
array
;
}
dynamic_var_t
;
struct
_script_ctx_t
{
...
...
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