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
223a407a
Commit
223a407a
authored
Sep 16, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 16, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added do until..loop statement implementation.
parent
9701bdb5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
4 deletions
+55
-4
compile.c
dlls/vbscript/compile.c
+2
-1
interp.c
dlls/vbscript/interp.c
+25
-0
parse.h
dlls/vbscript/parse.h
+1
-0
parser.y
dlls/vbscript/parser.y
+8
-3
lang.vbs
dlls/vbscript/tests/lang.vbs
+18
-0
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/compile.c
View file @
223a407a
...
...
@@ -496,7 +496,7 @@ static HRESULT compile_while_statement(compile_ctx_t *ctx, while_statement_t *st
if
(
FAILED
(
hres
))
return
hres
;
jmp_end
=
push_instr
(
ctx
,
OP_jmp_false
);
jmp_end
=
push_instr
(
ctx
,
stat
->
stat
.
type
==
STAT_UNTIL
?
OP_jmp_true
:
OP_jmp_false
);
if
(
jmp_end
==
-
1
)
return
E_OUTOFMEMORY
;
...
...
@@ -686,6 +686,7 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat)
case
STAT_STOP
:
hres
=
push_instr
(
ctx
,
OP_stop
)
==
-
1
?
E_OUTOFMEMORY
:
S_OK
;
break
;
case
STAT_UNTIL
:
case
STAT_WHILE
:
case
STAT_WHILELOOP
:
hres
=
compile_while_statement
(
ctx
,
(
while_statement_t
*
)
stat
);
...
...
dlls/vbscript/interp.c
View file @
223a407a
...
...
@@ -611,6 +611,31 @@ static HRESULT interp_jmp_false(exec_ctx_t *ctx)
return
S_OK
;
}
static
HRESULT
interp_jmp_true
(
exec_ctx_t
*
ctx
)
{
const
unsigned
arg
=
ctx
->
instr
->
arg1
.
uint
;
variant_val_t
val
;
HRESULT
hres
;
TRACE
(
"%u
\n
"
,
arg
);
hres
=
stack_pop_val
(
ctx
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
val
.
v
)
!=
VT_BOOL
)
{
FIXME
(
"unsupported for %s
\n
"
,
debugstr_variant
(
val
.
v
));
release_val
(
&
val
);
return
E_NOTIMPL
;
}
if
(
V_BOOL
(
val
.
v
))
instr_jmp
(
ctx
,
ctx
->
instr
->
arg1
.
uint
);
else
ctx
->
instr
++
;
return
S_OK
;
}
static
HRESULT
interp_ret
(
exec_ctx_t
*
ctx
)
{
TRACE
(
"
\n
"
);
...
...
dlls/vbscript/parse.h
View file @
223a407a
...
...
@@ -101,6 +101,7 @@ typedef enum {
STAT_IF
,
STAT_SET
,
STAT_STOP
,
STAT_UNTIL
,
STAT_WHILE
,
STAT_WHILELOOP
}
statement_type_t
;
...
...
dlls/vbscript/parser.y
View file @
223a407a
...
...
@@ -114,7 +114,7 @@ static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,u
%type <expression> NotExpression UnaryExpression AndExpression OrExpression XorExpression EqvExpression
%type <member> MemberExpression
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
%type <bool> OptionExplicit_opt
%type <bool> OptionExplicit_opt
DoType
%type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl
%type <func_decl> FunctionDecl PropertyDecl
%type <elseif> ElseIfs_opt ElseIfs ElseIf
...
...
@@ -156,8 +156,9 @@ Statement
| IfStatement { $$ = $1; }
| tWHILE Expression tNL StatementsNl_opt tWEND
{ $$ = new_while_statement(ctx, STAT_WHILE, $2, $4); CHECK_ERROR; }
| tDO tWHILE Expression tNL StatementsNl_opt tLOOP
{ $$ = new_while_statement(ctx, STAT_WHILELOOP, $3, $5); CHECK_ERROR; }
| tDO DoType Expression tNL StatementsNl_opt tLOOP
{ $$ = new_while_statement(ctx, $2 ? STAT_WHILELOOP : STAT_UNTIL, $3, $5);
CHECK_ERROR; }
| FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; }
| tEXIT tDO { $$ = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; }
| tEXIT tFUNCTION { $$ = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; }
...
...
@@ -175,6 +176,10 @@ DimDeclList /* FIXME: Support arrays */
: tIdentifier { $$ = new_dim_decl(ctx, $1, NULL); CHECK_ERROR; }
| tIdentifier ',' DimDeclList { $$ = new_dim_decl(ctx, $1, $3); CHECK_ERROR; }
DoType
: tWHILE { $$ = TRUE; }
| tUNTIL { $$ = FALSE; }
IfStatement
: tIF Expression tTHEN tNL StatementsNl ElseIfs_opt Else_opt tEND tIF
{ $$ = new_if_statement(ctx, $2, $5, $6, $7); CHECK_ERROR; }
...
...
dlls/vbscript/tests/lang.vbs
View file @
223a407a
...
...
@@ -230,6 +230,24 @@ do while true
ok
false
,
"exit do didn't work"
loop
x
=
false
y
=
false
do
until
x
and
y
if
x
then
y
=
true
end
if
x
=
true
loop
call
ok
((
x
and
y
),
"x or y is false after do until"
)
do
until
true
loop
do
until
false
exit
do
ok
false
,
"exit do didn't work"
loop
if
false
then
Sub
testsub
x
=
true
...
...
dlls/vbscript/vbscript.h
View file @
223a407a
...
...
@@ -167,6 +167,7 @@ typedef enum {
X(imp, 1, 0, 0) \
X(jmp, 0, ARG_ADDR, 0) \
X(jmp_false, 0, ARG_ADDR, 0) \
X(jmp_true, 0, ARG_ADDR, 0) \
X(long, 1, ARG_INT, 0) \
X(mcall, 1, ARG_BSTR, ARG_UINT) \
X(mcallv, 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