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
8906a4aa
Commit
8906a4aa
authored
Sep 07, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added beginning interpreter implementation.
parent
c674c7a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
5 deletions
+108
-5
Makefile.in
dlls/vbscript/Makefile.in
+1
-0
interp.c
dlls/vbscript/interp.c
+77
-0
vbscript.c
dlls/vbscript/vbscript.c
+29
-5
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/Makefile.in
View file @
8906a4aa
...
...
@@ -2,6 +2,7 @@ MODULE = vbscript.dll
C_SRCS
=
\
compile.c
\
interp.c
\
lex.c
\
vbdisp.c
\
vbscript.c
\
...
...
dlls/vbscript/interp.c
0 → 100644
View file @
8906a4aa
/*
* Copyright 2011 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "vbscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
vbscript
);
typedef
struct
{
vbscode_t
*
code
;
instr_t
*
instr
;
}
exec_ctx_t
;
typedef
HRESULT
(
*
instr_func_t
)(
exec_ctx_t
*
);
static
HRESULT
interp_ret
(
exec_ctx_t
*
ctx
)
{
TRACE
(
"
\n
"
);
ctx
->
instr
=
NULL
;
return
S_OK
;
}
static
const
instr_func_t
op_funcs
[]
=
{
#define X(x,n) interp_ ## x,
OP_LIST
#undef X
};
static
const
unsigned
op_move
[]
=
{
#define X(x,n) n,
OP_LIST
#undef X
};
HRESULT
exec_script
(
script_ctx_t
*
ctx
,
function_t
*
func
)
{
exec_ctx_t
exec
;
vbsop_t
op
;
HRESULT
hres
=
S_OK
;
exec
.
code
=
func
->
code_ctx
;
exec
.
instr
=
exec
.
code
->
instrs
+
func
->
code_off
;
while
(
exec
.
instr
)
{
op
=
exec
.
instr
->
op
;
hres
=
op_funcs
[
op
](
&
exec
);
if
(
FAILED
(
hres
))
{
FIXME
(
"Failed %08x
\n
"
,
hres
);
break
;
}
exec
.
instr
+=
op_move
[
op
];
}
return
hres
;
}
dlls/vbscript/vbscript.c
View file @
8906a4aa
...
...
@@ -63,9 +63,34 @@ static void change_state(VBScript *This, SCRIPTSTATE state)
IActiveScriptSite_OnStateChange
(
This
->
site
,
state
);
}
static
void
exec_queued_code
(
VBScript
*
This
)
static
inline
BOOL
is_started
(
VBScript
*
This
)
{
FIXME
(
"
\n
"
);
return
This
->
state
==
SCRIPTSTATE_STARTED
||
This
->
state
==
SCRIPTSTATE_CONNECTED
||
This
->
state
==
SCRIPTSTATE_DISCONNECTED
;
}
static
HRESULT
exec_global_code
(
script_ctx_t
*
ctx
,
vbscode_t
*
code
)
{
HRESULT
hres
;
code
->
global_executed
=
TRUE
;
IActiveScriptSite_OnEnterScript
(
ctx
->
site
);
hres
=
exec_script
(
ctx
,
&
code
->
global_code
);
IActiveScriptSite_OnLeaveScript
(
ctx
->
site
);
return
hres
;
}
static
void
exec_queued_code
(
script_ctx_t
*
ctx
)
{
vbscode_t
*
iter
;
LIST_FOR_EACH_ENTRY
(
iter
,
&
ctx
->
code_list
,
vbscode_t
,
entry
)
{
if
(
!
iter
->
global_executed
)
exec_global_code
(
ctx
,
iter
);
}
}
static
HRESULT
set_ctx_site
(
VBScript
*
This
)
...
...
@@ -264,7 +289,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE
if
(
This
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
exec_queued_code
(
This
);
exec_queued_code
(
This
->
ctx
);
break
;
case
SCRIPTSTATE_INITIALIZED
:
FIXME
(
"unimplemented SCRIPTSTATE_INITIALIZED
\n
"
);
...
...
@@ -530,8 +555,7 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface,
if
(
FAILED
(
hres
))
return
hres
;
FIXME
(
"executing script not implemented
\n
"
);
return
E_NOTIMPL
;
return
is_started
(
This
)
?
exec_global_code
(
This
->
ctx
,
code
)
:
S_OK
;
}
static
const
IActiveScriptParseVtbl
VBScriptParseVtbl
=
{
...
...
dlls/vbscript/vbscript.h
View file @
8906a4aa
...
...
@@ -93,6 +93,7 @@ struct _vbscode_t {
void
release_vbscode
(
vbscode_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
compile_script
(
script_ctx_t
*
,
const
WCHAR
*
,
vbscode_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
exec_script
(
script_ctx_t
*
,
function_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
VBScriptFactory_CreateInstance
(
IClassFactory
*
,
IUnknown
*
,
REFIID
,
void
**
);
...
...
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