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
060255d0
Commit
060255d0
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: Store call identifier as BSTR.
parent
f720ccdc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
Makefile.in
dlls/vbscript/Makefile.in
+1
-0
compile.c
dlls/vbscript/compile.c
+44
-3
vbscript.h
dlls/vbscript/vbscript.h
+8
-2
No files found.
dlls/vbscript/Makefile.in
View file @
060255d0
MODULE
=
vbscript.dll
IMPORTS
=
oleaut32
C_SRCS
=
\
compile.c
\
...
...
dlls/vbscript/compile.c
View file @
060255d0
...
...
@@ -59,15 +59,45 @@ static unsigned push_instr(compile_ctx_t *ctx, vbsop_t op)
return
ctx
->
instr_cnt
++
;
}
static
HRESULT
push_instr_str
(
compile_ctx_t
*
ctx
,
vbsop_t
op
,
const
WCHAR
*
arg
)
static
BSTR
alloc_bstr_arg
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
str
)
{
if
(
!
ctx
->
code
->
bstr_pool_size
)
{
ctx
->
code
->
bstr_pool
=
heap_alloc
(
8
*
sizeof
(
BSTR
));
if
(
!
ctx
->
code
->
bstr_pool
)
return
NULL
;
ctx
->
code
->
bstr_pool_size
=
8
;
}
else
if
(
ctx
->
code
->
bstr_pool_size
==
ctx
->
code
->
bstr_cnt
)
{
BSTR
*
new_pool
;
new_pool
=
heap_realloc
(
ctx
->
code
->
bstr_pool
,
ctx
->
code
->
bstr_pool_size
*
2
*
sizeof
(
BSTR
));
if
(
!
new_pool
)
return
NULL
;
ctx
->
code
->
bstr_pool
=
new_pool
;
ctx
->
code
->
bstr_pool_size
*=
2
;
}
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
]
=
SysAllocString
(
str
);
if
(
!
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
])
return
NULL
;
return
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
++
];
}
static
HRESULT
push_instr_bstr
(
compile_ctx_t
*
ctx
,
vbsop_t
op
,
const
WCHAR
*
arg
)
{
unsigned
instr
;
BSTR
bstr
;
bstr
=
alloc_bstr_arg
(
ctx
,
arg
);
if
(
!
bstr
)
return
E_OUTOFMEMORY
;
instr
=
push_instr
(
ctx
,
op
);
if
(
instr
==
-
1
)
return
E_OUTOFMEMORY
;
instr_ptr
(
ctx
,
instr
)
->
arg1
.
str
=
arg
;
instr_ptr
(
ctx
,
instr
)
->
arg1
.
bstr
=
bstr
;
return
S_OK
;
}
...
...
@@ -84,7 +114,7 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
FIXME
(
"obj_expr not implemented
\n
"
);
hres
=
E_NOTIMPL
;
}
else
{
hres
=
push_instr_str
(
ctx
,
OP_icallv
,
expr
->
identifier
);
hres
=
push_instr_
b
str
(
ctx
,
OP_icallv
,
expr
->
identifier
);
}
return
hres
;
...
...
@@ -130,7 +160,14 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
void
release_vbscode
(
vbscode_t
*
code
)
{
unsigned
i
;
list_remove
(
&
code
->
entry
);
for
(
i
=
0
;
i
<
code
->
bstr_cnt
;
i
++
)
SysFreeString
(
code
->
bstr_pool
[
i
]);
heap_free
(
code
->
bstr_pool
);
heap_free
(
code
->
source
);
heap_free
(
code
->
instrs
);
heap_free
(
code
);
...
...
@@ -159,6 +196,10 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
ctx
->
instr_cnt
=
0
;
ctx
->
instr_size
=
32
;
ret
->
bstr_pool
=
NULL
;
ret
->
bstr_pool_size
=
0
;
ret
->
bstr_cnt
=
0
;
ret
->
global_code
.
code_ctx
=
ret
;
list_init
(
&
ret
->
entry
);
...
...
dlls/vbscript/vbscript.h
View file @
060255d0
...
...
@@ -64,11 +64,12 @@ HRESULT init_global(script_ctx_t*);
typedef
enum
{
ARG_NONE
=
0
,
ARG_STR
ARG_STR
,
ARG_BSTR
}
instr_arg_type_t
;
#define OP_LIST \
X(icallv, 1, ARG_
STR,
0) \
X(icallv, 1, ARG_
BSTR,
0) \
X(ret, 0, 0, 0)
typedef
enum
{
...
...
@@ -80,6 +81,7 @@ OP_LIST
typedef
union
{
const
WCHAR
*
str
;
BSTR
bstr
;
}
instr_arg_t
;
typedef
struct
{
...
...
@@ -100,6 +102,10 @@ struct _vbscode_t {
BOOL
global_executed
;
function_t
global_code
;
BSTR
*
bstr_pool
;
unsigned
bstr_pool_size
;
unsigned
bstr_cnt
;
struct
list
entry
;
};
...
...
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