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
bf650032
Commit
bf650032
authored
Oct 04, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 04, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added support for pstrFormalParams argument in ParseProcedureText.
parent
1d542e3a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
12 deletions
+117
-12
compile.c
dlls/jscript/compile.c
+101
-5
engine.h
dlls/jscript/engine.h
+1
-1
function.c
dlls/jscript/function.c
+1
-1
global.c
dlls/jscript/global.c
+1
-1
jscript.c
dlls/jscript/jscript.c
+2
-2
run.c
dlls/jscript/tests/run.c
+11
-0
activex.c
dlls/mshtml/tests/activex.c
+0
-2
No files found.
dlls/jscript/compile.c
View file @
bf650032
...
...
@@ -131,24 +131,32 @@ static WCHAR *compiler_alloc_string(bytecode_t *code, const WCHAR *str)
return
ret
;
}
static
B
STR
compiler_alloc_bstr
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
)
static
B
OOL
ensure_bstr_slot
(
compiler_ctx_t
*
ctx
)
{
if
(
!
ctx
->
code
->
bstr_pool_size
)
{
ctx
->
code
->
bstr_pool
=
heap_alloc
(
8
*
sizeof
(
BSTR
));
if
(
!
ctx
->
code
->
bstr_pool
)
return
NULL
;
return
FALSE
;
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
;
return
FALSE
;
ctx
->
code
->
bstr_pool
=
new_pool
;
ctx
->
code
->
bstr_pool_size
*=
2
;
}
return
TRUE
;
}
static
BSTR
compiler_alloc_bstr
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
)
{
if
(
!
ensure_bstr_slot
(
ctx
))
return
NULL
;
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
]
=
SysAllocString
(
str
);
if
(
!
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
])
return
NULL
;
...
...
@@ -156,6 +164,18 @@ static BSTR compiler_alloc_bstr(compiler_ctx_t *ctx, const WCHAR *str)
return
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
++
];
}
static
BSTR
compiler_alloc_bstr_len
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
,
size_t
len
)
{
if
(
!
ensure_bstr_slot
(
ctx
))
return
NULL
;
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
]
=
SysAllocStringLen
(
str
,
len
);
if
(
!
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
])
return
NULL
;
return
ctx
->
code
->
bstr_pool
[
ctx
->
code
->
bstr_cnt
++
];
}
static
unsigned
push_instr
(
compiler_ctx_t
*
ctx
,
jsop_t
op
)
{
assert
(
ctx
->
code_size
>=
ctx
->
code_off
);
...
...
@@ -1885,8 +1905,78 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
return
S_OK
;
}
HRESULT
compile_script
(
script_ctx_t
*
ctx
,
const
WCHAR
*
code
,
const
WCHAR
*
delimiter
,
BOOL
from_eval
,
BOOL
use_decode
,
bytecode_t
**
ret
)
static
HRESULT
parse_arguments
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
args
,
BSTR
*
arg_array
,
unsigned
*
args_size
)
{
const
WCHAR
*
ptr
=
args
,
*
ptr2
;
unsigned
arg_cnt
=
0
;
while
(
isspaceW
(
*
ptr
))
ptr
++
;
if
(
!*
ptr
)
{
if
(
args_size
)
*
args_size
=
0
;
return
S_OK
;
}
while
(
1
)
{
if
(
!
isalphaW
(
*
ptr
)
&&
*
ptr
!=
'_'
)
{
FIXME
(
"expected alpha or '_': %s
\n
"
,
debugstr_w
(
ptr
));
return
E_FAIL
;
}
ptr2
=
ptr
;
while
(
isalnumW
(
*
ptr
)
||
*
ptr
==
'_'
)
ptr
++
;
if
(
*
ptr
&&
*
ptr
!=
','
&&
!
isspaceW
(
*
ptr
))
{
FIXME
(
"unexpected har %s
\n
"
,
debugstr_w
(
ptr
));
return
E_FAIL
;
}
if
(
arg_array
)
{
arg_array
[
arg_cnt
]
=
compiler_alloc_bstr_len
(
ctx
,
ptr2
,
ptr
-
ptr2
);
if
(
!
arg_array
[
arg_cnt
])
return
E_OUTOFMEMORY
;
}
arg_cnt
++
;
while
(
isspaceW
(
*
ptr
))
ptr
++
;
if
(
!*
ptr
)
break
;
if
(
*
ptr
!=
','
)
{
FIXME
(
"expected ',': %s
\n
"
,
debugstr_w
(
ptr
));
return
E_FAIL
;
}
ptr
++
;
while
(
isspaceW
(
*
ptr
))
ptr
++
;
}
if
(
args_size
)
*
args_size
=
arg_cnt
;
return
S_OK
;
}
static
HRESULT
compile_arguments
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
args
)
{
HRESULT
hres
;
hres
=
parse_arguments
(
ctx
,
args
,
NULL
,
&
ctx
->
code
->
global_code
.
param_cnt
);
if
(
FAILED
(
hres
))
return
hres
;
ctx
->
code
->
global_code
.
params
=
compiler_alloc
(
ctx
->
code
,
ctx
->
code
->
global_code
.
param_cnt
*
sizeof
(
*
ctx
->
code
->
global_code
.
params
));
if
(
!
ctx
->
code
->
global_code
.
params
)
return
E_OUTOFMEMORY
;
return
parse_arguments
(
ctx
,
args
,
ctx
->
code
->
global_code
.
params
,
NULL
);
}
HRESULT
compile_script
(
script_ctx_t
*
ctx
,
const
WCHAR
*
code
,
const
WCHAR
*
args
,
const
WCHAR
*
delimiter
,
BOOL
from_eval
,
BOOL
use_decode
,
bytecode_t
**
ret
)
{
compiler_ctx_t
compiler
=
{
0
};
HRESULT
hres
;
...
...
@@ -1895,6 +1985,12 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimi
if
(
FAILED
(
hres
))
return
hres
;
if
(
args
)
{
hres
=
compile_arguments
(
&
compiler
,
args
);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
use_decode
)
{
hres
=
decode_source
(
compiler
.
code
->
source
);
if
(
FAILED
(
hres
))
{
...
...
dlls/jscript/engine.h
View file @
bf650032
...
...
@@ -178,7 +178,7 @@ typedef struct _bytecode_t {
struct
_bytecode_t
*
next
;
}
bytecode_t
;
HRESULT
compile_script
(
script_ctx_t
*
,
const
WCHAR
*
,
const
WCHAR
*
,
BOOL
,
BOOL
,
bytecode_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
compile_script
(
script_ctx_t
*
,
const
WCHAR
*
,
const
WCHAR
*
,
const
WCHAR
*
,
BOOL
,
BOOL
,
bytecode_t
**
)
DECLSPEC_HIDDEN
;
void
release_bytecode
(
bytecode_t
*
)
DECLSPEC_HIDDEN
;
static
inline
void
bytecode_addref
(
bytecode_t
*
code
)
...
...
dlls/jscript/function.c
View file @
bf650032
...
...
@@ -750,7 +750,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
if
(
FAILED
(
hres
))
return
hres
;
hres
=
compile_script
(
ctx
,
str
,
NULL
,
FALSE
,
FALSE
,
&
code
);
hres
=
compile_script
(
ctx
,
str
,
NULL
,
NULL
,
FALSE
,
FALSE
,
&
code
);
heap_free
(
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/global.c
View file @
bf650032
...
...
@@ -370,7 +370,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
TRACE
(
"parsing %s
\n
"
,
debugstr_jsval
(
argv
[
0
]));
hres
=
compile_script
(
ctx
,
get_string
(
argv
[
0
]),
NULL
,
TRUE
,
FALSE
,
&
code
);
hres
=
compile_script
(
ctx
,
get_string
(
argv
[
0
]),
NULL
,
NULL
,
TRUE
,
FALSE
,
&
code
);
if
(
FAILED
(
hres
))
{
WARN
(
"parse (%s) failed: %08x
\n
"
,
debugstr_jsval
(
argv
[
0
]),
hres
);
return
throw_syntax_error
(
ctx
,
hres
,
NULL
);
...
...
dlls/jscript/jscript.c
View file @
bf650032
...
...
@@ -763,7 +763,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
This
->
ctx
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
hres
=
compile_script
(
This
->
ctx
,
pstrCode
,
pstrDelimiter
,
FALSE
,
This
->
is_encode
,
&
code
);
hres
=
compile_script
(
This
->
ctx
,
pstrCode
,
NULL
,
pstrDelimiter
,
FALSE
,
This
->
is_encode
,
&
code
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -830,7 +830,7 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
This
->
ctx
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
hres
=
compile_script
(
This
->
ctx
,
pstrCode
,
pstrDelimiter
,
FALSE
,
This
->
is_encode
,
&
code
);
hres
=
compile_script
(
This
->
ctx
,
pstrCode
,
pstr
FormalParams
,
pstr
Delimiter
,
FALSE
,
This
->
is_encode
,
&
code
);
if
(
FAILED
(
hres
))
{
WARN
(
"Parse failed %08x
\n
"
,
hres
);
return
hres
;
...
...
dlls/jscript/tests/run.c
View file @
bf650032
...
...
@@ -1927,6 +1927,17 @@ static void test_parse_proc(void)
dp
.
cArgs
=
1
;
V_VT
(
args
)
=
VT_EMPTY
;
invoke_procedure
(
NULL
,
"return arguments.length == 1;"
,
&
dp
);
V_VT
(
args
)
=
VT_BOOL
;
V_BOOL
(
args
)
=
VARIANT_TRUE
;
invoke_procedure
(
" x "
,
"return x;"
,
&
dp
);
dp
.
cArgs
=
2
;
V_VT
(
args
)
=
VT_I4
;
V_I4
(
args
)
=
2
;
V_VT
(
args
+
1
)
=
VT_I4
;
V_I4
(
args
+
1
)
=
1
;
invoke_procedure
(
" _x1 , y_2"
,
"return _x1 === 1 && y_2 === 2;"
,
&
dp
);
}
static
void
run_encoded_tests
(
void
)
...
...
dlls/mshtml/tests/activex.c
View file @
bf650032
...
...
@@ -2355,10 +2355,8 @@ static void test_event_call(void)
dp
.
cArgs
=
2
;
V_VT
(
&
res
)
=
VT_EMPTY
;
hres
=
IDispatch_Invoke
(
sink_disp
,
2
,
&
IID_NULL
,
0
,
DISPATCH_METHOD
,
&
dp
,
&
res
,
&
ei
,
NULL
);
todo_wine
{
/* Needs jscript fixes */
ok
(
hres
==
S_OK
,
"Invoke failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
res
)
==
VT_I4
&&
V_I4
(
&
res
)
==
7
,
"unexpected result: %d
\n
"
,
V_I4
(
&
res
));
}
V_VT
(
&
res
)
=
VT_ERROR
;
hres
=
IDispatch_Invoke
(
sink_disp
,
10
,
&
IID_NULL
,
0
,
DISPATCH_METHOD
,
&
dp
,
&
res
,
&
ei
,
NULL
);
...
...
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