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
e0d02783
Commit
e0d02783
authored
Dec 06, 2023
by
Robert Wilhelm
Committed by
Alexandre Julliard
Dec 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: For for loop bounds coerce string to real.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55052
parent
8e338fbb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
2 deletions
+63
-2
compile.c
dlls/vbscript/compile.c
+4
-2
interp.c
dlls/vbscript/interp.c
+31
-0
lang.vbs
dlls/vbscript/tests/lang.vbs
+27
-0
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/compile.c
View file @
e0d02783
...
...
@@ -875,6 +875,8 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st
hres
=
compile_expression
(
ctx
,
stat
->
from_expr
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
push_instr
(
ctx
,
OP_numval
))
return
E_OUTOFMEMORY
;
/* FIXME: Assign should happen after both expressions evaluation. */
instr
=
push_instr
(
ctx
,
OP_assign_ident
);
...
...
@@ -887,7 +889,7 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
push_instr
(
ctx
,
OP_val
))
if
(
!
push_instr
(
ctx
,
OP_
num
val
))
return
E_OUTOFMEMORY
;
if
(
stat
->
step_expr
)
{
...
...
@@ -895,7 +897,7 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
push_instr
(
ctx
,
OP_val
))
if
(
!
push_instr
(
ctx
,
OP_
num
val
))
return
E_OUTOFMEMORY
;
}
else
{
hres
=
push_instr_int
(
ctx
,
OP_int
,
1
);
...
...
dlls/vbscript/interp.c
View file @
e0d02783
...
...
@@ -1088,6 +1088,37 @@ static HRESULT interp_val(exec_ctx_t *ctx)
return
stack_push
(
ctx
,
val
.
owned
?
val
.
v
:
&
v
);
}
static
HRESULT
interp_numval
(
exec_ctx_t
*
ctx
)
{
variant_val_t
val
;
VARIANT
v
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
stack_pop_val
(
ctx
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
val
.
v
)
==
VT_BSTR
)
{
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
VariantChangeType
(
&
v
,
val
.
v
,
0
,
VT_R8
);
if
(
FAILED
(
hres
))
return
hres
;
release_val
(
&
val
);
return
stack_push
(
ctx
,
&
v
);
}
if
(
!
val
.
owned
)
{
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
VariantCopy
(
&
v
,
val
.
v
);
if
(
FAILED
(
hres
))
return
hres
;
}
return
stack_push
(
ctx
,
val
.
owned
?
val
.
v
:
&
v
);
}
static
HRESULT
interp_pop
(
exec_ctx_t
*
ctx
)
{
const
unsigned
n
=
ctx
->
instr
->
arg1
.
uint
;
...
...
dlls/vbscript/tests/lang.vbs
View file @
e0d02783
...
...
@@ -679,6 +679,33 @@ for x = 5 to 8
next
Call
ok
(
y
=
"for8: 5 7"
,
"y = "
&
y
)
function
testfor
(
startvalue
,
endvalue
,
stepvalue
,
steps
)
Dim
s
s
=
0
for
x
=
startvalue
to
endvalue
step
stepvalue
s
=
s
+
1
Next
Call
ok
(
s
=
steps
,
"counted "
&
s
&
" steps in for loop, expected "
&
steps
)
end
function
Call
testfor
(
1
,
2
,
1
,
2
)
Call
testfor
(
"1"
,
2
,
1
,
2
)
Call
testfor
(
1
,
"2"
,
1
,
2
)
Call
testfor
(
1
,
2
,
"1"
,
2
)
Call
testfor
(
"1"
,
"2"
,
"1"
,
2
)
if
(
isEnglishLang
)
then
Call
testfor
(
1
,
2
,
0.5
,
3
)
Call
testfor
(
1
,
2.5
,
0.5
,
4
)
Call
testfor
(
"1"
,
2
,
0.5
,
3
)
Call
testfor
(
"1"
,
2.5
,
0.5
,
4
)
Call
testfor
(
1
,
"2"
,
0.5
,
3
)
Call
testfor
(
1
,
"2.5"
,
0.5
,
4
)
Call
testfor
(
1
,
2
,
"0.5"
,
3
)
Call
testfor
(
1
,
2.5
,
"0.5"
,
4
)
Call
testfor
(
"1"
,
"2"
,
"0.5"
,
3
)
Call
testfor
(
"1"
,
"2.5"
,
"0.5"
,
4
)
end
if
for
x
=
1.5
to
1
Call
ok
(
false
,
"for..to called when unexpected"
)
next
...
...
dlls/vbscript/vbscript.h
View file @
e0d02783
...
...
@@ -278,6 +278,7 @@ typedef enum {
X(not, 1, 0, 0) \
X(nothing, 1, 0, 0) \
X(null, 1, 0, 0) \
X(numval, 1, 0, 0) \
X(or, 1, 0, 0) \
X(pop, 1, ARG_UINT, 0) \
X(redim, 1, ARG_BSTR, ARG_UINT) \
...
...
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