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
23c1fea0
Commit
23c1fea0
authored
Sep 08, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added compiler support for boolean literals.
parent
dc73a7c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
9 deletions
+72
-9
compile.c
dlls/vbscript/compile.c
+53
-7
interp.c
dlls/vbscript/interp.c
+12
-0
vbscript.h
dlls/vbscript/vbscript.h
+7
-2
No files found.
dlls/vbscript/compile.c
View file @
23c1fea0
...
...
@@ -34,6 +34,8 @@ typedef struct {
vbscode_t
*
code
;
}
compile_ctx_t
;
static
HRESULT
compile_expression
(
compile_ctx_t
*
,
expression_t
*
);
static
inline
instr_t
*
instr_ptr
(
compile_ctx_t
*
ctx
,
unsigned
id
)
{
assert
(
id
<
ctx
->
instr_cnt
);
...
...
@@ -59,6 +61,18 @@ static unsigned push_instr(compile_ctx_t *ctx, vbsop_t op)
return
ctx
->
instr_cnt
++
;
}
static
HRESULT
push_instr_int
(
compile_ctx_t
*
ctx
,
vbsop_t
op
,
LONG
arg
)
{
unsigned
ret
;
ret
=
push_instr
(
ctx
,
op
);
if
(
ret
==
-
1
)
return
E_OUTOFMEMORY
;
instr_ptr
(
ctx
,
ret
)
->
arg1
.
lng
=
arg
;
return
S_OK
;
}
static
BSTR
alloc_bstr_arg
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
str
)
{
if
(
!
ctx
->
code
->
bstr_pool_size
)
{
...
...
@@ -84,12 +98,12 @@ static BSTR alloc_bstr_arg(compile_ctx_t *ctx, const WCHAR *str)
return
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
++
];
}
static
HRESULT
push_instr_bstr
(
compile_ctx_t
*
ctx
,
vbsop_t
op
,
const
WCHAR
*
arg
)
static
HRESULT
push_instr_bstr
_uint
(
compile_ctx_t
*
ctx
,
vbsop_t
op
,
const
WCHAR
*
arg1
,
unsigned
arg2
)
{
unsigned
instr
;
BSTR
bstr
;
bstr
=
alloc_bstr_arg
(
ctx
,
arg
);
bstr
=
alloc_bstr_arg
(
ctx
,
arg
1
);
if
(
!
bstr
)
return
E_OUTOFMEMORY
;
...
...
@@ -98,28 +112,60 @@ static HRESULT push_instr_bstr(compile_ctx_t *ctx, vbsop_t op, const WCHAR *arg)
return
E_OUTOFMEMORY
;
instr_ptr
(
ctx
,
instr
)
->
arg1
.
bstr
=
bstr
;
instr_ptr
(
ctx
,
instr
)
->
arg2
.
uint
=
arg2
;
return
S_OK
;
}
static
HRESULT
compile_
member_expression
(
compile_ctx_t
*
ctx
,
member_expression_t
*
expr
)
static
HRESULT
compile_
args
(
compile_ctx_t
*
ctx
,
expression_t
*
args
,
unsigned
*
ret
)
{
unsigned
arg_cnt
=
0
;
HRESULT
hres
;
if
(
expr
->
args
)
{
FIXME
(
"arguments not implemented
\n
"
);
return
E_NOTIMPL
;
while
(
args
)
{
hres
=
compile_expression
(
ctx
,
args
);
if
(
FAILED
(
hres
))
return
hres
;
arg_cnt
++
;
args
=
args
->
next
;
}
*
ret
=
arg_cnt
;
return
S_OK
;
}
static
HRESULT
compile_member_expression
(
compile_ctx_t
*
ctx
,
member_expression_t
*
expr
)
{
unsigned
arg_cnt
=
0
;
HRESULT
hres
;
hres
=
compile_args
(
ctx
,
expr
->
args
,
&
arg_cnt
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
expr
->
obj_expr
)
{
FIXME
(
"obj_expr not implemented
\n
"
);
hres
=
E_NOTIMPL
;
}
else
{
hres
=
push_instr_bstr
(
ctx
,
OP_icallv
,
expr
->
identifier
);
hres
=
push_instr_bstr
_uint
(
ctx
,
OP_icallv
,
expr
->
identifier
,
arg_cnt
);
}
return
hres
;
}
static
HRESULT
compile_expression
(
compile_ctx_t
*
ctx
,
expression_t
*
expr
)
{
switch
(
expr
->
type
)
{
case
EXPR_BOOL
:
return
push_instr_int
(
ctx
,
OP_bool
,
((
bool_expression_t
*
)
expr
)
->
value
);
default:
FIXME
(
"Unimplemented expression type %d
\n
"
,
expr
->
type
);
return
E_NOTIMPL
;
}
return
S_OK
;
}
static
HRESULT
compile_statement
(
compile_ctx_t
*
ctx
,
statement_t
*
stat
)
{
HRESULT
hres
;
...
...
dlls/vbscript/interp.c
View file @
23c1fea0
...
...
@@ -75,12 +75,18 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, ref_t *ref)
static
HRESULT
interp_icallv
(
exec_ctx_t
*
ctx
)
{
BSTR
identifier
=
ctx
->
instr
->
arg1
.
bstr
;
const
unsigned
arg_cnt
=
ctx
->
instr
->
arg2
.
uint
;
DISPPARAMS
dp
=
{
0
};
ref_t
ref
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
arg_cnt
)
{
FIXME
(
"arguments not implemented
\n
"
);
return
E_NOTIMPL
;
}
hres
=
lookup_identifier
(
ctx
,
identifier
,
&
ref
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -107,6 +113,12 @@ static HRESULT interp_ret(exec_ctx_t *ctx)
return
S_OK
;
}
static
HRESULT
interp_bool
(
exec_ctx_t
*
ctx
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
const
instr_func_t
op_funcs
[]
=
{
#define X(x,n,a,b) interp_ ## x,
OP_LIST
...
...
dlls/vbscript/vbscript.h
View file @
23c1fea0
...
...
@@ -69,11 +69,14 @@ HRESULT init_global(script_ctx_t*);
typedef
enum
{
ARG_NONE
=
0
,
ARG_STR
,
ARG_BSTR
ARG_BSTR
,
ARG_INT
,
ARG_UINT
}
instr_arg_type_t
;
#define OP_LIST \
X(icallv, 1, ARG_BSTR, 0) \
X(bool, 1, ARG_INT, 0) \
X(icallv, 1, ARG_BSTR, ARG_UINT) \
X(ret, 0, 0, 0)
typedef
enum
{
...
...
@@ -86,6 +89,8 @@ OP_LIST
typedef
union
{
const
WCHAR
*
str
;
BSTR
bstr
;
unsigned
uint
;
LONG
lng
;
}
instr_arg_t
;
typedef
struct
{
...
...
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