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
6f5475dd
Commit
6f5475dd
authored
Sep 18, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Store exception value in script_ctx_t instead of passing it everywhere.
parent
19f951e8
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
886 additions
and
909 deletions
+886
-909
activex.c
dlls/jscript/activex.c
+3
-3
array.c
dlls/jscript/array.c
+95
-96
bool.c
dlls/jscript/bool.c
+7
-9
date.c
dlls/jscript/date.c
+159
-164
dispex.c
dlls/jscript/dispex.c
+53
-61
engine.c
dlls/jscript/engine.c
+94
-87
engine.h
dlls/jscript/engine.h
+1
-1
error.c
dlls/jscript/error.c
+48
-48
function.c
dlls/jscript/function.c
+51
-57
global.c
dlls/jscript/global.c
+76
-77
jscript.c
dlls/jscript/jscript.c
+4
-4
jscript.h
dlls/jscript/jscript.h
+40
-38
jsutils.c
dlls/jscript/jsutils.c
+23
-27
math.c
dlls/jscript/math.c
+39
-39
number.c
dlls/jscript/number.c
+28
-28
object.c
dlls/jscript/object.c
+11
-11
regexp.c
dlls/jscript/regexp.c
+34
-37
string.c
dlls/jscript/string.c
+98
-100
vbarray.c
dlls/jscript/vbarray.c
+22
-22
No files found.
dlls/jscript/activex.c
View file @
6f5475dd
...
...
@@ -139,7 +139,7 @@ static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid)
}
static
HRESULT
ActiveXObject_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
IDispatch
*
disp
;
IUnknown
*
obj
;
...
...
@@ -164,14 +164,14 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
E_NOTIMPL
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
progid
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
progid
);
if
(
FAILED
(
hres
))
return
hres
;
obj
=
create_activex_object
(
ctx
,
progid
);
SysFreeString
(
progid
);
if
(
!
obj
)
return
throw_generic_error
(
ctx
,
ei
,
JS_E_CANNOT_CREATE_OBJ
,
NULL
);
return
throw_generic_error
(
ctx
,
JS_E_CANNOT_CREATE_OBJ
,
NULL
);
hres
=
IUnknown_QueryInterface
(
obj
,
&
IID_IDispatch
,
(
void
**
)
&
disp
);
IUnknown_Release
(
obj
);
...
...
dlls/jscript/array.c
View file @
6f5475dd
...
...
@@ -59,7 +59,7 @@ static inline ArrayInstance *array_this(vdisp_t *jsthis)
return
is_vclass
(
jsthis
,
JSCLASS_ARRAY
)
?
array_from_vdisp
(
jsthis
)
:
NULL
;
}
static
HRESULT
get_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
vdisp
,
js
except_t
*
ei
,
js
disp_t
**
jsthis
,
DWORD
*
ret
)
static
HRESULT
get_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
vdisp
,
jsdisp_t
**
jsthis
,
DWORD
*
ret
)
{
ArrayInstance
*
array
;
jsval_t
val
;
...
...
@@ -73,13 +73,13 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd
}
if
(
!
is_jsdisp
(
vdisp
))
return
throw_type_error
(
ctx
,
ei
,
JS_E_JSCRIPT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_JSCRIPT_EXPECTED
,
NULL
);
hres
=
jsdisp_propget_name
(
vdisp
->
u
.
jsdisp
,
lengthW
,
&
val
,
ei
);
hres
=
jsdisp_propget_name
(
vdisp
->
u
.
jsdisp
,
lengthW
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_uint32
(
ctx
,
val
,
ei
,
ret
);
hres
=
to_uint32
(
ctx
,
val
,
ret
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -88,14 +88,14 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd
return
S_OK
;
}
static
HRESULT
set_length
(
jsdisp_t
*
obj
,
jsexcept_t
*
ei
,
DWORD
length
)
static
HRESULT
set_length
(
jsdisp_t
*
obj
,
DWORD
length
)
{
if
(
is_class
(
obj
,
JSCLASS_ARRAY
))
{
((
ArrayInstance
*
)
obj
)
->
length
=
length
;
return
S_OK
;
}
return
jsdisp_propput_name
(
obj
,
lengthW
,
jsval_number
(
length
)
,
ei
);
return
jsdisp_propput_name
(
obj
,
lengthW
,
jsval_number
(
length
));
}
static
WCHAR
*
idx_to_str
(
DWORD
idx
,
WCHAR
*
ptr
)
...
...
@@ -114,7 +114,7 @@ static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr)
}
static
HRESULT
Array_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
ArrayInstance
*
This
=
array_from_vdisp
(
jsthis
);
...
...
@@ -129,13 +129,13 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
DWORD
i
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
len
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
len
);
if
(
FAILED
(
hres
))
return
hres
;
len
=
floor
(
len
);
if
(
len
!=
(
DWORD
)
len
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_INVALID_LENGTH
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_INVALID_LENGTH
,
NULL
);
for
(
i
=
len
;
i
<
This
->
length
;
i
++
)
{
hres
=
jsdisp_delete_idx
(
&
This
->
dispex
,
i
);
...
...
@@ -154,20 +154,20 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
return
S_OK
;
}
static
HRESULT
concat_array
(
jsdisp_t
*
array
,
ArrayInstance
*
obj
,
DWORD
*
len
,
jsexcept_t
*
ei
)
static
HRESULT
concat_array
(
jsdisp_t
*
array
,
ArrayInstance
*
obj
,
DWORD
*
len
)
{
jsval_t
val
;
DWORD
i
;
HRESULT
hres
;
for
(
i
=
0
;
i
<
obj
->
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
&
obj
->
dispex
,
i
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
&
obj
->
dispex
,
i
,
&
val
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
continue
;
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_idx
(
array
,
*
len
+
i
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
*
len
+
i
,
val
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -177,7 +177,7 @@ static HRESULT concat_array(jsdisp_t *array, ArrayInstance *obj, DWORD *len, jse
return
S_OK
;
}
static
HRESULT
concat_obj
(
jsdisp_t
*
array
,
IDispatch
*
obj
,
DWORD
*
len
,
jsexcept_t
*
ei
)
static
HRESULT
concat_obj
(
jsdisp_t
*
array
,
IDispatch
*
obj
,
DWORD
*
len
)
{
jsdisp_t
*
jsobj
;
HRESULT
hres
;
...
...
@@ -185,18 +185,18 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len, jsexcept_
jsobj
=
iface_to_jsdisp
((
IUnknown
*
)
obj
);
if
(
jsobj
)
{
if
(
is_class
(
jsobj
,
JSCLASS_ARRAY
))
{
hres
=
concat_array
(
array
,
(
ArrayInstance
*
)
jsobj
,
len
,
ei
);
hres
=
concat_array
(
array
,
(
ArrayInstance
*
)
jsobj
,
len
);
jsdisp_release
(
jsobj
);
return
hres
;
}
jsdisp_release
(
jsobj
);
}
return
jsdisp_propput_idx
(
array
,
(
*
len
)
++
,
jsval_disp
(
obj
)
,
ei
);
return
jsdisp_propput_idx
(
array
,
(
*
len
)
++
,
jsval_disp
(
obj
));
}
static
HRESULT
Array_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
ret
;
DWORD
len
=
0
;
...
...
@@ -208,15 +208,15 @@ static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
FAILED
(
hres
))
return
hres
;
hres
=
concat_obj
(
ret
,
jsthis
->
u
.
disp
,
&
len
,
ei
);
hres
=
concat_obj
(
ret
,
jsthis
->
u
.
disp
,
&
len
);
if
(
SUCCEEDED
(
hres
))
{
DWORD
i
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
is_object_instance
(
argv
[
i
]))
hres
=
concat_obj
(
ret
,
get_object
(
argv
[
i
]),
&
len
,
ei
);
hres
=
concat_obj
(
ret
,
get_object
(
argv
[
i
]),
&
len
);
else
hres
=
jsdisp_propput_idx
(
ret
,
len
++
,
argv
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
ret
,
len
++
,
argv
[
i
]);
if
(
FAILED
(
hres
))
break
;
}
...
...
@@ -232,7 +232,7 @@ static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
return
S_OK
;
}
static
HRESULT
array_join
(
script_ctx_t
*
ctx
,
jsdisp_t
*
array
,
DWORD
length
,
const
WCHAR
*
sep
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
array_join
(
script_ctx_t
*
ctx
,
jsdisp_t
*
array
,
DWORD
length
,
const
WCHAR
*
sep
,
jsval_t
*
r
)
{
BSTR
*
str_tab
,
ret
=
NULL
;
jsval_t
val
;
...
...
@@ -254,7 +254,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
array
,
i
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
array
,
i
,
&
val
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
S_OK
;
continue
;
...
...
@@ -262,7 +262,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
break
;
if
(
!
is_undefined
(
val
)
&&
!
is_null
(
val
))
{
hres
=
to_string
(
ctx
,
val
,
ei
,
str_tab
+
i
);
hres
=
to_string
(
ctx
,
val
,
str_tab
+
i
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -333,7 +333,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
/* ECMA-262 3rd Edition 15.4.4.5 */
static
HRESULT
Array_join
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
DWORD
length
;
...
...
@@ -341,29 +341,29 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
)
{
BSTR
sep
;
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
sep
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
sep
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
array_join
(
ctx
,
jsthis
,
length
,
sep
,
r
,
ei
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
sep
,
r
);
SysFreeString
(
sep
);
}
else
{
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
r
,
ei
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
r
);
}
return
hres
;
}
static
HRESULT
Array_pop
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
jsval_t
val
;
...
...
@@ -372,12 +372,12 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
length
)
{
hres
=
set_length
(
jsthis
,
ei
,
0
);
hres
=
set_length
(
jsthis
,
0
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -387,7 +387,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
}
length
--
;
hres
=
jsdisp_get_idx
(
jsthis
,
length
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
length
,
&
val
);
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_delete_idx
(
jsthis
,
length
);
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
...
...
@@ -396,7 +396,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
return
hres
;
if
(
SUCCEEDED
(
hres
))
hres
=
set_length
(
jsthis
,
ei
,
length
);
hres
=
set_length
(
jsthis
,
length
);
if
(
FAILED
(
hres
))
{
jsval_release
(
val
);
...
...
@@ -412,7 +412,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
/* ECMA-262 3rd Edition 15.4.4.7 */
static
HRESULT
Array_push
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
DWORD
length
=
0
;
...
...
@@ -421,17 +421,17 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
jsthis
,
length
+
i
,
argv
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
length
+
i
,
argv
[
i
]);
if
(
FAILED
(
hres
))
return
hres
;
}
hres
=
set_length
(
jsthis
,
ei
,
length
+
argc
);
hres
=
set_length
(
jsthis
,
length
+
argc
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -441,7 +441,7 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
}
static
HRESULT
Array_reverse
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
DWORD
length
,
k
,
l
;
...
...
@@ -450,18 +450,18 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
TRACE
(
"
\n
"
);
hres1
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres1
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres1
))
return
hres1
;
for
(
k
=
0
;
k
<
length
/
2
;
k
++
)
{
l
=
length
-
k
-
1
;
hres1
=
jsdisp_get_idx
(
jsthis
,
k
,
&
v1
,
ei
);
hres1
=
jsdisp_get_idx
(
jsthis
,
k
,
&
v1
);
if
(
FAILED
(
hres1
)
&&
hres1
!=
DISP_E_UNKNOWNNAME
)
return
hres1
;
hres2
=
jsdisp_get_idx
(
jsthis
,
l
,
&
v2
,
ei
);
hres2
=
jsdisp_get_idx
(
jsthis
,
l
,
&
v2
);
if
(
FAILED
(
hres2
)
&&
hres2
!=
DISP_E_UNKNOWNNAME
)
{
jsval_release
(
v1
);
return
hres2
;
...
...
@@ -470,7 +470,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
if
(
hres1
==
DISP_E_UNKNOWNNAME
)
hres1
=
jsdisp_delete_idx
(
jsthis
,
l
);
else
hres1
=
jsdisp_propput_idx
(
jsthis
,
l
,
v1
,
ei
);
hres1
=
jsdisp_propput_idx
(
jsthis
,
l
,
v1
);
if
(
FAILED
(
hres1
))
{
jsval_release
(
v1
);
...
...
@@ -481,7 +481,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
if
(
hres2
==
DISP_E_UNKNOWNNAME
)
hres2
=
jsdisp_delete_idx
(
jsthis
,
k
);
else
hres2
=
jsdisp_propput_idx
(
jsthis
,
k
,
v2
,
ei
);
hres2
=
jsdisp_propput_idx
(
jsthis
,
k
,
v2
);
if
(
FAILED
(
hres2
))
{
jsval_release
(
v2
);
...
...
@@ -496,7 +496,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
/* ECMA-262 3rd Edition 15.4.4.9 */
static
HRESULT
Array_shift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
DWORD
length
=
0
,
i
;
...
...
@@ -505,12 +505,12 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
length
)
{
hres
=
set_length
(
jsthis
,
ei
,
0
);
hres
=
set_length
(
jsthis
,
0
);
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
@@ -521,24 +521,24 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
return
S_OK
;
}
hres
=
jsdisp_get_idx
(
jsthis
,
0
,
&
ret
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
0
,
&
ret
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
ret
=
jsval_undefined
();
hres
=
S_OK
;
}
for
(
i
=
1
;
SUCCEEDED
(
hres
)
&&
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
&
v
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
&
v
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
hres
=
jsdisp_delete_idx
(
jsthis
,
i
-
1
);
else
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_idx
(
jsthis
,
i
-
1
,
v
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
-
1
,
v
);
}
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_delete_idx
(
jsthis
,
length
-
1
);
if
(
SUCCEEDED
(
hres
))
hres
=
set_length
(
jsthis
,
ei
,
length
-
1
);
hres
=
set_length
(
jsthis
,
length
-
1
);
}
if
(
FAILED
(
hres
))
...
...
@@ -552,8 +552,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
}
/* ECMA-262 3rd Edition 15.4.4.10 */
static
HRESULT
Array_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Array_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
jsdisp_t
*
arr
,
*
jsthis
;
DOUBLE
range
;
...
...
@@ -562,12 +561,12 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
)
{
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
range
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
range
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -580,7 +579,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
else
start
=
0
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
range
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
range
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -599,12 +598,12 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
for
(
idx
=
start
;
idx
<
end
;
idx
++
)
{
jsval_t
v
;
hres
=
jsdisp_get_idx
(
jsthis
,
idx
,
&
v
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
idx
,
&
v
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
continue
;
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_idx
(
arr
,
idx
-
start
,
v
,
ei
);
hres
=
jsdisp_propput_idx
(
arr
,
idx
-
start
,
v
);
jsval_release
(
v
);
}
...
...
@@ -622,7 +621,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
return
S_OK
;
}
static
HRESULT
sort_cmp
(
script_ctx_t
*
ctx
,
jsdisp_t
*
cmp_func
,
jsval_t
v1
,
jsval_t
v2
,
jsexcept_t
*
ei
,
INT
*
cmp
)
static
HRESULT
sort_cmp
(
script_ctx_t
*
ctx
,
jsdisp_t
*
cmp_func
,
jsval_t
v1
,
jsval_t
v2
,
INT
*
cmp
)
{
HRESULT
hres
;
...
...
@@ -631,11 +630,11 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
jsval_t
res
;
double
n
;
hres
=
jsdisp_call_value
(
cmp_func
,
NULL
,
DISPATCH_METHOD
,
2
,
args
,
&
res
,
ei
);
hres
=
jsdisp_call_value
(
cmp_func
,
NULL
,
DISPATCH_METHOD
,
2
,
args
,
&
res
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
ctx
,
res
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
res
,
&
n
);
jsval_release
(
res
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -656,11 +655,11 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
}
else
{
BSTR
x
,
y
;
hres
=
to_string
(
ctx
,
v1
,
ei
,
&
x
);
hres
=
to_string
(
ctx
,
v1
,
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
v2
,
ei
,
&
y
);
hres
=
to_string
(
ctx
,
v2
,
&
y
);
if
(
SUCCEEDED
(
hres
))
{
*
cmp
=
strcmpW
(
x
,
y
);
SysFreeString
(
y
);
...
...
@@ -675,7 +674,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
/* ECMA-262 3rd Edition 15.4.4.11 */
static
HRESULT
Array_sort
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
,
*
cmp_func
=
NULL
;
jsval_t
*
vtab
,
**
sorttab
=
NULL
;
...
...
@@ -685,7 +684,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -720,7 +719,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
vtab
=
heap_alloc_zero
(
length
*
sizeof
(
*
vtab
));
if
(
vtab
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
vtab
+
i
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
vtab
+
i
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
vtab
[
i
]
=
jsval_undefined
();
hres
=
S_OK
;
...
...
@@ -749,7 +748,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
sorttab
[
i
]
=
vtab
+
i
;
for
(
i
=
0
;
i
<
length
/
2
;
i
++
)
{
hres
=
sort_cmp
(
ctx
,
cmp_func
,
*
sorttab
[
2
*
i
+
1
],
*
sorttab
[
2
*
i
],
ei
,
&
cmp
);
hres
=
sort_cmp
(
ctx
,
cmp_func
,
*
sorttab
[
2
*
i
+
1
],
*
sorttab
[
2
*
i
],
&
cmp
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -774,7 +773,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
memcpy
(
tmpbuf
,
sorttab
+
i
,
k
*
sizeof
(
jsval_t
*
));
while
(
a
<
k
&&
b
<
bend
)
{
hres
=
sort_cmp
(
ctx
,
cmp_func
,
*
tmpbuf
[
a
],
*
sorttab
[
i
+
k
+
b
],
ei
,
&
cmp
);
hres
=
sort_cmp
(
ctx
,
cmp_func
,
*
tmpbuf
[
a
],
*
sorttab
[
i
+
k
+
b
],
&
cmp
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -800,7 +799,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
}
for
(
i
=
0
;
SUCCEEDED
(
hres
)
&&
i
<
length
;
i
++
)
hres
=
jsdisp_propput_idx
(
jsthis
,
i
,
*
sorttab
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
,
*
sorttab
[
i
]);
}
if
(
vtab
)
{
...
...
@@ -822,7 +821,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
/* ECMA-262 3rd Edition 15.4.4.12 */
static
HRESULT
Array_splice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DWORD
length
,
start
=
0
,
delete_cnt
=
0
,
i
,
add_args
=
0
;
jsdisp_t
*
ret_array
=
NULL
,
*
jsthis
;
...
...
@@ -833,12 +832,12 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
)
{
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -853,7 +852,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
}
if
(
argc
>=
2
)
{
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -873,26 +872,26 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
return
hres
;
for
(
i
=
0
;
SUCCEEDED
(
hres
)
&&
i
<
delete_cnt
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
start
+
i
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
start
+
i
,
&
val
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
S_OK
;
}
else
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_idx
(
ret_array
,
i
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
ret_array
,
i
,
val
);
jsval_release
(
val
);
}
}
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
ret_array
,
lengthW
,
jsval_number
(
delete_cnt
)
,
ei
);
hres
=
jsdisp_propput_name
(
ret_array
,
lengthW
,
jsval_number
(
delete_cnt
));
}
if
(
add_args
<
delete_cnt
)
{
for
(
i
=
start
;
SUCCEEDED
(
hres
)
&&
i
<
length
-
delete_cnt
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
+
delete_cnt
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
i
+
delete_cnt
,
&
val
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
jsdisp_delete_idx
(
jsthis
,
i
+
add_args
);
}
else
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
add_args
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
add_args
,
val
);
jsval_release
(
val
);
}
}
...
...
@@ -901,21 +900,21 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
hres
=
jsdisp_delete_idx
(
jsthis
,
i
-
1
);
}
else
if
(
add_args
>
delete_cnt
)
{
for
(
i
=
length
-
delete_cnt
;
SUCCEEDED
(
hres
)
&&
i
!=
start
;
i
--
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
+
delete_cnt
-
1
,
&
val
,
ei
);
hres
=
jsdisp_get_idx
(
jsthis
,
i
+
delete_cnt
-
1
,
&
val
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
jsdisp_delete_idx
(
jsthis
,
i
+
add_args
-
1
);
}
else
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
add_args
-
1
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
add_args
-
1
,
val
);
jsval_release
(
val
);
}
}
}
for
(
i
=
0
;
SUCCEEDED
(
hres
)
&&
i
<
add_args
;
i
++
)
hres
=
jsdisp_propput_idx
(
jsthis
,
start
+
i
,
argv
[
i
+
2
]
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
start
+
i
,
argv
[
i
+
2
]);
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
jsthis
,
lengthW
,
jsval_number
(
length
-
delete_cnt
+
add_args
)
,
ei
);
hres
=
jsdisp_propput_name
(
jsthis
,
lengthW
,
jsval_number
(
length
-
delete_cnt
+
add_args
));
if
(
FAILED
(
hres
))
{
if
(
ret_array
)
...
...
@@ -930,7 +929,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
/* ECMA-262 3rd Edition 15.4.4.2 */
static
HRESULT
Array_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
ArrayInstance
*
array
;
...
...
@@ -938,13 +937,13 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
array
=
array_this
(
jsthis
);
if
(
!
array
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_ARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_ARRAY_EXPECTED
,
NULL
);
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
r
,
ei
);
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
r
);
}
static
HRESULT
Array_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
...
...
@@ -952,7 +951,7 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
/* ECMA-262 3rd Edition 15.4.4.13 */
static
HRESULT
Array_unshift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
WCHAR
buf
[
14
],
*
buf_end
,
*
str
;
...
...
@@ -963,7 +962,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
TRACE
(
"
\n
"
);
hres
=
get_length
(
ctx
,
vthis
,
ei
,
&
jsthis
,
&
length
);
hres
=
get_length
(
ctx
,
vthis
,
&
jsthis
,
&
length
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -977,11 +976,11 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
hres
=
jsdisp_get_id
(
jsthis
,
str
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propget
(
jsthis
,
id
,
&
val
,
ei
);
hres
=
jsdisp_propget
(
jsthis
,
id
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
argc
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
+
argc
,
val
);
jsval_release
(
val
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
hres
=
IDispatchEx_DeleteMemberByDispID
(
vthis
->
u
.
dispex
,
id
);
...
...
@@ -993,14 +992,14 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
}
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
jsthis
,
i
,
argv
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
jsthis
,
i
,
argv
[
i
]);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
argc
)
{
length
+=
argc
;
hres
=
set_length
(
jsthis
,
ei
,
length
);
hres
=
set_length
(
jsthis
,
length
);
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
@@ -1011,15 +1010,15 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
}
static
HRESULT
Array_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
INVOKE_PROPERTYGET
:
return
array_join
(
ctx
,
jsthis
->
u
.
jsdisp
,
array_from_vdisp
(
jsthis
)
->
length
,
default_separatorW
,
r
,
ei
);
return
array_join
(
ctx
,
jsthis
->
u
.
jsdisp
,
array_from_vdisp
(
jsthis
)
->
length
,
default_separatorW
,
r
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
...
...
@@ -1093,7 +1092,7 @@ static const builtin_info_t ArrayInst_info = {
};
static
HRESULT
ArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
obj
;
DWORD
i
;
...
...
@@ -1108,7 +1107,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
double
n
=
get_number
(
argv
[
0
]);
if
(
n
<
0
||
!
is_int32
(
n
))
return
throw_range_error
(
ctx
,
ei
,
JS_E_INVALID_LENGTH
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_INVALID_LENGTH
,
NULL
);
hres
=
create_array
(
ctx
,
n
,
&
obj
);
if
(
FAILED
(
hres
))
...
...
@@ -1123,7 +1122,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return
hres
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
obj
,
i
,
argv
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
obj
,
i
,
argv
[
i
]);
if
(
FAILED
(
hres
))
break
;
}
...
...
dlls/jscript/bool.c
View file @
6f5475dd
...
...
@@ -38,8 +38,7 @@ static inline BoolInstance *bool_this(vdisp_t *jsthis)
}
/* ECMA-262 3rd Edition 15.6.4.2 */
static
HRESULT
Bool_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Bool_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
BoolInstance
*
bool
;
...
...
@@ -49,7 +48,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
if
(
!
(
bool
=
bool_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
if
(
r
)
{
BSTR
val
;
...
...
@@ -67,15 +66,14 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
/* ECMA-262 3rd Edition 15.6.4.3 */
static
HRESULT
Bool_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Bool_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
BoolInstance
*
bool
;
TRACE
(
"
\n
"
);
if
(
!
(
bool
=
bool_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_bool
(
bool
->
val
);
...
...
@@ -83,13 +81,13 @@ static HRESULT Bool_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
static
HRESULT
Bool_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
...
...
@@ -122,7 +120,7 @@ static const builtin_info_t BoolInst_info = {
};
static
HRESULT
BoolConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BOOL
value
=
FALSE
;
HRESULT
hres
;
...
...
dlls/jscript/date.c
View file @
6f5475dd
...
...
@@ -601,22 +601,21 @@ static HRESULT dateobj_to_string(DateInstance *date, jsval_t *r)
return
date_to_string
(
time
,
TRUE
,
offset
,
r
);
}
static
HRESULT
Date_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Date_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
return
dateobj_to_string
(
date
,
r
);
}
/* ECMA-262 3rd Edition 15.9.1.5 */
static
HRESULT
Date_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
...
...
@@ -627,7 +626,7 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
r
)
{
...
...
@@ -660,22 +659,21 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
}
static
HRESULT
Date_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
}
static
inline
HRESULT
create_utc_string
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
inline
HRESULT
create_utc_string
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
*
r
)
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatADW
[]
=
{
'%'
,
's'
,
','
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
...
...
@@ -701,7 +699,7 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
DWORD
lcid_en
,
week_id
,
month_id
;
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
r
)
{
...
...
@@ -778,17 +776,17 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
/* ECMA-262 3rd Edition 15.9.5.42 */
static
HRESULT
Date_toUTCString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
create_utc_string
(
ctx
,
jsthis
,
r
,
ei
);
return
create_utc_string
(
ctx
,
jsthis
,
r
);
}
static
HRESULT
Date_toGMTString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
create_utc_string
(
ctx
,
jsthis
,
r
,
ei
);
return
create_utc_string
(
ctx
,
jsthis
,
r
);
}
/* ECMA-262 3rd Edition 15.9.5.3 */
...
...
@@ -889,19 +887,19 @@ static HRESULT dateobj_to_date_string(DateInstance *date, jsval_t *r)
}
static
HRESULT
Date_toDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
return
dateobj_to_date_string
(
date
,
r
);
}
/* ECMA-262 3rd Edition 15.9.5.4 */
static
HRESULT
Date_toTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
...
...
@@ -917,7 +915,7 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
r
)
{
...
...
@@ -959,7 +957,7 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.6 */
static
HRESULT
Date_toLocaleDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
...
...
@@ -970,7 +968,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
r
)
{
...
...
@@ -1001,7 +999,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
/* ECMA-262 3rd Edition 15.9.5.7 */
static
HRESULT
Date_toLocaleTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
...
...
@@ -1012,7 +1010,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
r
)
{
...
...
@@ -1027,7 +1025,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
return
Date_toTimeString
(
ctx
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
return
Date_toTimeString
(
ctx
,
jsthis
,
flags
,
argc
,
argv
,
r
);
if
(
r
)
{
len
=
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
NULL
,
0
);
...
...
@@ -1043,14 +1041,14 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
/* ECMA-262 3rd Edition 15.9.5.9 */
static
HRESULT
Date_getTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
date
->
time
);
...
...
@@ -1059,14 +1057,14 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
/* ECMA-262 3rd Edition 15.9.5.10 */
static
HRESULT
Date_getFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
{
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
...
...
@@ -1078,14 +1076,14 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.11 */
static
HRESULT
Date_getUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
year_from_time
(
date
->
time
));
...
...
@@ -1093,15 +1091,14 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
}
/* ECMA-262 3rd Edition 15.9.5.12 */
static
HRESULT
Date_getMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Date_getMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
month_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1110,14 +1107,14 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.9.5.13 */
static
HRESULT
Date_getUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
month_from_time
(
date
->
time
));
...
...
@@ -1125,15 +1122,14 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
/* ECMA-262 3rd Edition 15.9.5.14 */
static
HRESULT
Date_getDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Date_getDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
date_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1142,14 +1138,14 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
/* ECMA-262 3rd Edition 15.9.5.15 */
static
HRESULT
Date_getUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
date_from_time
(
date
->
time
));
...
...
@@ -1158,14 +1154,14 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.16 */
static
HRESULT
Date_getDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
week_day
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1174,14 +1170,14 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
/* ECMA-262 3rd Edition 15.9.5.17 */
static
HRESULT
Date_getUTCDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
week_day
(
date
->
time
));
...
...
@@ -1190,14 +1186,14 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
/* ECMA-262 3rd Edition 15.9.5.18 */
static
HRESULT
Date_getHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
hour_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1206,14 +1202,14 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.9.5.19 */
static
HRESULT
Date_getUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
hour_from_time
(
date
->
time
));
...
...
@@ -1222,14 +1218,14 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.20 */
static
HRESULT
Date_getMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
min_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1238,14 +1234,14 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.21 */
static
HRESULT
Date_getUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
min_from_time
(
date
->
time
));
...
...
@@ -1253,15 +1249,14 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
/* ECMA-262 3rd Edition 15.9.5.22 */
static
HRESULT
Date_getSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Date_getSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
sec_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1270,14 +1265,14 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.23 */
static
HRESULT
Date_getUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
sec_from_time
(
date
->
time
));
...
...
@@ -1286,14 +1281,14 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
/* ECMA-262 3rd Edition 15.9.5.24 */
static
HRESULT
Date_getMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
ms_from_time
(
local_time
(
date
->
time
,
date
)));
...
...
@@ -1302,14 +1297,14 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
/* ECMA-262 3rd Edition 15.9.5.25 */
static
HRESULT
Date_getUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
ms_from_time
(
date
->
time
));
...
...
@@ -1318,14 +1313,14 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
/* ECMA-262 3rd Edition 15.9.5.26 */
static
HRESULT
Date_getTimezoneOffset
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
floor
((
date
->
time
-
local_time
(
date
->
time
,
date
))
/
MS_PER_MINUTE
));
...
...
@@ -1334,7 +1329,7 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f
/* ECMA-262 3rd Edition 15.9.5.27 */
static
HRESULT
Date_setTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
n
;
HRESULT
hres
;
...
...
@@ -1343,12 +1338,12 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1361,7 +1356,7 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
/* ECMA-262 3rd Edition 15.9.5.28 */
static
HRESULT
Date_setMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
n
,
t
;
...
...
@@ -1370,12 +1365,12 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1391,7 +1386,7 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
/* ECMA-262 3rd Edition 15.9.5.29 */
static
HRESULT
Date_setUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
n
,
t
;
...
...
@@ -1400,12 +1395,12 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1421,7 +1416,7 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
/* ECMA-262 3rd Edition 15.9.5.30 */
static
HRESULT
Date_setSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
sec
,
ms
;
...
...
@@ -1430,19 +1425,19 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1460,7 +1455,7 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.31 */
static
HRESULT
Date_setUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
sec
,
ms
;
...
...
@@ -1469,19 +1464,19 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
date
->
time
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1499,7 +1494,7 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
/* ECMA-262 3rd Edition 15.9.5.33 */
static
HRESULT
Date_setMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
min
,
sec
,
ms
;
...
...
@@ -1508,19 +1503,19 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
min
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
min
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1528,7 +1523,7 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1546,7 +1541,7 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.34 */
static
HRESULT
Date_setUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
min
,
sec
,
ms
;
...
...
@@ -1555,19 +1550,19 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
date
->
time
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
min
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
min
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1575,7 +1570,7 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1593,7 +1588,7 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
/* ECMA-262 3rd Edition 15.9.5.35 */
static
HRESULT
Date_setHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
hour
,
min
,
sec
,
ms
;
...
...
@@ -1602,19 +1597,19 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
hour
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
hour
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
min
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
min
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1622,7 +1617,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1630,7 +1625,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
if
(
argc
>
3
)
{
hres
=
to_number
(
ctx
,
argv
[
3
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
3
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1647,7 +1642,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.9.5.36 */
static
HRESULT
Date_setUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
hour
,
min
,
sec
,
ms
;
...
...
@@ -1656,19 +1651,19 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
date
->
time
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
hour
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
hour
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
min
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
min
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1676,7 +1671,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
sec
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
sec
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1684,7 +1679,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
if
(
argc
>
3
)
{
hres
=
to_number
(
ctx
,
argv
[
3
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
3
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1701,7 +1696,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.36 */
static
HRESULT
Date_setDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
n
;
...
...
@@ -1710,12 +1705,12 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1730,7 +1725,7 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
/* ECMA-262 3rd Edition 15.9.5.37 */
static
HRESULT
Date_setUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
n
;
...
...
@@ -1739,12 +1734,12 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1759,7 +1754,7 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.9.5.38 */
static
HRESULT
Date_setMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
DOUBLE
t
,
month
,
ddate
;
...
...
@@ -1768,19 +1763,19 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
month
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
month
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
ddate
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
ddate
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1798,7 +1793,7 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.9.5.39 */
static
HRESULT
Date_setUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
month
,
ddate
;
...
...
@@ -1807,19 +1802,19 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
date
->
time
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
month
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
month
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
ddate
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
ddate
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1837,7 +1832,7 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.40 */
static
HRESULT
Date_setFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
year
,
month
,
ddate
;
...
...
@@ -1846,19 +1841,19 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
year
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
year
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
month
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
month
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1866,7 +1861,7 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
ddate
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
ddate
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1883,7 +1878,7 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.41 */
static
HRESULT
Date_setUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
double
t
,
year
,
month
,
ddate
;
...
...
@@ -1892,19 +1887,19 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
date
->
time
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
year
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
year
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
month
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
month
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1912,7 +1907,7 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
ddate
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
ddate
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1929,7 +1924,7 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
/* ECMA-262 3rd Edition B2.4 */
static
HRESULT
Date_getYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
DOUBLE
t
,
year
;
...
...
@@ -1937,7 +1932,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
if
(
isnan
(
t
))
{
...
...
@@ -1954,7 +1949,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
/* ECMA-262 3rd Edition B2.5 */
static
HRESULT
Date_setYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DateInstance
*
date
;
DOUBLE
t
,
year
;
...
...
@@ -1963,14 +1958,14 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
!
argc
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_MISSING_ARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_MISSING_ARG
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
year
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
year
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1993,13 +1988,13 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
static
HRESULT
Date_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
...
...
@@ -2366,7 +2361,7 @@ static inline HRESULT date_parse(BSTR input, double *ret) {
}
static
HRESULT
DateConstr_parse
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
parse_str
;
double
n
;
...
...
@@ -2380,7 +2375,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
parse_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
parse_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2393,7 +2388,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
static
HRESULT
date_utc
(
script_ctx_t
*
ctx
,
unsigned
argc
,
jsval_t
*
argv
,
double
*
ret
,
jsexcept_t
*
ei
)
static
HRESULT
date_utc
(
script_ctx_t
*
ctx
,
unsigned
argc
,
jsval_t
*
argv
,
double
*
ret
)
{
double
year
,
month
,
vdate
,
hours
,
minutes
,
seconds
,
ms
;
HRESULT
hres
;
...
...
@@ -2401,7 +2396,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
TRACE
(
"
\n
"
);
if
(
argc
)
{
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
year
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
year
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
0
<=
year
&&
year
<=
99
)
...
...
@@ -2411,7 +2406,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
1
)
{
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
month
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
month
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2419,7 +2414,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
2
)
{
hres
=
to_number
(
ctx
,
argv
[
2
],
ei
,
&
vdate
);
hres
=
to_number
(
ctx
,
argv
[
2
],
&
vdate
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2427,7 +2422,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
3
)
{
hres
=
to_number
(
ctx
,
argv
[
3
],
ei
,
&
hours
);
hres
=
to_number
(
ctx
,
argv
[
3
],
&
hours
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2435,7 +2430,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
4
)
{
hres
=
to_number
(
ctx
,
argv
[
4
],
ei
,
&
minutes
);
hres
=
to_number
(
ctx
,
argv
[
4
],
&
minutes
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2443,7 +2438,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
5
)
{
hres
=
to_number
(
ctx
,
argv
[
5
],
ei
,
&
seconds
);
hres
=
to_number
(
ctx
,
argv
[
5
],
&
seconds
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2451,7 +2446,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
if
(
argc
>
6
)
{
hres
=
to_number
(
ctx
,
argv
[
6
],
ei
,
&
ms
);
hres
=
to_number
(
ctx
,
argv
[
6
],
&
ms
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -2464,21 +2459,21 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
}
static
HRESULT
DateConstr_UTC
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
n
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
n
,
ei
);
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
n
);
if
(
SUCCEEDED
(
hres
)
&&
r
)
*
r
=
jsval_number
(
n
);
return
hres
;
}
static
HRESULT
DateConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
date
;
HRESULT
hres
;
...
...
@@ -2508,14 +2503,14 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
jsval_t
prim
;
double
n
;
hres
=
to_primitive
(
ctx
,
argv
[
0
],
ei
,
&
prim
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
argv
[
0
],
&
prim
,
NO_HINT
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
is_string
(
prim
))
hres
=
date_parse
(
get_string
(
prim
),
&
n
);
else
hres
=
to_number
(
ctx
,
prim
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
prim
,
&
n
);
jsval_release
(
prim
);
if
(
FAILED
(
hres
))
...
...
@@ -2532,7 +2527,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
double
ret_date
;
DateInstance
*
di
;
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
ret_date
,
ei
);
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
ret_date
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/dispex.c
View file @
6f5475dd
...
...
@@ -344,7 +344,7 @@ static HRESULT convert_params(const DISPPARAMS *dp, jsval_t *buf, unsigned *argc
}
static
HRESULT
invoke_prop_func
(
jsdisp_t
*
This
,
IDispatch
*
jsthis
,
dispex_prop_t
*
prop
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
IServiceProvider
*
caller
)
{
HRESULT
hres
;
...
...
@@ -362,17 +362,17 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
set_disp
(
&
vthis
,
jsthis
);
else
set_jsdisp
(
&
vthis
,
This
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
);
vdisp_release
(
&
vthis
);
}
else
{
/* Function object calls are special case */
hres
=
Function_invoke
(
This
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
Function_invoke
(
This
,
jsthis
,
flags
,
argc
,
argv
,
r
);
}
return
hres
;
}
case
PROP_PROTREF
:
return
invoke_prop_func
(
This
->
prototype
,
jsthis
,
This
->
prototype
->
props
+
prop
->
u
.
ref
,
flags
,
argc
,
argv
,
r
,
ei
,
caller
);
flags
,
argc
,
argv
,
r
,
caller
);
case
PROP_JSVAL
:
{
if
(
!
is_object_instance
(
prop
->
u
.
val
))
{
FIXME
(
"invoke %s
\n
"
,
debugstr_jsval
(
prop
->
u
.
val
));
...
...
@@ -381,7 +381,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
TRACE
(
"call %s %p
\n
"
,
debugstr_w
(
prop
->
name
),
get_object
(
prop
->
u
.
val
));
return
disp_call_value
(
This
->
ctx
,
get_object
(
prop
->
u
.
val
),
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
return
disp_call_value
(
This
->
ctx
,
get_object
(
prop
->
u
.
val
),
jsthis
,
flags
,
argc
,
argv
,
r
);
}
default:
ERR
(
"type %d
\n
"
,
prop
->
type
);
...
...
@@ -391,7 +391,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
}
static
HRESULT
prop_get
(
jsdisp_t
*
This
,
dispex_prop_t
*
prop
,
DISPPARAMS
*
dp
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
jsval_t
*
r
,
IServiceProvider
*
caller
)
{
HRESULT
hres
;
...
...
@@ -413,12 +413,12 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
vdisp_t
vthis
;
set_jsdisp
(
&
vthis
,
This
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYGET
,
0
,
NULL
,
r
,
ei
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYGET
,
0
,
NULL
,
r
);
vdisp_release
(
&
vthis
);
}
break
;
case
PROP_PROTREF
:
hres
=
prop_get
(
This
->
prototype
,
This
->
prototype
->
props
+
prop
->
u
.
ref
,
dp
,
r
,
ei
,
caller
);
hres
=
prop_get
(
This
->
prototype
,
This
->
prototype
->
props
+
prop
->
u
.
ref
,
dp
,
r
,
caller
);
break
;
case
PROP_JSVAL
:
hres
=
jsval_copy
(
prop
->
u
.
val
,
r
);
...
...
@@ -437,8 +437,7 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
return
hres
;
}
static
HRESULT
prop_put
(
jsdisp_t
*
This
,
dispex_prop_t
*
prop
,
jsval_t
val
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
static
HRESULT
prop_put
(
jsdisp_t
*
This
,
dispex_prop_t
*
prop
,
jsval_t
val
,
IServiceProvider
*
caller
)
{
HRESULT
hres
;
...
...
@@ -451,7 +450,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val,
vdisp_t
vthis
;
set_jsdisp
(
&
vthis
,
This
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYPUT
,
1
,
&
val
,
NULL
,
ei
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYPUT
,
1
,
&
val
,
NULL
);
vdisp_release
(
&
vthis
);
return
hres
;
}
...
...
@@ -655,7 +654,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
{
jsdisp_t
*
This
=
impl_from_IDispatchEx
(
iface
);
dispex_prop_t
*
prop
;
jsexcept_t
jsexcept
;
HRESULT
hres
;
TRACE
(
"(%p)->(%x %x %x %p %p %p %p)
\n
"
,
This
,
id
,
lcid
,
wFlags
,
pdp
,
pvarRes
,
pei
,
pspCaller
);
...
...
@@ -669,7 +667,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return
DISP_E_MEMBERNOTFOUND
;
}
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
)
);
clear_ei
(
This
->
ctx
);
switch
(
wFlags
)
{
case
DISPATCH_METHOD
|
DISPATCH_PROPERTYGET
:
...
...
@@ -684,7 +682,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
if
(
FAILED
(
hres
))
return
hres
;
hres
=
invoke_prop_func
(
This
,
get_this
(
pdp
),
prop
,
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
,
&
jsexcept
,
pspCaller
);
hres
=
invoke_prop_func
(
This
,
get_this
(
pdp
),
prop
,
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
,
pspCaller
);
if
(
argv
!=
buf
)
heap_free
(
argv
);
if
(
SUCCEEDED
(
hres
)
&&
pvarRes
)
{
...
...
@@ -696,7 +694,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
case
DISPATCH_PROPERTYGET
:
{
jsval_t
r
;
hres
=
prop_get
(
This
,
prop
,
pdp
,
&
r
,
&
jsexcept
,
pspCaller
);
hres
=
prop_get
(
This
,
prop
,
pdp
,
&
r
,
pspCaller
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsval_to_variant
(
r
,
pvarRes
);
jsval_release
(
r
);
...
...
@@ -721,7 +719,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
if
(
FAILED
(
hres
))
return
hres
;
hres
=
prop_put
(
This
,
prop
,
val
,
&
jsexcept
,
pspCaller
);
hres
=
prop_put
(
This
,
prop
,
val
,
pspCaller
);
jsval_release
(
val
);
break
;
}
...
...
@@ -731,8 +729,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
}
if
(
pei
)
*
pei
=
jsexcept
.
ei
;
*
pei
=
This
->
ctx
->
ei
.
ei
;
return
hres
;
}
...
...
@@ -942,11 +939,9 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
hres
=
find_prop_name_prot
(
constr
,
string_hash
(
prototypeW
),
prototypeW
,
&
prop
);
if
(
SUCCEEDED
(
hres
)
&&
prop
&&
prop
->
type
!=
PROP_DELETED
)
{
jsexcept_t
jsexcept
;
jsval_t
val
;
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
));
hres
=
prop_get
(
constr
,
prop
,
NULL
,
&
val
,
&
jsexcept
,
NULL
/*FIXME*/
);
hres
=
prop_get
(
constr
,
prop
,
NULL
,
&
val
,
NULL
);
if
(
FAILED
(
hres
))
{
ERR
(
"Could not get prototype
\n
"
);
return
hres
;
...
...
@@ -997,24 +992,23 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *
return
DISP_E_UNKNOWNNAME
;
}
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
HRESULT
hres
;
if
(
is_class
(
jsfunc
,
JSCLASS_FUNCTION
))
{
hres
=
Function_invoke
(
jsfunc
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
Function_invoke
(
jsfunc
,
jsthis
,
flags
,
argc
,
argv
,
r
);
}
else
{
vdisp_t
vdisp
;
set_disp
(
&
vdisp
,
jsthis
);
hres
=
jsfunc
->
builtin_info
->
value_prop
.
invoke
(
jsfunc
->
ctx
,
&
vdisp
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
jsfunc
->
builtin_info
->
value_prop
.
invoke
(
jsfunc
->
ctx
,
&
vdisp
,
flags
,
argc
,
argv
,
r
);
vdisp_release
(
&
vdisp
);
}
return
hres
;
}
HRESULT
jsdisp_call
(
jsdisp_t
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_call
(
jsdisp_t
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
dispex_prop_t
*
prop
;
...
...
@@ -1022,12 +1016,10 @@ HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, jsval_
if
(
!
prop
)
return
DISP_E_MEMBERNOTFOUND
;
memset
(
ei
,
0
,
sizeof
(
*
ei
));
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
r
,
ei
,
NULL
);
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
r
,
NULL
);
}
HRESULT
jsdisp_call_name
(
jsdisp_t
*
disp
,
const
WCHAR
*
name
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_call_name
(
jsdisp_t
*
disp
,
const
WCHAR
*
name
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
dispex_prop_t
*
prop
;
HRESULT
hres
;
...
...
@@ -1036,12 +1028,10 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned
if
(
FAILED
(
hres
))
return
hres
;
memset
(
ei
,
0
,
sizeof
(
*
ei
));
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
r
,
ei
,
NULL
);
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
r
,
NULL
);
}
HRESULT
disp_call
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
ret
,
jsexcept_t
*
ei
)
HRESULT
disp_call
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
ret
)
{
IDispatchEx
*
dispex
;
jsdisp_t
*
jsdisp
;
...
...
@@ -1057,12 +1047,11 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
return
E_FAIL
;
}
hres
=
jsdisp_call
(
jsdisp
,
id
,
flags
,
argc
,
argv
,
ret
,
ei
);
hres
=
jsdisp_call
(
jsdisp
,
id
,
flags
,
argc
,
argv
,
ret
);
jsdisp_release
(
jsdisp
);
return
hres
;
}
memset
(
ei
,
0
,
sizeof
(
*
ei
));
if
(
ret
&&
argc
)
flags
|=
DISPATCH_PROPERTYGET
;
...
...
@@ -1098,9 +1087,10 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
}
V_VT
(
&
retv
)
=
VT_EMPTY
;
clear_ei
(
ctx
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
flags
,
&
dp
,
ret
?
&
retv
:
NULL
,
&
ei
->
ei
,
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
flags
,
&
dp
,
ret
?
&
retv
:
NULL
,
&
ctx
->
ei
.
ei
,
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IDispatchEx_Release
(
dispex
);
}
else
{
...
...
@@ -1112,7 +1102,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
}
TRACE
(
"using IDispatch
\n
"
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
ret
?
&
retv
:
NULL
,
&
ei
->
ei
,
&
err
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
ret
?
&
retv
:
NULL
,
&
ctx
->
ei
.
ei
,
&
err
);
}
for
(
i
=
0
;
i
<
argc
;
i
++
)
...
...
@@ -1130,7 +1120,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
}
HRESULT
disp_call_value
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsdisp
;
IDispatchEx
*
dispex
;
...
...
@@ -1146,12 +1136,11 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
return
E_FAIL
;
}
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
,
flags
,
argc
,
argv
,
r
);
jsdisp_release
(
jsdisp
);
return
hres
;
}
memset
(
ei
,
0
,
sizeof
(
*
ei
));
if
(
r
&&
argc
)
flags
|=
DISPATCH_PROPERTYGET
;
...
...
@@ -1192,9 +1181,10 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
}
V_VT
(
&
retv
)
=
VT_EMPTY
;
clear_ei
(
ctx
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_InvokeEx
(
dispex
,
DISPID_VALUE
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ei
->
ei
,
hres
=
IDispatchEx_InvokeEx
(
dispex
,
DISPID_VALUE
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ctx
->
ei
.
ei
,
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IDispatchEx_Release
(
dispex
);
}
else
{
...
...
@@ -1206,7 +1196,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
}
TRACE
(
"using IDispatch
\n
"
);
hres
=
IDispatch_Invoke
(
disp
,
DISPID_VALUE
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ei
->
ei
,
&
err
);
hres
=
IDispatch_Invoke
(
disp
,
DISPID_VALUE
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ctx
->
ei
.
ei
,
&
err
);
}
for
(
i
=
0
;
i
<
argc
;
i
++
)
...
...
@@ -1224,7 +1214,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
return
hres
;
}
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
jsval_t
val
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
jsval_t
val
)
{
dispex_prop_t
*
prop
;
HRESULT
hres
;
...
...
@@ -1233,7 +1223,7 @@ HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val, jsexc
if
(
FAILED
(
hres
))
return
hres
;
return
prop_put
(
obj
,
prop
,
val
,
ei
,
NULL
);
return
prop_put
(
obj
,
prop
,
val
,
NULL
);
}
HRESULT
jsdisp_propput_const
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
jsval_t
val
)
...
...
@@ -1260,17 +1250,17 @@ HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, jsval_t val)
return
jsval_copy
(
val
,
&
prop
->
u
.
val
);
}
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
obj
,
DWORD
idx
,
jsval_t
val
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
obj
,
DWORD
idx
,
jsval_t
val
)
{
WCHAR
buf
[
12
];
static
const
WCHAR
formatW
[]
=
{
'%'
,
'd'
,
0
};
sprintfW
(
buf
,
formatW
,
idx
);
return
jsdisp_propput_name
(
obj
,
buf
,
val
,
ei
);
return
jsdisp_propput_name
(
obj
,
buf
,
val
);
}
HRESULT
disp_propput
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
jsval_t
val
,
jsexcept_t
*
ei
)
HRESULT
disp_propput
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
jsval_t
val
)
{
jsdisp_t
*
jsdisp
;
HRESULT
hres
;
...
...
@@ -1281,7 +1271,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val,
prop
=
get_prop
(
jsdisp
,
id
);
if
(
prop
)
hres
=
prop_put
(
jsdisp
,
prop
,
val
,
ei
,
NULL
);
hres
=
prop_put
(
jsdisp
,
prop
,
val
,
NULL
);
else
hres
=
DISP_E_MEMBERNOTFOUND
;
...
...
@@ -1296,16 +1286,17 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val,
if
(
FAILED
(
hres
))
return
hres
;
clear_ei
(
ctx
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
DISPATCH_PROPERTYPUT
,
&
dp
,
NULL
,
&
ei
->
ei
,
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
DISPATCH_PROPERTYPUT
,
&
dp
,
NULL
,
&
ctx
->
ei
.
ei
,
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IDispatchEx_Release
(
dispex
);
}
else
{
ULONG
err
=
0
;
TRACE
(
"using IDispatch
\n
"
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
DISPATCH_PROPERTYPUT
,
&
dp
,
NULL
,
&
ei
->
ei
,
&
err
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
DISPATCH_PROPERTYPUT
,
&
dp
,
NULL
,
&
ctx
->
ei
.
ei
,
&
err
);
}
VariantClear
(
&
var
);
...
...
@@ -1314,7 +1305,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val,
return
hres
;
}
HRESULT
jsdisp_propget_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
jsval_t
*
val
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_propget_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
jsval_t
*
val
)
{
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
dispex_prop_t
*
prop
;
...
...
@@ -1329,10 +1320,10 @@ HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val, jsex
return
S_OK
;
}
return
prop_get
(
obj
,
prop
,
&
dp
,
val
,
ei
,
NULL
);
return
prop_get
(
obj
,
prop
,
&
dp
,
val
,
NULL
);
}
HRESULT
jsdisp_get_idx
(
jsdisp_t
*
obj
,
DWORD
idx
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_get_idx
(
jsdisp_t
*
obj
,
DWORD
idx
,
jsval_t
*
r
)
{
WCHAR
name
[
12
];
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
...
...
@@ -1352,10 +1343,10 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r, jsexcept_t *ei)
return
DISP_E_UNKNOWNNAME
;
}
return
prop_get
(
obj
,
prop
,
&
dp
,
r
,
ei
,
NULL
);
return
prop_get
(
obj
,
prop
,
&
dp
,
r
,
NULL
);
}
HRESULT
jsdisp_propget
(
jsdisp_t
*
jsdisp
,
DISPID
id
,
jsval_t
*
val
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_propget
(
jsdisp_t
*
jsdisp
,
DISPID
id
,
jsval_t
*
val
)
{
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
dispex_prop_t
*
prop
;
...
...
@@ -1364,10 +1355,10 @@ HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val, jsexcept_t *ei
if
(
!
prop
)
return
DISP_E_MEMBERNOTFOUND
;
return
prop_get
(
jsdisp
,
prop
,
&
dp
,
val
,
ei
,
NULL
);
return
prop_get
(
jsdisp
,
prop
,
&
dp
,
val
,
NULL
);
}
HRESULT
disp_propget
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
jsval_t
*
val
,
jsexcept_t
*
ei
)
HRESULT
disp_propget
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
jsval_t
*
val
)
{
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
IDispatchEx
*
dispex
;
...
...
@@ -1377,22 +1368,23 @@ HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val
jsdisp
=
iface_to_jsdisp
((
IUnknown
*
)
disp
);
if
(
jsdisp
)
{
hres
=
jsdisp_propget
(
jsdisp
,
id
,
val
,
ei
);
hres
=
jsdisp_propget
(
jsdisp
,
id
,
val
);
jsdisp_release
(
jsdisp
);
return
hres
;
}
V_VT
(
&
var
)
=
VT_EMPTY
;
clear_ei
(
ctx
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
INVOKE_PROPERTYGET
,
&
dp
,
&
var
,
&
ei
->
ei
,
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
ctx
->
lcid
,
INVOKE_PROPERTYGET
,
&
dp
,
&
var
,
&
ctx
->
ei
.
ei
,
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IDispatchEx_Release
(
dispex
);
}
else
{
ULONG
err
=
0
;
TRACE
(
"using IDispatch
\n
"
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
INVOKE_PROPERTYGET
,
&
dp
,
&
var
,
&
ei
->
ei
,
&
err
);
hres
=
IDispatch_Invoke
(
disp
,
id
,
&
IID_NULL
,
ctx
->
lcid
,
INVOKE_PROPERTYGET
,
&
dp
,
&
var
,
&
ctx
->
ei
.
ei
,
&
err
);
}
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.c
View file @
6f5475dd
...
...
@@ -130,7 +130,7 @@ static HRESULT stack_pop_number(exec_ctx_t *ctx, double *r)
HRESULT
hres
;
v
=
stack_pop
(
ctx
);
hres
=
to_number
(
ctx
->
script
,
v
,
ctx
->
ei
,
r
);
hres
=
to_number
(
ctx
->
script
,
v
,
r
);
jsval_release
(
v
);
return
hres
;
}
...
...
@@ -143,7 +143,7 @@ static HRESULT stack_pop_object(exec_ctx_t *ctx, IDispatch **r)
v
=
stack_pop
(
ctx
);
if
(
is_object_instance
(
v
))
{
if
(
!
get_object
(
v
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_OBJECT_REQUIRED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_OBJECT_REQUIRED
,
NULL
);
*
r
=
get_object
(
v
);
return
S_OK
;
}
...
...
@@ -155,12 +155,12 @@ static HRESULT stack_pop_object(exec_ctx_t *ctx, IDispatch **r)
static
inline
HRESULT
stack_pop_int
(
exec_ctx_t
*
ctx
,
INT
*
r
)
{
return
to_int32
(
ctx
->
script
,
stack_pop
(
ctx
),
ctx
->
ei
,
r
);
return
to_int32
(
ctx
->
script
,
stack_pop
(
ctx
),
r
);
}
static
inline
HRESULT
stack_pop_uint
(
exec_ctx_t
*
ctx
,
DWORD
*
r
)
{
return
to_uint32
(
ctx
->
script
,
stack_pop
(
ctx
),
ctx
->
ei
,
r
);
return
to_uint32
(
ctx
->
script
,
stack_pop
(
ctx
),
r
);
}
static
inline
IDispatch
*
stack_pop_objid
(
exec_ctx_t
*
ctx
,
DISPID
*
id
)
...
...
@@ -195,7 +195,7 @@ static void exprval_release(exprval_t *val)
}
/* ECMA-262 3rd Edition 8.7.1 */
static
HRESULT
exprval_to_value
(
script_ctx_t
*
ctx
,
exprval_t
*
val
,
js
except_t
*
ei
,
js
val_t
*
ret
)
static
HRESULT
exprval_to_value
(
script_ctx_t
*
ctx
,
exprval_t
*
val
,
jsval_t
*
ret
)
{
switch
(
val
->
type
)
{
case
EXPRVAL_JSVAL
:
...
...
@@ -208,7 +208,7 @@ static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsexcept_t *e
return
E_FAIL
;
}
return
disp_propget
(
ctx
,
val
->
u
.
idref
.
disp
,
val
->
u
.
idref
.
id
,
ret
,
ei
);
return
disp_propget
(
ctx
,
val
->
u
.
idref
.
disp
,
val
->
u
.
idref
.
id
,
ret
);
case
EXPRVAL_INVALID
:
assert
(
0
);
}
...
...
@@ -261,6 +261,13 @@ static void scope_pop(scope_chain_t **scope)
scope_release
(
tmp
);
}
void
clear_ei
(
script_ctx_t
*
ctx
)
{
memset
(
&
ctx
->
ei
.
ei
,
0
,
sizeof
(
ctx
->
ei
.
ei
));
jsval_release
(
ctx
->
ei
.
val
);
ctx
->
ei
.
val
=
jsval_undefined
();
}
void
scope_release
(
scope_chain_t
*
scope
)
{
if
(
--
scope
->
ref
)
...
...
@@ -551,7 +558,7 @@ static HRESULT interp_var_set(exec_ctx_t *ctx)
TRACE
(
"%s
\n
"
,
debugstr_w
(
name
));
val
=
stack_pop
(
ctx
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
name
,
val
,
ctx
->
ei
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
name
,
val
);
jsval_release
(
val
);
return
hres
;
}
...
...
@@ -605,7 +612,7 @@ static HRESULT interp_forin(exec_ctx_t *ctx)
stack_pop
(
ctx
);
stack_push
(
ctx
,
jsval_number
(
id
));
/* safe, just after pop() */
hres
=
disp_propput
(
ctx
->
script
,
var_obj
,
var_id
,
jsval_string
(
name
)
,
ctx
->
ei
);
hres
=
disp_propput
(
ctx
->
script
,
var_obj
,
var_id
,
jsval_string
(
name
));
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -678,6 +685,7 @@ static HRESULT interp_throw(exec_ctx_t *ctx)
{
TRACE
(
"
\n
"
);
jsval_release
(
ctx
->
ei
->
val
);
ctx
->
ei
->
val
=
stack_pop
(
ctx
);
return
DISP_E_EXCEPTION
;
}
...
...
@@ -688,7 +696,7 @@ static HRESULT interp_throw_ref(exec_ctx_t *ctx)
TRACE
(
"%08x
\n
"
,
arg
);
return
throw_reference_error
(
ctx
->
script
,
ctx
->
ei
,
arg
,
NULL
);
return
throw_reference_error
(
ctx
->
script
,
arg
,
NULL
);
}
static
HRESULT
interp_throw_type
(
exec_ctx_t
*
ctx
)
...
...
@@ -698,7 +706,7 @@ static HRESULT interp_throw_type(exec_ctx_t *ctx)
TRACE
(
"%08x %s
\n
"
,
hres
,
debugstr_w
(
str
));
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
hres
,
str
);
return
throw_type_error
(
ctx
->
script
,
hres
,
str
);
}
/* ECMA-262 3rd Edition 12.14 */
...
...
@@ -814,7 +822,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
&
name
);
jsval_release
(
namev
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
@@ -824,7 +832,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
hres
=
disp_get_id
(
ctx
->
script
,
obj
,
name
,
0
,
&
id
);
SysFreeString
(
name
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
v
=
jsval_undefined
();
hres
=
S_OK
;
...
...
@@ -853,7 +861,7 @@ static HRESULT interp_member(exec_ctx_t *ctx)
hres
=
disp_get_id
(
ctx
->
script
,
obj
,
arg
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
);
}
else
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
v
=
jsval_undefined
();
hres
=
S_OK
;
...
...
@@ -883,7 +891,7 @@ static HRESULT interp_memberid(exec_ctx_t *ctx)
hres
=
to_object
(
ctx
->
script
,
objv
,
&
obj
);
jsval_release
(
objv
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
&
name
);
if
(
FAILED
(
hres
))
IDispatch_Release
(
obj
);
}
...
...
@@ -919,9 +927,9 @@ static HRESULT interp_refval(exec_ctx_t *ctx)
disp
=
stack_topn_objid
(
ctx
,
0
,
&
id
);
if
(
!
disp
)
return
throw_reference_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
return
throw_reference_error
(
ctx
->
script
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
hres
=
disp_propget
(
ctx
->
script
,
disp
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
disp
,
id
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -942,13 +950,13 @@ static HRESULT interp_new(exec_ctx_t *ctx)
/* NOTE: Should use to_object here */
if
(
is_null
(
constr
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_OBJECT_EXPECTED
,
NULL
);
else
if
(
!
is_object_instance
(
constr
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_ACTION
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_INVALID_ACTION
,
NULL
);
else
if
(
!
get_object
(
constr
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_INVALID_PROPERTY
,
NULL
);
hres
=
disp_call_value
(
ctx
->
script
,
get_object
(
constr
),
NULL
,
DISPATCH_CONSTRUCT
,
argc
,
stack_args
(
ctx
,
argc
),
&
r
,
ctx
->
ei
);
hres
=
disp_call_value
(
ctx
->
script
,
get_object
(
constr
),
NULL
,
DISPATCH_CONSTRUCT
,
argc
,
stack_args
(
ctx
,
argc
),
&
r
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -968,10 +976,10 @@ static HRESULT interp_call(exec_ctx_t *ctx)
obj
=
stack_topn
(
ctx
,
argn
);
if
(
!
is_object_instance
(
obj
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_INVALID_PROPERTY
,
NULL
);
hres
=
disp_call_value
(
ctx
->
script
,
get_object
(
obj
),
NULL
,
DISPATCH_METHOD
,
argn
,
stack_args
(
ctx
,
argn
),
do_ret
?
&
r
:
NULL
,
ctx
->
ei
);
do_ret
?
&
r
:
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -993,9 +1001,9 @@ static HRESULT interp_call_member(exec_ctx_t *ctx)
obj
=
stack_topn_objid
(
ctx
,
argn
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
id
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
id
,
NULL
);
hres
=
disp_call
(
ctx
->
script
,
obj
,
id
,
DISPATCH_METHOD
,
argn
,
stack_args
(
ctx
,
argn
),
do_ret
?
&
r
:
NULL
,
ctx
->
ei
);
hres
=
disp_call
(
ctx
->
script
,
obj
,
id
,
DISPATCH_METHOD
,
argn
,
stack_args
(
ctx
,
argn
),
do_ret
?
&
r
:
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1028,9 +1036,9 @@ static HRESULT interp_ident(exec_ctx_t *ctx)
return
hres
;
if
(
exprval
.
type
==
EXPRVAL_INVALID
)
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_UNDEFINED_VARIABLE
,
arg
);
return
throw_type_error
(
ctx
->
script
,
JS_E_UNDEFINED_VARIABLE
,
arg
);
hres
=
exprval_to_value
(
ctx
->
script
,
&
exprval
,
ctx
->
ei
,
&
v
);
hres
=
exprval_to_value
(
ctx
->
script
,
&
exprval
,
&
v
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1159,7 +1167,7 @@ static HRESULT interp_carray(exec_ctx_t *ctx)
i
=
arg
;
while
(
i
--
)
{
val
=
stack_pop
(
ctx
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
val
,
ctx
->
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
val
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
array
);
...
...
@@ -1200,7 +1208,7 @@ static HRESULT interp_obj_prop(exec_ctx_t *ctx)
assert
(
is_object_instance
(
stack_top
(
ctx
)));
obj
=
as_jsdisp
(
get_object
(
stack_top
(
ctx
)));
hres
=
jsdisp_propput_name
(
obj
,
name
,
val
,
ctx
->
ei
);
hres
=
jsdisp_propput_name
(
obj
,
name
,
val
);
jsval_release
(
val
);
return
hres
;
}
...
...
@@ -1319,7 +1327,7 @@ static HRESULT interp_instanceof(exec_ctx_t *ctx)
v
=
stack_pop
(
ctx
);
if
(
!
is_object_instance
(
v
)
||
!
get_object
(
v
))
{
jsval_release
(
v
);
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
}
obj
=
iface_to_jsdisp
((
IUnknown
*
)
get_object
(
v
));
...
...
@@ -1330,9 +1338,9 @@ static HRESULT interp_instanceof(exec_ctx_t *ctx)
}
if
(
is_class
(
obj
,
JSCLASS_FUNCTION
))
{
hres
=
jsdisp_propget_name
(
obj
,
prototypeW
,
&
prot
,
ctx
->
ei
);
hres
=
jsdisp_propget_name
(
obj
,
prototypeW
,
&
prot
);
}
else
{
hres
=
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
hres
=
throw_type_error
(
ctx
->
script
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
}
jsdisp_release
(
obj
);
if
(
FAILED
(
hres
))
...
...
@@ -1378,11 +1386,11 @@ static HRESULT interp_in(exec_ctx_t *ctx)
obj
=
stack_pop
(
ctx
);
if
(
!
is_object_instance
(
obj
)
||
!
get_object
(
obj
))
{
jsval_release
(
obj
);
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_OBJECT_EXPECTED
,
NULL
);
}
v
=
stack_pop
(
ctx
);
hres
=
to_string
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
str
);
hres
=
to_string
(
ctx
->
script
,
v
,
&
str
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
get_object
(
obj
));
...
...
@@ -1403,16 +1411,16 @@ static HRESULT interp_in(exec_ctx_t *ctx)
}
/* ECMA-262 3rd Edition 11.6.1 */
static
HRESULT
add_eval
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
js
except_t
*
ei
,
js
val_t
*
ret
)
static
HRESULT
add_eval
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
jsval_t
*
ret
)
{
jsval_t
r
,
l
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
lval
,
ei
,
&
l
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
lval
,
&
l
,
NO_HINT
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_primitive
(
ctx
,
rval
,
ei
,
&
r
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
rval
,
&
r
,
NO_HINT
);
if
(
FAILED
(
hres
))
{
jsval_release
(
l
);
return
hres
;
...
...
@@ -1424,13 +1432,13 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexcept_
if
(
is_string
(
l
))
lstr
=
get_string
(
l
);
else
hres
=
to_string
(
ctx
,
l
,
ei
,
&
lstr
);
hres
=
to_string
(
ctx
,
l
,
&
lstr
);
if
(
SUCCEEDED
(
hres
))
{
if
(
is_string
(
r
))
rstr
=
get_string
(
r
);
else
hres
=
to_string
(
ctx
,
r
,
ei
,
&
rstr
);
hres
=
to_string
(
ctx
,
r
,
&
rstr
);
}
if
(
SUCCEEDED
(
hres
))
{
...
...
@@ -1456,9 +1464,9 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexcept_
}
else
{
double
nl
,
nr
;
hres
=
to_number
(
ctx
,
l
,
ei
,
&
nl
);
hres
=
to_number
(
ctx
,
l
,
&
nl
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_number
(
ctx
,
r
,
ei
,
&
nr
);
hres
=
to_number
(
ctx
,
r
,
&
nr
);
if
(
SUCCEEDED
(
hres
))
*
ret
=
jsval_number
(
nl
+
nr
);
}
...
...
@@ -1480,7 +1488,7 @@ static HRESULT interp_add(exec_ctx_t *ctx)
TRACE
(
"%s + %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
add_eval
(
ctx
->
script
,
l
,
r
,
ctx
->
ei
,
&
ret
);
hres
=
add_eval
(
ctx
->
script
,
l
,
r
,
&
ret
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -1587,7 +1595,7 @@ static HRESULT interp_delete(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
&
name
);
jsval_release
(
namev
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
@@ -1711,7 +1719,7 @@ static HRESULT interp_typeofid(exec_ctx_t *ctx)
if
(
!
obj
)
return
stack_push_string
(
ctx
,
undefinedW
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
);
IDispatch_Release
(
obj
);
if
(
FAILED
(
hres
))
return
stack_push_string
(
ctx
,
unknownW
);
...
...
@@ -1745,7 +1753,7 @@ static HRESULT interp_typeofident(exec_ctx_t *ctx)
return
hres
;
}
hres
=
exprval_to_value
(
ctx
->
script
,
&
exprval
,
ctx
->
ei
,
&
v
);
hres
=
exprval_to_value
(
ctx
->
script
,
&
exprval
,
&
v
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1801,7 +1809,7 @@ static HRESULT interp_tonum(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
hres
=
to_number
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
n
);
hres
=
to_number
(
ctx
->
script
,
v
,
&
n
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1822,15 +1830,15 @@ static HRESULT interp_postinc(exec_ctx_t *ctx)
obj
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_OBJECT_EXPECTED
,
NULL
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
);
if
(
SUCCEEDED
(
hres
))
{
double
n
;
hres
=
to_number
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
n
);
hres
=
to_number
(
ctx
->
script
,
v
,
&
n
);
if
(
SUCCEEDED
(
hres
))
hres
=
disp_propput
(
ctx
->
script
,
obj
,
id
,
jsval_number
(
n
+
(
double
)
arg
)
,
ctx
->
ei
);
hres
=
disp_propput
(
ctx
->
script
,
obj
,
id
,
jsval_number
(
n
+
(
double
)
arg
));
if
(
FAILED
(
hres
))
jsval_release
(
v
);
}
...
...
@@ -1855,17 +1863,17 @@ static HRESULT interp_preinc(exec_ctx_t *ctx)
obj
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
obj
)
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_OBJECT_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
JS_E_OBJECT_EXPECTED
,
NULL
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
,
ctx
->
ei
);
hres
=
disp_propget
(
ctx
->
script
,
obj
,
id
,
&
v
);
if
(
SUCCEEDED
(
hres
))
{
double
n
;
hres
=
to_number
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
n
);
hres
=
to_number
(
ctx
->
script
,
v
,
&
n
);
jsval_release
(
v
);
if
(
SUCCEEDED
(
hres
))
{
ret
=
n
+
(
double
)
arg
;
hres
=
disp_propput
(
ctx
->
script
,
obj
,
id
,
jsval_number
(
ret
)
,
ctx
->
ei
);
hres
=
disp_propput
(
ctx
->
script
,
obj
,
id
,
jsval_number
(
ret
));
}
}
IDispatch_Release
(
obj
);
...
...
@@ -1876,16 +1884,16 @@ static HRESULT interp_preinc(exec_ctx_t *ctx)
}
/* ECMA-262 3rd Edition 11.9.3 */
static
HRESULT
equal_values
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
jsexcept_t
*
ei
,
BOOL
*
ret
)
static
HRESULT
equal_values
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
BOOL
*
ret
)
{
if
(
jsval_type
(
lval
)
==
jsval_type
(
rval
)
||
(
is_number
(
lval
)
&&
is_number
(
rval
)))
return
equal2_values
(
lval
,
rval
,
ret
);
/* FIXME: NULL disps should be handled in more general way */
if
(
is_object_instance
(
lval
)
&&
!
get_object
(
lval
))
return
equal_values
(
ctx
,
jsval_null
(),
rval
,
ei
,
ret
);
return
equal_values
(
ctx
,
jsval_null
(),
rval
,
ret
);
if
(
is_object_instance
(
rval
)
&&
!
get_object
(
rval
))
return
equal_values
(
ctx
,
lval
,
jsval_null
(),
ei
,
ret
);
return
equal_values
(
ctx
,
lval
,
jsval_null
(),
ret
);
if
((
is_null
(
lval
)
&&
is_undefined
(
rval
))
||
(
is_undefined
(
lval
)
&&
is_null
(
rval
)))
{
*
ret
=
TRUE
;
...
...
@@ -1896,42 +1904,42 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc
double
n
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
lval
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
lval
,
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
/* FIXME: optimize */
return
equal_values
(
ctx
,
jsval_number
(
n
),
rval
,
ei
,
ret
);
return
equal_values
(
ctx
,
jsval_number
(
n
),
rval
,
ret
);
}
if
(
is_string
(
rval
)
&&
is_number
(
lval
))
{
double
n
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
rval
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
rval
,
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
/* FIXME: optimize */
return
equal_values
(
ctx
,
lval
,
jsval_number
(
n
),
ei
,
ret
);
return
equal_values
(
ctx
,
lval
,
jsval_number
(
n
),
ret
);
}
if
(
is_bool
(
rval
))
return
equal_values
(
ctx
,
lval
,
jsval_number
(
get_bool
(
rval
)
?
1
:
0
),
ei
,
ret
);
return
equal_values
(
ctx
,
lval
,
jsval_number
(
get_bool
(
rval
)
?
1
:
0
),
ret
);
if
(
is_bool
(
lval
))
return
equal_values
(
ctx
,
jsval_number
(
get_bool
(
lval
)
?
1
:
0
),
rval
,
ei
,
ret
);
return
equal_values
(
ctx
,
jsval_number
(
get_bool
(
lval
)
?
1
:
0
),
rval
,
ret
);
if
(
is_object_instance
(
rval
)
&&
(
is_string
(
lval
)
||
is_number
(
lval
)))
{
jsval_t
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
rval
,
ei
,
&
prim
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
rval
,
&
prim
,
NO_HINT
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
equal_values
(
ctx
,
lval
,
prim
,
ei
,
ret
);
hres
=
equal_values
(
ctx
,
lval
,
prim
,
ret
);
jsval_release
(
prim
);
return
hres
;
}
...
...
@@ -1941,11 +1949,11 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc
jsval_t
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
lval
,
ei
,
&
prim
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
lval
,
&
prim
,
NO_HINT
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
equal_values
(
ctx
,
prim
,
rval
,
ei
,
ret
);
hres
=
equal_values
(
ctx
,
prim
,
rval
,
ret
);
jsval_release
(
prim
);
return
hres
;
}
...
...
@@ -1967,7 +1975,7 @@ static HRESULT interp_eq(exec_ctx_t *ctx)
TRACE
(
"%s == %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
equal_values
(
ctx
->
script
,
l
,
r
,
ctx
->
ei
,
&
b
);
hres
=
equal_values
(
ctx
->
script
,
l
,
r
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -1988,7 +1996,7 @@ static HRESULT interp_neq(exec_ctx_t *ctx)
TRACE
(
"%s != %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
equal_values
(
ctx
->
script
,
l
,
r
,
ctx
->
ei
,
&
b
);
hres
=
equal_values
(
ctx
->
script
,
l
,
r
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2040,17 +2048,17 @@ static HRESULT interp_neq2(exec_ctx_t *ctx)
}
/* ECMA-262 3rd Edition 11.8.5 */
static
HRESULT
less_eval
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
BOOL
greater
,
jsexcept_t
*
ei
,
BOOL
*
ret
)
static
HRESULT
less_eval
(
script_ctx_t
*
ctx
,
jsval_t
lval
,
jsval_t
rval
,
BOOL
greater
,
BOOL
*
ret
)
{
double
ln
,
rn
;
jsval_t
l
,
r
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
lval
,
ei
,
&
l
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
lval
,
&
l
,
NO_HINT
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_primitive
(
ctx
,
rval
,
ei
,
&
r
,
NO_HINT
);
hres
=
to_primitive
(
ctx
,
rval
,
&
r
,
NO_HINT
);
if
(
FAILED
(
hres
))
{
jsval_release
(
l
);
return
hres
;
...
...
@@ -2063,10 +2071,10 @@ static HRESULT less_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL gre
return
S_OK
;
}
hres
=
to_number
(
ctx
,
l
,
ei
,
&
ln
);
hres
=
to_number
(
ctx
,
l
,
&
ln
);
jsval_release
(
l
);
if
(
SUCCEEDED
(
hres
))
hres
=
to_number
(
ctx
,
r
,
ei
,
&
rn
);
hres
=
to_number
(
ctx
,
r
,
&
rn
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2087,7 +2095,7 @@ static HRESULT interp_lt(exec_ctx_t *ctx)
TRACE
(
"%s < %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
less_eval
(
ctx
->
script
,
l
,
r
,
FALSE
,
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
script
,
l
,
r
,
FALSE
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2108,7 +2116,7 @@ static HRESULT interp_lteq(exec_ctx_t *ctx)
TRACE
(
"%s <= %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
less_eval
(
ctx
->
script
,
r
,
l
,
TRUE
,
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
script
,
r
,
l
,
TRUE
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2129,7 +2137,7 @@ static HRESULT interp_gt(exec_ctx_t *ctx)
TRACE
(
"%s > %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
less_eval
(
ctx
->
script
,
r
,
l
,
FALSE
,
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
script
,
r
,
l
,
FALSE
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2150,7 +2158,7 @@ static HRESULT interp_gteq(exec_ctx_t *ctx)
TRACE
(
"%s >= %s
\n
"
,
debugstr_jsval
(
l
),
debugstr_jsval
(
r
));
hres
=
less_eval
(
ctx
->
script
,
l
,
r
,
TRUE
,
ctx
->
ei
,
&
b
);
hres
=
less_eval
(
ctx
->
script
,
l
,
r
,
TRUE
,
&
b
);
jsval_release
(
l
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
...
...
@@ -2169,7 +2177,7 @@ static HRESULT interp_bneg(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
hres
=
to_int32
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
i
);
hres
=
to_int32
(
ctx
->
script
,
v
,
&
i
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2263,10 +2271,10 @@ static HRESULT interp_assign(exec_ctx_t *ctx)
disp
=
stack_pop_objid
(
ctx
,
&
id
);
if
(
!
disp
)
{
jsval_release
(
v
);
return
throw_reference_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
return
throw_reference_error
(
ctx
->
script
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
}
hres
=
disp_propput
(
ctx
->
script
,
disp
,
id
,
v
,
ctx
->
ei
);
hres
=
disp_propput
(
ctx
->
script
,
disp
,
id
,
v
);
IDispatch_Release
(
disp
);
if
(
FAILED
(
hres
))
{
jsval_release
(
v
);
...
...
@@ -2289,9 +2297,9 @@ static HRESULT interp_assign_call(exec_ctx_t *ctx)
disp
=
stack_topn_objid
(
ctx
,
argc
+
1
,
&
id
);
if
(
!
disp
)
return
throw_reference_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
return
throw_reference_error
(
ctx
->
script
,
JS_E_ILLEGAL_ASSIGN
,
NULL
);
hres
=
disp_call
(
ctx
->
script
,
disp
,
id
,
DISPATCH_PROPERTYPUT
,
argc
+
1
,
stack_args
(
ctx
,
argc
+
1
),
NULL
,
ctx
->
ei
);
hres
=
disp_call
(
ctx
->
script
,
disp
,
id
,
DISPATCH_PROPERTYPUT
,
argc
+
1
,
stack_args
(
ctx
,
argc
+
1
),
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2398,7 +2406,7 @@ static HRESULT unwind_exception(exec_ctx_t *ctx)
hres
=
create_dispex
(
ctx
->
script
,
NULL
,
NULL
,
&
scope_obj
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
scope_obj
,
ident
,
except_val
,
ctx
->
ei
);
hres
=
jsdisp_propput_name
(
scope_obj
,
ident
,
except_val
);
if
(
FAILED
(
hres
))
jsdisp_release
(
scope_obj
);
}
...
...
@@ -2491,8 +2499,7 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, bytecode_t *code, function_code
return
S_OK
;
}
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
BOOL
from_eval
,
jsexcept_t
*
ei
,
jsval_t
*
ret
)
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
BOOL
from_eval
,
jsval_t
*
ret
)
{
exec_ctx_t
*
prev_ctx
;
jsval_t
val
;
...
...
@@ -2509,7 +2516,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
func
->
funcs
[
i
].
name
,
jsval_obj
(
func_obj
)
,
ei
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
func
->
funcs
[
i
].
name
,
jsval_obj
(
func_obj
));
jsdisp_release
(
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -2528,7 +2535,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
prev_ctx
=
ctx
->
script
->
exec_ctx
;
ctx
->
script
->
exec_ctx
=
ctx
;
hres
=
enter_bytecode
(
ctx
->
script
,
code
,
func
,
ei
,
&
val
);
hres
=
enter_bytecode
(
ctx
->
script
,
code
,
func
,
&
ctx
->
script
->
ei
,
&
val
);
assert
(
ctx
->
script
->
exec_ctx
==
ctx
);
ctx
->
script
->
exec_ctx
=
prev_ctx
;
if
(
FAILED
(
hres
))
...
...
dlls/jscript/engine.h
View file @
6f5475dd
...
...
@@ -246,7 +246,7 @@ static inline void exec_addref(exec_ctx_t *ctx)
void
exec_release
(
exec_ctx_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_exec_ctx
(
script_ctx_t
*
,
IDispatch
*
,
jsdisp_t
*
,
scope_chain_t
*
,
BOOL
,
exec_ctx_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
exec_source
(
exec_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
BOOL
,
js
except_t
*
,
js
val_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
exec_source
(
exec_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
BOOL
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_source_function
(
script_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
typedef
enum
{
...
...
dlls/jscript/error.c
View file @
6f5475dd
...
...
@@ -35,7 +35,7 @@ static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
/* ECMA-262 3rd Edition 15.11.4.4 */
static
HRESULT
Error_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
jsdisp_t
*
jsthis
;
BSTR
name
=
NULL
,
msg
=
NULL
,
ret
=
NULL
;
...
...
@@ -57,12 +57,12 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return
S_OK
;
}
hres
=
jsdisp_propget_name
(
jsthis
,
nameW
,
&
v
,
ei
);
hres
=
jsdisp_propget_name
(
jsthis
,
nameW
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
is_undefined
(
v
))
{
hres
=
to_string
(
ctx
,
v
,
ei
,
&
name
);
hres
=
to_string
(
ctx
,
v
,
&
name
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -72,10 +72,10 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
}
}
hres
=
jsdisp_propget_name
(
jsthis
,
messageW
,
&
v
,
ei
);
hres
=
jsdisp_propget_name
(
jsthis
,
messageW
,
&
v
);
if
(
SUCCEEDED
(
hres
))
{
if
(
!
is_undefined
(
v
))
{
hres
=
to_string
(
ctx
,
v
,
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
v
,
&
msg
);
jsval_release
(
v
);
if
(
SUCCEEDED
(
hres
)
&&
!*
msg
)
{
SysFreeString
(
msg
);
...
...
@@ -124,13 +124,13 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
}
static
HRESULT
Error_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
...
...
@@ -196,7 +196,7 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
err
,
numberW
,
jsval_number
((
INT
)
number
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
err
,
numberW
,
jsval_number
((
INT
)
number
));
if
(
FAILED
(
hres
))
{
jsdisp_release
(
err
);
return
hres
;
...
...
@@ -205,9 +205,9 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
if
(
msg
)
str
=
SysAllocString
(
msg
);
else
str
=
SysAllocStringLen
(
NULL
,
0
);
if
(
str
)
{
hres
=
jsdisp_propput_name
(
err
,
messageW
,
jsval_string
(
str
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
err
,
messageW
,
jsval_string
(
str
));
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
err
,
descriptionW
,
jsval_string
(
str
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
err
,
descriptionW
,
jsval_string
(
str
));
SysFreeString
(
str
);
}
else
{
hres
=
E_OUTOFMEMORY
;
...
...
@@ -222,7 +222,7 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
}
static
HRESULT
error_constr
(
script_ctx_t
*
ctx
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
js
except_t
*
ei
,
js
disp_t
*
constr
)
{
jsval_t
*
r
,
jsdisp_t
*
constr
)
{
jsdisp_t
*
err
;
UINT
num
=
0
;
BSTR
msg
=
NULL
;
...
...
@@ -231,18 +231,18 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_
if
(
argc
)
{
double
n
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
/* FIXME: really? */
n
=
NAN
;
if
(
isnan
(
n
))
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
msg
);
if
(
FAILED
(
hres
))
return
hres
;
num
=
n
;
}
if
(
argc
>
1
&&
!
msg
)
{
hres
=
to_string
(
ctx
,
argv
[
1
],
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
argv
[
1
],
&
msg
);
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
@@ -269,59 +269,59 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_
}
static
HRESULT
ErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
error_constr
);
}
static
HRESULT
EvalErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
eval_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
eval_error_constr
);
}
static
HRESULT
RangeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
range_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
range_error_constr
);
}
static
HRESULT
ReferenceErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
reference_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
reference_error_constr
);
}
static
HRESULT
RegExpErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
regexp_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
regexp_error_constr
);
}
static
HRESULT
SyntaxErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
syntax_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
syntax_error_constr
);
}
static
HRESULT
TypeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
type_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
type_error_constr
);
}
static
HRESULT
URIErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
uri_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ctx
->
uri_error_constr
);
}
HRESULT
init_error_constr
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
)
...
...
@@ -360,7 +360,7 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
return
E_OUTOFMEMORY
;
}
hres
=
jsdisp_propput_name
(
err
,
nameW
,
jsval_string
(
str
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
err
,
nameW
,
jsval_string
(
str
));
SysFreeString
(
str
);
if
(
SUCCEEDED
(
hres
))
hres
=
create_builtin_constructor
(
ctx
,
constr_val
[
i
],
names
[
i
],
NULL
,
...
...
@@ -374,7 +374,7 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
return
S_OK
;
}
static
HRESULT
throw_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
,
jsdisp_t
*
constr
)
static
HRESULT
throw_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
,
jsdisp_t
*
constr
)
{
WCHAR
buf
[
1024
],
*
pos
=
NULL
;
jsdisp_t
*
err
;
...
...
@@ -399,42 +399,42 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, con
if
(
FAILED
(
hres
))
return
hres
;
if
(
ei
)
ei
->
val
=
jsval_obj
(
err
);
jsval_release
(
ctx
->
ei
.
val
);
ctx
->
ei
.
val
=
jsval_obj
(
err
);
return
error
;
}
HRESULT
throw_generic_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_generic_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
error_constr
);
}
HRESULT
throw_range_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_range_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
range_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
range_error_constr
);
}
HRESULT
throw_reference_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_reference_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
reference_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
reference_error_constr
);
}
HRESULT
throw_regexp_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_regexp_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
regexp_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
regexp_error_constr
);
}
HRESULT
throw_syntax_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_syntax_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
syntax_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
syntax_error_constr
);
}
HRESULT
throw_type_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_type_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
type_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
type_error_constr
);
}
HRESULT
throw_uri_error
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
,
HRESULT
error
,
const
WCHAR
*
str
)
HRESULT
throw_uri_error
(
script_ctx_t
*
ctx
,
HRESULT
error
,
const
WCHAR
*
str
)
{
return
throw_error
(
ctx
,
e
i
,
e
rror
,
str
,
ctx
->
uri_error_constr
);
return
throw_error
(
ctx
,
error
,
str
,
ctx
->
uri_error_constr
);
}
dlls/jscript/function.c
View file @
6f5475dd
...
...
@@ -55,15 +55,14 @@ static const WCHAR applyW[] = {'a','p','p','l','y',0};
static
const
WCHAR
callW
[]
=
{
'c'
,
'a'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
argumentsW
[]
=
{
'a'
,
'r'
,
'g'
,
'u'
,
'm'
,
'e'
,
'n'
,
't'
,
's'
,
0
};
static
HRESULT
init_parameters
(
jsdisp_t
*
var_disp
,
FunctionInstance
*
function
,
unsigned
argc
,
jsval_t
*
argv
,
jsexcept_t
*
ei
)
static
HRESULT
init_parameters
(
jsdisp_t
*
var_disp
,
FunctionInstance
*
function
,
unsigned
argc
,
jsval_t
*
argv
)
{
DWORD
i
=
0
;
HRESULT
hres
;
for
(
i
=
0
;
i
<
function
->
func_code
->
param_cnt
;
i
++
)
{
hres
=
jsdisp_propput_name
(
var_disp
,
function
->
func_code
->
params
[
i
],
i
<
argc
?
argv
[
i
]
:
jsval_undefined
()
,
ei
);
i
<
argc
?
argv
[
i
]
:
jsval_undefined
());
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
@@ -72,7 +71,7 @@ static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, u
}
static
HRESULT
Arguments_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
...
...
@@ -86,8 +85,7 @@ static const builtin_info_t Arguments_info = {
NULL
};
static
HRESULT
create_arguments
(
script_ctx_t
*
ctx
,
IDispatch
*
calee
,
unsigned
argc
,
jsval_t
*
argv
,
jsexcept_t
*
ei
,
jsdisp_t
**
ret
)
static
HRESULT
create_arguments
(
script_ctx_t
*
ctx
,
IDispatch
*
calee
,
unsigned
argc
,
jsval_t
*
argv
,
jsdisp_t
**
ret
)
{
jsdisp_t
*
args
;
DWORD
i
;
...
...
@@ -106,16 +104,16 @@ static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, unsigned ar
}
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
args
,
i
,
argv
[
i
]
,
ei
);
hres
=
jsdisp_propput_idx
(
args
,
i
,
argv
[
i
]);
if
(
FAILED
(
hres
))
break
;
}
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
args
,
lengthW
,
jsval_number
(
argc
)
,
ei
);
hres
=
jsdisp_propput_name
(
args
,
lengthW
,
jsval_number
(
argc
));
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
args
,
caleeW
,
jsval_disp
(
calee
)
,
ei
);
hres
=
jsdisp_propput_name
(
args
,
caleeW
,
jsval_disp
(
calee
));
}
if
(
FAILED
(
hres
))
{
...
...
@@ -128,7 +126,7 @@ static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, unsigned ar
}
static
HRESULT
create_var_disp
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
jsdisp_t
*
arg_disp
,
unsigned
argc
,
jsval_t
*
argv
,
js
except_t
*
ei
,
js
disp_t
**
ret
)
unsigned
argc
,
jsval_t
*
argv
,
jsdisp_t
**
ret
)
{
jsdisp_t
*
var_disp
;
HRESULT
hres
;
...
...
@@ -137,9 +135,9 @@ static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, js
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
var_disp
,
argumentsW
,
jsval_obj
(
arg_disp
)
,
ei
);
hres
=
jsdisp_propput_name
(
var_disp
,
argumentsW
,
jsval_obj
(
arg_disp
));
if
(
SUCCEEDED
(
hres
))
hres
=
init_parameters
(
var_disp
,
function
,
argc
,
argv
,
ei
);
hres
=
init_parameters
(
var_disp
,
function
,
argc
,
argv
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
var_disp
);
return
hres
;
...
...
@@ -150,7 +148,7 @@ static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, js
}
static
HRESULT
invoke_source
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
var_disp
,
*
arg_disp
;
exec_ctx_t
*
exec_ctx
;
...
...
@@ -162,11 +160,11 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
return
E_FAIL
;
}
hres
=
create_arguments
(
ctx
,
to_disp
(
&
function
->
dispex
),
argc
,
argv
,
ei
,
&
arg_disp
);
hres
=
create_arguments
(
ctx
,
to_disp
(
&
function
->
dispex
),
argc
,
argv
,
&
arg_disp
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_var_disp
(
ctx
,
function
,
arg_disp
,
argc
,
argv
,
ei
,
&
var_disp
);
hres
=
create_var_disp
(
ctx
,
function
,
arg_disp
,
argc
,
argv
,
&
var_disp
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
arg_disp
);
return
hres
;
...
...
@@ -183,7 +181,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
prev_args
=
function
->
arguments
;
function
->
arguments
=
arg_disp
;
hres
=
exec_source
(
exec_ctx
,
function
->
code
,
function
->
func_code
,
FALSE
,
ei
,
r
);
hres
=
exec_source
(
exec_ctx
,
function
->
code
,
function
->
func_code
,
FALSE
,
r
);
function
->
arguments
=
prev_args
;
}
...
...
@@ -193,7 +191,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
}
static
HRESULT
invoke_constructor
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
this_obj
;
jsval_t
var
;
...
...
@@ -203,7 +201,7 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function,
if
(
FAILED
(
hres
))
return
hres
;
hres
=
invoke_source
(
ctx
,
function
,
to_disp
(
this_obj
),
argc
,
argv
,
&
var
,
ei
);
hres
=
invoke_source
(
ctx
,
function
,
to_disp
(
this_obj
),
argc
,
argv
,
&
var
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
this_obj
);
return
hres
;
...
...
@@ -219,8 +217,8 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function,
return
S_OK
;
}
static
HRESULT
invoke_value_proc
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_disp
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
invoke_value_proc
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_disp
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
vdisp_t
vthis
;
HRESULT
hres
;
...
...
@@ -232,19 +230,19 @@ static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function,
else
set_jsdisp
(
&
vthis
,
ctx
->
global
);
hres
=
function
->
value_proc
(
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
,
ei
);
hres
=
function
->
value_proc
(
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
);
vdisp_release
(
&
vthis
);
return
hres
;
}
static
HRESULT
call_function
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
if
(
function
->
value_proc
)
return
invoke_value_proc
(
ctx
,
function
,
this_obj
,
DISPATCH_METHOD
,
argc
,
argv
,
r
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
this_obj
,
DISPATCH_METHOD
,
argc
,
argv
,
r
);
return
invoke_source
(
ctx
,
function
,
this_obj
,
argc
,
argv
,
r
,
ei
);
return
invoke_source
(
ctx
,
function
,
this_obj
,
argc
,
argv
,
r
);
}
static
HRESULT
function_to_string
(
FunctionInstance
*
function
,
BSTR
*
ret
)
...
...
@@ -276,7 +274,7 @@ static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
return
S_OK
;
}
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FunctionInstance
*
function
;
...
...
@@ -286,17 +284,17 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi
function
=
(
FunctionInstance
*
)
func_this
;
if
(
function
->
value_proc
)
return
invoke_value_proc
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
return
invoke_value_proc
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
flags
,
argc
,
argv
,
r
);
if
(
flags
==
DISPATCH_CONSTRUCT
)
return
invoke_constructor
(
function
->
dispex
.
ctx
,
function
,
argc
,
argv
,
r
,
ei
);
return
invoke_constructor
(
function
->
dispex
.
ctx
,
function
,
argc
,
argv
,
r
);
assert
(
flags
==
DISPATCH_METHOD
);
return
invoke_source
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
argc
,
argv
,
r
,
ei
);
return
invoke_source
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
argc
,
argv
,
r
);
}
static
HRESULT
Function_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FunctionInstance
*
This
=
function_from_vdisp
(
jsthis
);
...
...
@@ -315,7 +313,7 @@ static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
static
HRESULT
Function_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FunctionInstance
*
function
;
BSTR
str
;
...
...
@@ -324,7 +322,7 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
if
(
!
(
function
=
function_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
hres
=
function_to_string
(
function
,
&
str
);
if
(
FAILED
(
hres
))
...
...
@@ -337,17 +335,17 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
static
HRESULT
array_to_args
(
script_ctx_t
*
ctx
,
jsdisp_t
*
arg_array
,
jsexcept_t
*
ei
,
unsigned
*
argc
,
jsval_t
**
ret
)
static
HRESULT
array_to_args
(
script_ctx_t
*
ctx
,
jsdisp_t
*
arg_array
,
unsigned
*
argc
,
jsval_t
**
ret
)
{
jsval_t
*
argv
,
val
;
DWORD
length
,
i
;
HRESULT
hres
;
hres
=
jsdisp_propget_name
(
arg_array
,
lengthW
,
&
val
,
ei
);
hres
=
jsdisp_propget_name
(
arg_array
,
lengthW
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_uint32
(
ctx
,
val
,
ei
,
&
length
);
hres
=
to_uint32
(
ctx
,
val
,
&
length
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -357,7 +355,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
arg_array
,
i
,
argv
+
i
,
ei
);
hres
=
jsdisp_get_idx
(
arg_array
,
i
,
argv
+
i
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
{
argv
[
i
]
=
jsval_undefined
();
}
else
if
(
FAILED
(
hres
))
{
...
...
@@ -373,8 +371,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
return
S_OK
;
}
static
HRESULT
Function_apply
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
Function_apply
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FunctionInstance
*
function
;
jsval_t
*
args
=
NULL
;
...
...
@@ -385,7 +382,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
if
(
!
(
function
=
function_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
if
(
argc
)
{
if
(
!
is_undefined
(
argv
[
0
])
&&
!
is_null
(
argv
[
0
]))
{
...
...
@@ -408,7 +405,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
arg_array
)
{
hres
=
array_to_args
(
ctx
,
arg_array
,
ei
,
&
cnt
,
&
args
);
hres
=
array_to_args
(
ctx
,
arg_array
,
&
cnt
,
&
args
);
jsdisp_release
(
arg_array
);
}
else
{
FIXME
(
"throw TypeError
\n
"
);
...
...
@@ -417,7 +414,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
SUCCEEDED
(
hres
))
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
r
,
ei
);
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
r
);
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
...
...
@@ -428,7 +425,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
Function_call
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FunctionInstance
*
function
;
IDispatch
*
this_obj
=
NULL
;
...
...
@@ -438,7 +435,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
if
(
!
(
function
=
function_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
if
(
argc
)
{
if
(
!
is_undefined
(
argv
[
0
])
&&
!
is_null
(
argv
[
0
]))
{
...
...
@@ -450,7 +447,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
cnt
=
argc
-
1
;
}
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
argv
+
1
,
r
,
ei
);
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
argv
+
1
,
r
);
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
...
...
@@ -458,7 +455,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
HRESULT
Function_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FunctionInstance
*
function
;
...
...
@@ -474,7 +471,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
switch
(
flags
)
{
case
DISPATCH_METHOD
:
assert
(
function
->
value_proc
!=
NULL
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
);
case
DISPATCH_PROPERTYGET
:
{
HRESULT
hres
;
...
...
@@ -490,7 +487,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
case
DISPATCH_CONSTRUCT
:
assert
(
function
->
value_proc
!=
NULL
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
);
default:
FIXME
(
"not implemented flags %x
\n
"
,
flags
);
...
...
@@ -501,7 +498,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
}
static
HRESULT
Function_arguments
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FunctionInstance
*
function
=
(
FunctionInstance
*
)
jsthis
->
u
.
jsdisp
;
HRESULT
hres
=
S_OK
;
...
...
@@ -591,12 +588,9 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
return
S_OK
;
}
static
HRESULT
set_prototype
(
script_ctx_t
*
ctx
,
jsdisp_t
*
dispex
,
jsdisp_t
*
prototype
)
static
inline
HRESULT
set_prototype
(
script_ctx_t
*
ctx
,
jsdisp_t
*
dispex
,
jsdisp_t
*
prototype
)
{
jsexcept_t
jsexcept
;
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
));
return
jsdisp_propput_name
(
dispex
,
prototypeW
,
jsval_obj
(
prototype
),
&
jsexcept
);
return
jsdisp_propput_name
(
dispex
,
prototypeW
,
jsval_obj
(
prototype
));
}
HRESULT
create_builtin_function
(
script_ctx_t
*
ctx
,
builtin_invoke_t
value_proc
,
const
WCHAR
*
name
,
...
...
@@ -689,7 +683,7 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
return
S_OK
;
}
static
HRESULT
construct_function
(
script_ctx_t
*
ctx
,
unsigned
argc
,
jsval_t
*
argv
,
jsexcept_t
*
ei
,
IDispatch
**
ret
)
static
HRESULT
construct_function
(
script_ctx_t
*
ctx
,
unsigned
argc
,
jsval_t
*
argv
,
IDispatch
**
ret
)
{
WCHAR
*
str
=
NULL
,
*
ptr
;
DWORD
len
=
0
,
l
;
...
...
@@ -711,7 +705,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
if
(
argc
>
2
)
len
=
(
argc
-
2
)
*
2
;
/* separating commas */
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_string
(
ctx
,
argv
[
i
],
ei
,
params
+
i
);
hres
=
to_string
(
ctx
,
argv
[
i
],
params
+
i
);
if
(
FAILED
(
hres
))
break
;
len
+=
SysStringLen
(
params
[
i
]);
...
...
@@ -777,7 +771,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
}
static
HRESULT
FunctionConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
HRESULT
hres
;
...
...
@@ -787,7 +781,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
case
DISPATCH_CONSTRUCT
:
{
IDispatch
*
ret
;
hres
=
construct_function
(
ctx
,
argc
,
argv
,
ei
,
&
ret
);
hres
=
construct_function
(
ctx
,
argc
,
argv
,
&
ret
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -803,7 +797,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
}
static
HRESULT
FunctionProt_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
...
...
dlls/jscript/global.c
View file @
6f5475dd
...
...
@@ -114,169 +114,168 @@ static WCHAR int_to_char(int i)
return
'A'
+
i
-
10
;
}
static
HRESULT
constructor_call
(
jsdisp_t
*
constr
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
static
HRESULT
constructor_call
(
jsdisp_t
*
constr
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
if
(
flags
!=
DISPATCH_PROPERTYGET
)
return
jsdisp_call_value
(
constr
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
return
jsdisp_call_value
(
constr
,
NULL
,
flags
,
argc
,
argv
,
r
);
*
r
=
jsval_obj
(
jsdisp_addref
(
constr
));
return
S_OK
;
}
static
HRESULT
JSGlobal_Array
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
array_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
array_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Boolean
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
bool_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
bool_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Date
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
date_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
date_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Error
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_EvalError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
eval_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
eval_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_RangeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
range_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
range_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_RegExpError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
regexp_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
regexp_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_ReferenceError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
reference_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
reference_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_SyntaxError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
syntax_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
syntax_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_TypeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
type_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
type_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_URIError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
uri_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
uri_error_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Function
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
function_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
function_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Number
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
number_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
number_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Object
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
object_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
object_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_String
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
string_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
string_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_RegExp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
regexp_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
regexp_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_ActiveXObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
activex_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
activex_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_VBArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
vbarray_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
return
constructor_call
(
ctx
->
vbarray_constr
,
flags
,
argc
,
argv
,
r
);
}
static
HRESULT
JSGlobal_Enumerator
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
JSGlobal_escape
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
ret
,
str
;
const
WCHAR
*
ptr
;
...
...
@@ -297,7 +296,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -346,7 +345,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.1.2.1 */
static
HRESULT
JSGlobal_eval
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
bytecode_t
*
code
;
HRESULT
hres
;
...
...
@@ -374,16 +373,16 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
hres
=
compile_script
(
ctx
,
get_string
(
argv
[
0
]),
NULL
,
TRUE
,
FALSE
,
&
code
);
if
(
FAILED
(
hres
))
{
WARN
(
"parse (%s) failed: %08x
\n
"
,
debugstr_jsval
(
argv
[
0
]),
hres
);
return
throw_syntax_error
(
ctx
,
ei
,
hres
,
NULL
);
return
throw_syntax_error
(
ctx
,
hres
,
NULL
);
}
hres
=
exec_source
(
ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
TRUE
,
ei
,
r
);
hres
=
exec_source
(
ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
TRUE
,
r
);
release_bytecode
(
code
);
return
hres
;
}
static
HRESULT
JSGlobal_isNaN
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BOOL
ret
=
TRUE
;
double
n
;
...
...
@@ -392,7 +391,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
if
(
argc
)
{
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -406,7 +405,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
JSGlobal_isFinite
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BOOL
ret
=
FALSE
;
HRESULT
hres
;
...
...
@@ -416,7 +415,7 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
argc
)
{
double
n
;
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -441,7 +440,7 @@ static INT char_to_int(WCHAR c)
}
static
HRESULT
JSGlobal_parseInt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BOOL
neg
=
FALSE
,
empty
=
TRUE
;
DOUBLE
ret
=
0
.
0
;
...
...
@@ -457,7 +456,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
if
(
argc
>=
2
)
{
hres
=
to_int32
(
ctx
,
argv
[
1
],
ei
,
&
radix
);
hres
=
to_int32
(
ctx
,
argv
[
1
],
&
radix
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -469,7 +468,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -521,7 +520,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
static
HRESULT
JSGlobal_parseFloat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
LONGLONG
d
=
0
,
hlp
;
int
exp
=
0
;
...
...
@@ -536,7 +535,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
val_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -628,7 +627,7 @@ static inline int hex_to_int(const WCHAR wch) {
}
static
HRESULT
JSGlobal_unescape
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
ret
,
str
;
const
WCHAR
*
ptr
;
...
...
@@ -648,7 +647,7 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -702,14 +701,14 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
static
HRESULT
JSGlobal_GetObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
JSGlobal_ScriptEngine
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
JScriptW
[]
=
{
'J'
,
'S'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
0
};
...
...
@@ -729,7 +728,7 @@ static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
}
static
HRESULT
JSGlobal_ScriptEngineMajorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -739,7 +738,7 @@ static HRESULT JSGlobal_ScriptEngineMajorVersion(script_ctx_t *ctx, vdisp_t *jst
}
static
HRESULT
JSGlobal_ScriptEngineMinorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -749,7 +748,7 @@ static HRESULT JSGlobal_ScriptEngineMinorVersion(script_ctx_t *ctx, vdisp_t *jst
}
static
HRESULT
JSGlobal_ScriptEngineBuildVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -759,14 +758,14 @@ static HRESULT JSGlobal_ScriptEngineBuildVersion(script_ctx_t *ctx, vdisp_t *jst
}
static
HRESULT
JSGlobal_CollectGarbage
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
JSGlobal_encodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
ptr
;
DWORD
len
=
0
,
i
;
...
...
@@ -789,7 +788,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -800,7 +799,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
i
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
ptr
,
1
,
NULL
,
0
,
NULL
,
NULL
)
*
3
;
if
(
!
i
)
{
SysFreeString
(
str
);
return
throw_uri_error
(
ctx
,
ei
,
JS_E_INVALID_URI_CHAR
,
NULL
);
return
throw_uri_error
(
ctx
,
JS_E_INVALID_URI_CHAR
,
NULL
);
}
len
+=
i
;
...
...
@@ -837,7 +836,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
JSGlobal_decodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
str
,
ret
;
WCHAR
*
ptr
;
...
...
@@ -860,7 +859,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -882,7 +881,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
!
res
)
{
SysFreeString
(
str
);
return
throw_uri_error
(
ctx
,
ei
,
JS_E_INVALID_URI_CODING
,
NULL
);
return
throw_uri_error
(
ctx
,
JS_E_INVALID_URI_CODING
,
NULL
);
}
ptr
+=
i
*
3
+
2
;
...
...
@@ -929,7 +928,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
JSGlobal_encodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
str
,
ret
;
char
buf
[
4
];
...
...
@@ -951,7 +950,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -962,7 +961,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
size
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
ptr
,
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
size
)
{
SysFreeString
(
str
);
return
throw_uri_error
(
ctx
,
ei
,
JS_E_INVALID_URI_CHAR
,
NULL
);
return
throw_uri_error
(
ctx
,
JS_E_INVALID_URI_CHAR
,
NULL
);
}
len
+=
size
*
3
;
}
...
...
@@ -999,7 +998,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
/* ECMA-262 3rd Edition 15.1.3.2 */
static
HRESULT
JSGlobal_decodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
str
,
ret
;
const
WCHAR
*
ptr
;
...
...
@@ -1021,7 +1020,7 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1240,19 +1239,19 @@ HRESULT init_global(script_ctx_t *ctx)
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
ctx
->
global
,
MathW
,
jsval_obj
(
math
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
ctx
->
global
,
MathW
,
jsval_obj
(
math
));
jsdisp_release
(
math
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
ctx
->
global
,
undefinedW
,
jsval_undefined
()
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
ctx
->
global
,
undefinedW
,
jsval_undefined
());
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
ctx
->
global
,
NaNW
,
jsval_number
(
NAN
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
ctx
->
global
,
NaNW
,
jsval_number
(
NAN
));
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_name
(
ctx
->
global
,
InfinityW
,
jsval_number
(
INFINITY
)
,
NULL
/*FIXME*/
);
hres
=
jsdisp_propput_name
(
ctx
->
global
,
InfinityW
,
jsval_number
(
INFINITY
));
return
hres
;
}
dlls/jscript/jscript.c
View file @
6f5475dd
...
...
@@ -68,6 +68,7 @@ void script_release(script_ctx_t *ctx)
if
(
--
ctx
->
ref
)
return
;
clear_ei
(
ctx
);
if
(
ctx
->
cc
)
release_cc
(
ctx
->
cc
);
jsheap_free
(
&
ctx
->
tmp_heap
);
...
...
@@ -99,7 +100,6 @@ static inline BOOL is_started(script_ctx_t *ctx)
static
HRESULT
exec_global_code
(
JScript
*
This
,
bytecode_t
*
code
)
{
exec_ctx_t
*
exec_ctx
;
jsexcept_t
jsexcept
;
HRESULT
hres
;
hres
=
create_exec_ctx
(
This
->
ctx
,
NULL
,
This
->
ctx
->
global
,
NULL
,
TRUE
,
&
exec_ctx
);
...
...
@@ -108,9 +108,8 @@ static HRESULT exec_global_code(JScript *This, bytecode_t *code)
IActiveScriptSite_OnEnterScript
(
This
->
site
);
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
));
hres
=
exec_source
(
exec_ctx
,
code
,
&
code
->
global_code
,
FALSE
,
&
jsexcept
,
NULL
);
jsval_release
(
jsexcept
.
val
);
clear_ei
(
This
->
ctx
);
hres
=
exec_source
(
exec_ctx
,
code
,
&
code
->
global_code
,
FALSE
,
NULL
);
exec_release
(
exec_ctx
);
IActiveScriptSite_OnLeaveScript
(
This
->
site
);
...
...
@@ -716,6 +715,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
ctx
->
active_script
=
&
This
->
IActiveScript_iface
;
ctx
->
safeopt
=
This
->
safeopt
;
ctx
->
version
=
This
->
version
;
ctx
->
ei
.
val
=
jsval_undefined
();
jsheap_init
(
&
ctx
->
tmp_heap
);
hres
=
create_jscaller
(
ctx
);
...
...
dlls/jscript/jscript.h
View file @
6f5475dd
...
...
@@ -149,7 +149,7 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp)
return
is_jsdisp
(
vdisp
)
?
vdisp
->
u
.
jsdisp
:
NULL
;
}
typedef
HRESULT
(
*
builtin_invoke_t
)(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
);
typedef
HRESULT
(
*
builtin_invoke_t
)(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
);
typedef
struct
{
const
WCHAR
*
name
;
...
...
@@ -204,20 +204,20 @@ HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**)
HRESULT
init_dispex
(
jsdisp_t
*
,
script_ctx_t
*
,
const
builtin_info_t
*
,
jsdisp_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
init_dispex_from_constr
(
jsdisp_t
*
,
script_ctx_t
*
,
const
builtin_info_t
*
,
jsdisp_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_value
(
script_ctx_t
*
,
IDispatch
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call
(
jsdisp_t
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_name
(
jsdisp_t
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propget
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propput
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
jsval_t
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget
(
jsdisp_t
*
,
DISPID
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
,
const
WCHAR
*
,
jsval_t
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_value
(
script_ctx_t
*
,
IDispatch
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call
(
jsdisp_t
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_name
(
jsdisp_t
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propget
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propput
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget
(
jsdisp_t
*
,
DISPID
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
,
const
WCHAR
*
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_const
(
jsdisp_t
*
,
const
WCHAR
*
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_dontenum
(
jsdisp_t
*
,
const
WCHAR
*
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
,
DWORD
,
jsval_t
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget_name
(
jsdisp_t
*
,
LPCWSTR
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_get_idx
(
jsdisp_t
*
,
DWORD
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
,
DWORD
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget_name
(
jsdisp_t
*
,
LPCWSTR
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_get_idx
(
jsdisp_t
*
,
DWORD
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_get_id
(
jsdisp_t
*
,
const
WCHAR
*
,
DWORD
,
DISPID
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_delete_idx
(
jsdisp_t
*
,
DWORD
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_is_own_prop
(
jsdisp_t
*
,
BSTR
,
BOOL
*
)
DECLSPEC_HIDDEN
;
...
...
@@ -226,17 +226,17 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_builtin_constructor
(
script_ctx_t
*
,
builtin_invoke_t
,
const
WCHAR
*
,
const
builtin_info_t
*
,
DWORD
,
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
Function_value
(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_eval_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_generic_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_range_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_reference_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_regexp_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_syntax_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_type_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_uri_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_value
(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_eval_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_generic_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_range_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_reference_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_regexp_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_syntax_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_type_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_uri_error
(
script_ctx_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_object
(
script_ctx_t
*
,
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_math
(
script_ctx_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
...
...
@@ -254,13 +254,13 @@ typedef enum {
HINT_NUMBER
}
hint_t
;
HRESULT
to_primitive
(
script_ctx_t
*
,
jsval_t
,
js
except_t
*
,
js
val_t
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_primitive
(
script_ctx_t
*
,
jsval_t
,
jsval_t
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean
(
jsval_t
,
BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_int32
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
INT
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_uint32
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
jsval_t
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
jsval_t
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_int32
(
script_ctx_t
*
,
jsval_t
,
INT
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_uint32
(
script_ctx_t
*
,
jsval_t
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
jsval_t
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_object
(
script_ctx_t
*
,
jsval_t
,
IDispatch
**
)
DECLSPEC_HIDDEN
;
HRESULT
variant_change_type
(
script_ctx_t
*
,
VARIANT
*
,
VARIANT
*
,
VARTYPE
)
DECLSPEC_HIDDEN
;
...
...
@@ -293,6 +293,13 @@ typedef struct {
script_ctx_t
*
ctx
;
}
JSCaller
;
#include "jsval.h"
struct
_jsexcept_t
{
EXCEPINFO
ei
;
jsval_t
val
;
};
struct
_script_ctx_t
{
LONG
ref
;
...
...
@@ -308,6 +315,7 @@ struct _script_ctx_t {
LCID
lcid
;
cc_ctx_t
*
cc
;
JSCaller
*
jscaller
;
jsexcept_t
ei
;
jsheap_t
tmp_heap
;
...
...
@@ -339,6 +347,7 @@ struct _script_ctx_t {
};
void
script_release
(
script_ctx_t
*
)
DECLSPEC_HIDDEN
;
void
clear_ei
(
script_ctx_t
*
)
DECLSPEC_HIDDEN
;
static
inline
void
script_addref
(
script_ctx_t
*
ctx
)
{
...
...
@@ -375,7 +384,7 @@ HRESULT regexp_match_next(script_ctx_t*,jsdisp_t*,DWORD,const WCHAR*,DWORD,const
DWORD
*
,
DWORD
*
,
match_result_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
regexp_match
(
script_ctx_t
*
,
jsdisp_t
*
,
const
WCHAR
*
,
DWORD
,
BOOL
,
match_result_t
**
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
parse_regexp_flags
(
const
WCHAR
*
,
DWORD
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
regexp_string_match
(
script_ctx_t
*
,
jsdisp_t
*
,
BSTR
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
regexp_string_match
(
script_ctx_t
*
,
jsdisp_t
*
,
BSTR
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
is_class
(
jsdisp_t
*
jsdisp
,
jsclass_t
class
)
{
...
...
@@ -502,10 +511,3 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return
ret
;
}
#include "jsval.h"
struct
_jsexcept_t
{
EXCEPINFO
ei
;
jsval_t
val
;
};
dlls/jscript/jsutils.c
View file @
6f5475dd
...
...
@@ -380,7 +380,7 @@ HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
}
/* ECMA-262 3rd Edition 9.1 */
HRESULT
to_primitive
(
script_ctx_t
*
ctx
,
jsval_t
val
,
js
except_t
*
ei
,
js
val_t
*
ret
,
hint_t
hint
)
HRESULT
to_primitive
(
script_ctx_t
*
ctx
,
jsval_t
val
,
jsval_t
*
ret
,
hint_t
hint
)
{
if
(
is_object_instance
(
val
))
{
jsdisp_t
*
jsdisp
;
...
...
@@ -398,7 +398,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
jsdisp
=
iface_to_jsdisp
((
IUnknown
*
)
get_object
(
val
));
if
(
!
jsdisp
)
return
disp_propget
(
ctx
,
get_object
(
val
),
DISPID_VALUE
,
ret
,
ei
);
return
disp_propget
(
ctx
,
get_object
(
val
),
DISPID_VALUE
,
ret
);
if
(
hint
==
NO_HINT
)
hint
=
is_class
(
jsdisp
,
JSCLASS_DATE
)
?
HINT_STRING
:
HINT_NUMBER
;
...
...
@@ -407,7 +407,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
hres
=
jsdisp_get_id
(
jsdisp
,
hint
==
HINT_STRING
?
toStringW
:
valueOfW
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_call
(
jsdisp
,
id
,
DISPATCH_METHOD
,
0
,
NULL
,
&
prim
,
ei
);
hres
=
jsdisp_call
(
jsdisp
,
id
,
DISPATCH_METHOD
,
0
,
NULL
,
&
prim
);
if
(
FAILED
(
hres
))
{
WARN
(
"call error - forwarding exception
\n
"
);
jsdisp_release
(
jsdisp
);
...
...
@@ -423,7 +423,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
hres
=
jsdisp_get_id
(
jsdisp
,
hint
==
HINT_STRING
?
valueOfW
:
toStringW
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_call
(
jsdisp
,
id
,
DISPATCH_METHOD
,
0
,
NULL
,
&
prim
,
ei
);
hres
=
jsdisp_call
(
jsdisp
,
id
,
DISPATCH_METHOD
,
0
,
NULL
,
&
prim
);
if
(
FAILED
(
hres
))
{
WARN
(
"call error - forwarding exception
\n
"
);
jsdisp_release
(
jsdisp
);
...
...
@@ -440,7 +440,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
jsdisp_release
(
jsdisp
);
WARN
(
"failed
\n
"
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_TO_PRIMITIVE
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_TO_PRIMITIVE
,
NULL
);
}
return
jsval_copy
(
val
,
ret
);
...
...
@@ -586,7 +586,7 @@ static HRESULT str_to_number(BSTR str, double *ret)
}
/* ECMA-262 3rd Edition 9.3 */
HRESULT
to_number
(
script_ctx_t
*
ctx
,
jsval_t
val
,
jsexcept_t
*
ei
,
double
*
ret
)
HRESULT
to_number
(
script_ctx_t
*
ctx
,
jsval_t
val
,
double
*
ret
)
{
switch
(
jsval_type
(
val
))
{
case
JSV_UNDEFINED
:
...
...
@@ -604,11 +604,11 @@ HRESULT to_number(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, double *ret)
jsval_t
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
val
,
ei
,
&
prim
,
HINT_NUMBER
);
hres
=
to_primitive
(
ctx
,
val
,
&
prim
,
HINT_NUMBER
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
ctx
,
prim
,
ei
,
ret
);
hres
=
to_number
(
ctx
,
prim
,
ret
);
jsval_release
(
prim
);
return
hres
;
}
...
...
@@ -625,12 +625,12 @@ HRESULT to_number(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, double *ret)
}
/* ECMA-262 3rd Edition 9.4 */
HRESULT
to_integer
(
script_ctx_t
*
ctx
,
jsval_t
v
,
jsexcept_t
*
ei
,
double
*
ret
)
HRESULT
to_integer
(
script_ctx_t
*
ctx
,
jsval_t
v
,
double
*
ret
)
{
double
n
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
v
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
v
,
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -642,12 +642,12 @@ HRESULT to_integer(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret)
}
/* ECMA-262 3rd Edition 9.5 */
HRESULT
to_int32
(
script_ctx_t
*
ctx
,
jsval_t
v
,
jsexcept_t
*
ei
,
INT
*
ret
)
HRESULT
to_int32
(
script_ctx_t
*
ctx
,
jsval_t
v
,
INT
*
ret
)
{
double
n
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
v
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
v
,
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -656,12 +656,12 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret)
}
/* ECMA-262 3rd Edition 9.6 */
HRESULT
to_uint32
(
script_ctx_t
*
ctx
,
jsval_t
val
,
jsexcept_t
*
ei
,
DWORD
*
ret
)
HRESULT
to_uint32
(
script_ctx_t
*
ctx
,
jsval_t
val
,
DWORD
*
ret
)
{
double
n
;
HRESULT
hres
;
hres
=
to_number
(
ctx
,
val
,
ei
,
&
n
);
hres
=
to_number
(
ctx
,
val
,
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -728,7 +728,7 @@ HRESULT double_to_bstr(double n, BSTR *str)
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string
(
script_ctx_t
*
ctx
,
jsval_t
val
,
jsexcept_t
*
ei
,
BSTR
*
str
)
HRESULT
to_string
(
script_ctx_t
*
ctx
,
jsval_t
val
,
BSTR
*
str
)
{
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
const
WCHAR
nullW
[]
=
{
'n'
,
'u'
,
'l'
,
'l'
,
0
};
...
...
@@ -751,11 +751,11 @@ HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, BSTR *str)
jsval_t
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
val
,
ei
,
&
prim
,
HINT_STRING
);
hres
=
to_primitive
(
ctx
,
val
,
&
prim
,
HINT_STRING
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
prim
,
ei
,
str
);
hres
=
to_string
(
ctx
,
prim
,
str
);
jsval_release
(
prim
);
return
hres
;
}
...
...
@@ -837,22 +837,20 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
HRESULT
variant_change_type
(
script_ctx_t
*
ctx
,
VARIANT
*
dst
,
VARIANT
*
src
,
VARTYPE
vt
)
{
jsexcept_t
ei
;
jsval_t
val
;
HRESULT
hres
;
clear_ei
(
ctx
);
hres
=
variant_to_jsval
(
src
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
memset
(
&
ei
,
0
,
sizeof
(
ei
));
switch
(
vt
)
{
case
VT_I2
:
case
VT_I4
:
{
INT
i
;
hres
=
to_int32
(
ctx
,
val
,
&
ei
,
&
i
);
hres
=
to_int32
(
ctx
,
val
,
&
i
);
if
(
SUCCEEDED
(
hres
))
{
if
(
vt
==
VT_I4
)
V_I4
(
dst
)
=
i
;
...
...
@@ -863,7 +861,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
}
case
VT_R8
:
{
double
n
;
hres
=
to_number
(
ctx
,
val
,
&
ei
,
&
n
);
hres
=
to_number
(
ctx
,
val
,
&
n
);
if
(
SUCCEEDED
(
hres
))
V_R8
(
dst
)
=
n
;
break
;
...
...
@@ -871,7 +869,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
case
VT_R4
:
{
double
n
;
hres
=
to_number
(
ctx
,
val
,
&
ei
,
&
n
);
hres
=
to_number
(
ctx
,
val
,
&
n
);
if
(
SUCCEEDED
(
hres
))
V_R4
(
dst
)
=
n
;
break
;
...
...
@@ -887,7 +885,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
case
VT_BSTR
:
{
BSTR
str
;
hres
=
to_string
(
ctx
,
val
,
&
ei
,
&
str
);
hres
=
to_string
(
ctx
,
val
,
&
str
);
if
(
SUCCEEDED
(
hres
))
V_BSTR
(
dst
)
=
str
;
break
;
...
...
@@ -904,10 +902,8 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
}
jsval_release
(
val
);
if
(
FAILED
(
hres
))
{
jsval_release
(
ei
.
val
);
if
(
FAILED
(
hres
))
return
hres
;
}
V_VT
(
dst
)
=
vt
;
return
S_OK
;
...
...
dlls/jscript/math.c
View file @
6f5475dd
...
...
@@ -59,7 +59,7 @@ static const WCHAR tanW[] = {'t','a','n',0};
/* ECMA-262 3rd Edition 15.8.2.12 */
static
HRESULT
Math_abs
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
d
;
HRESULT
hres
;
...
...
@@ -72,7 +72,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -82,7 +82,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
}
static
HRESULT
Math_acos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -95,7 +95,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -105,7 +105,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
}
static
HRESULT
Math_asin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -118,7 +118,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -128,7 +128,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
}
static
HRESULT
Math_atan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -141,7 +141,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -151,7 +151,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
}
static
HRESULT
Math_atan2
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
,
y
;
HRESULT
hres
;
...
...
@@ -164,11 +164,11 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
y
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
y
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -179,7 +179,7 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
/* ECMA-262 3rd Edition 15.8.2.6 */
static
HRESULT
Math_ceil
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -192,7 +192,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -202,7 +202,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
}
static
HRESULT
Math_cos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -215,7 +215,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -225,7 +225,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
}
static
HRESULT
Math_exp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -238,7 +238,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -248,7 +248,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
}
static
HRESULT
Math_floor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -261,7 +261,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -271,7 +271,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
}
static
HRESULT
Math_log
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -284,7 +284,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -295,7 +295,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
/* ECMA-262 3rd Edition 15.8.2.11 */
static
HRESULT
Math_max
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DOUBLE
max
,
d
;
DWORD
i
;
...
...
@@ -309,12 +309,12 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
max
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
max
);
if
(
FAILED
(
hres
))
return
hres
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
hres
=
to_number
(
ctx
,
argv
[
i
],
ei
,
&
d
);
hres
=
to_number
(
ctx
,
argv
[
i
],
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -329,7 +329,7 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
/* ECMA-262 3rd Edition 15.8.2.12 */
static
HRESULT
Math_min
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DOUBLE
min
,
d
;
DWORD
i
;
...
...
@@ -343,12 +343,12 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
min
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
min
);
if
(
FAILED
(
hres
))
return
hres
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
hres
=
to_number
(
ctx
,
argv
[
i
],
ei
,
&
d
);
hres
=
to_number
(
ctx
,
argv
[
i
],
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -363,7 +363,7 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
/* ECMA-262 3rd Edition 15.8.2.13 */
static
HRESULT
Math_pow
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
,
y
;
HRESULT
hres
;
...
...
@@ -376,11 +376,11 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
ctx
,
argv
[
1
],
ei
,
&
y
);
hres
=
to_number
(
ctx
,
argv
[
1
],
&
y
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -391,7 +391,7 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
/* ECMA-262 3rd Edition 15.8.2.14 */
static
HRESULT
Math_random
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
UINT
x
;
...
...
@@ -407,7 +407,7 @@ static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
/* ECMA-262 3rd Edition 15.8.2.15 */
static
HRESULT
Math_round
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -420,7 +420,7 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -430,7 +430,7 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
}
static
HRESULT
Math_sin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -443,7 +443,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -453,7 +453,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
}
static
HRESULT
Math_sqrt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -466,7 +466,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -476,7 +476,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
}
static
HRESULT
Math_tan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
x
;
HRESULT
hres
;
...
...
@@ -489,7 +489,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
x
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/number.c
View file @
6f5475dd
...
...
@@ -219,7 +219,7 @@ static inline void number_to_exponential(double val, int prec, BSTR *out)
/* ECMA-262 3rd Edition 15.7.4.2 */
static
HRESULT
Number_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
;
INT
radix
=
10
;
...
...
@@ -230,21 +230,21 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE
(
"
\n
"
);
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
radix
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
radix
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
radix
<
2
||
radix
>
36
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_INVALIDARG
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_INVALIDARG
,
NULL
);
}
val
=
number
->
value
;
if
(
radix
==
10
||
isnan
(
val
)
||
isinf
(
val
))
{
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -339,14 +339,14 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
static
HRESULT
Number_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
Number_toFixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
;
DOUBLE
val
;
...
...
@@ -357,20 +357,20 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
prec
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
prec
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
prec
<
0
||
prec
>
20
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_FRACTION_DIGITS_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_FRACTION_DIGITS_OUT_OF_RANGE
,
NULL
);
}
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
))
{
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -385,7 +385,7 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
Number_toExponential
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
;
DOUBLE
val
;
...
...
@@ -396,20 +396,20 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE
(
"
\n
"
);
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
prec
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
prec
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
prec
<
0
||
prec
>
20
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_FRACTION_DIGITS_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_FRACTION_DIGITS_OUT_OF_RANGE
,
NULL
);
}
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
))
{
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -426,7 +426,7 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
}
static
HRESULT
Number_toPrecision
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
;
INT
prec
=
0
,
size
;
...
...
@@ -435,20 +435,20 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
HRESULT
hres
;
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
prec
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
prec
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
prec
<
1
||
prec
>
21
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_PRECISION_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_PRECISION_OUT_OF_RANGE
,
NULL
);
}
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
)
||
!
prec
)
{
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -471,14 +471,14 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
Number_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
;
TRACE
(
"
\n
"
);
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
number
->
value
);
...
...
@@ -486,13 +486,13 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
Number_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
NumberInstance
*
number
=
number_from_vdisp
(
jsthis
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
DISPATCH_PROPERTYGET
:
*
r
=
jsval_number
(
number
->
value
);
break
;
...
...
@@ -532,7 +532,7 @@ static const builtin_info_t NumberInst_info = {
};
static
HRESULT
NumberConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
double
n
;
HRESULT
hres
;
...
...
@@ -547,7 +547,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -559,7 +559,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
jsdisp_t
*
obj
;
if
(
argc
)
{
hres
=
to_number
(
ctx
,
argv
[
0
],
ei
,
&
n
);
hres
=
to_number
(
ctx
,
argv
[
0
],
&
n
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
dlls/jscript/object.c
View file @
6f5475dd
...
...
@@ -33,7 +33,7 @@ static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','
static
const
WCHAR
default_valueW
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
']'
,
0
};
static
HRESULT
Object_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
jsdisp
;
const
WCHAR
*
str
;
...
...
@@ -79,7 +79,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
static
HRESULT
Object_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -88,11 +88,11 @@ static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
return
E_FAIL
;
}
return
jsdisp_call_name
(
jsthis
->
u
.
jsdisp
,
toStringW
,
DISPATCH_METHOD
,
0
,
NULL
,
r
,
ei
);
return
jsdisp_call_name
(
jsthis
->
u
.
jsdisp
,
toStringW
,
DISPATCH_METHOD
,
0
,
NULL
,
r
);
}
static
HRESULT
Object_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -104,7 +104,7 @@ static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
Object_hasOwnProperty
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
name
;
DISPID
id
;
...
...
@@ -118,7 +118,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
name
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
name
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -148,27 +148,27 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
}
static
HRESULT
Object_propertyIsEnumerable
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
Object_isPrototypeOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
Object_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
DISPATCH_PROPERTYGET
:
{
BSTR
ret
=
SysAllocString
(
default_valueW
);
if
(
!
ret
)
...
...
@@ -216,7 +216,7 @@ static const builtin_info_t ObjectInst_info = {
};
static
HRESULT
ObjectConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
HRESULT
hres
;
...
...
dlls/jscript/regexp.c
View file @
6f5475dd
...
...
@@ -3474,7 +3474,7 @@ HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, const WCHAR *str, DWOR
}
static
HRESULT
RegExp_source
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -3496,21 +3496,21 @@ static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
static
HRESULT
RegExp_global
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
RegExp_ignoreCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
RegExp_multiline
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
...
...
@@ -3518,14 +3518,12 @@ static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static
INT
index_from_val
(
script_ctx_t
*
ctx
,
jsval_t
v
)
{
jsexcept_t
ei
;
double
n
;
HRESULT
hres
;
memset
(
&
ei
,
0
,
sizeof
(
ei
));
hres
=
to_number
(
ctx
,
v
,
&
ei
,
&
n
);
if
(
FAILED
(
hres
))
{
/* FIXME: Move ignoring exceptions to to_primitive */
jsval_release
(
ei
.
val
);
hres
=
to_number
(
ctx
,
v
,
&
n
);
if
(
FAILED
(
hres
))
{
clear_ei
(
ctx
);
/* FIXME: Move ignoring exceptions to to_primitive */
return
0
;
}
...
...
@@ -3534,7 +3532,7 @@ static INT index_from_val(script_ctx_t *ctx, jsval_t v)
}
static
HRESULT
RegExp_lastIndex
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -3564,14 +3562,14 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
static
HRESULT
RegExp_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
create_match_array
(
script_ctx_t
*
ctx
,
BSTR
input
,
const
match_result_t
*
result
,
const
match_result_t
*
parens
,
DWORD
parens_cnt
,
jsexcept_t
*
ei
,
IDispatch
**
ret
)
const
match_result_t
*
parens
,
DWORD
parens_cnt
,
IDispatch
**
ret
)
{
jsdisp_t
*
array
;
BSTR
str
;
...
...
@@ -3594,22 +3592,22 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
break
;
}
hres
=
jsdisp_propput_idx
(
array
,
i
+
1
,
jsval_string
(
str
)
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
+
1
,
jsval_string
(
str
));
SysFreeString
(
str
);
if
(
FAILED
(
hres
))
break
;
}
while
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
result
->
str
-
input
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
result
->
str
-
input
));
if
(
FAILED
(
hres
))
break
;
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
jsval_number
(
result
->
str
-
input
+
result
->
len
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
jsval_number
(
result
->
str
-
input
+
result
->
len
));
if
(
FAILED
(
hres
))
break
;
hres
=
jsdisp_propput_name
(
array
,
inputW
,
jsval_string
(
input
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
inputW
,
jsval_string
(
input
));
if
(
FAILED
(
hres
))
break
;
...
...
@@ -3618,7 +3616,7 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
hres
=
E_OUTOFMEMORY
;
break
;
}
hres
=
jsdisp_propput_name
(
array
,
zeroW
,
jsval_string
(
str
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
zeroW
,
jsval_string
(
str
));
SysFreeString
(
str
);
break
;
}
...
...
@@ -3632,7 +3630,7 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
return
S_OK
;
}
static
HRESULT
run_exec
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
arg
,
jsexcept_t
*
ei
,
BSTR
*
input
,
static
HRESULT
run_exec
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
arg
,
BSTR
*
input
,
match_result_t
*
match
,
match_result_t
**
parens
,
DWORD
*
parens_cnt
,
BOOL
*
ret
)
{
RegExpInstance
*
regexp
;
...
...
@@ -3648,7 +3646,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsexcep
regexp
=
regexp_from_vdisp
(
jsthis
);
hres
=
to_string
(
ctx
,
arg
,
ei
,
&
string
);
hres
=
to_string
(
ctx
,
arg
,
&
string
);
if
(
FAILED
(
hres
))
return
hres
;
length
=
SysStringLen
(
string
);
...
...
@@ -3685,7 +3683,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsexcep
}
static
HRESULT
RegExp_exec
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
match_result_t
*
parens
=
NULL
,
match
;
DWORD
parens_cnt
=
0
;
...
...
@@ -3695,7 +3693,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
TRACE
(
"
\n
"
);
hres
=
run_exec
(
ctx
,
jsthis
,
argc
?
argv
[
0
]
:
jsval_string
(
NULL
),
ei
,
&
string
,
&
match
,
&
parens
,
&
parens_cnt
,
&
b
);
hres
=
run_exec
(
ctx
,
jsthis
,
argc
?
argv
[
0
]
:
jsval_string
(
NULL
),
&
string
,
&
match
,
&
parens
,
&
parens_cnt
,
&
b
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -3703,7 +3701,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
if
(
b
)
{
IDispatch
*
ret
;
hres
=
create_match_array
(
ctx
,
string
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
hres
=
create_match_array
(
ctx
,
string
,
&
match
,
parens
,
parens_cnt
,
&
ret
);
if
(
SUCCEEDED
(
hres
))
*
r
=
jsval_disp
(
ret
);
}
else
{
...
...
@@ -3717,7 +3715,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
}
static
HRESULT
RegExp_test
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
match_result_t
match
;
BSTR
undef_str
;
...
...
@@ -3732,7 +3730,7 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
return
E_OUTOFMEMORY
;
}
hres
=
run_exec
(
ctx
,
jsthis
,
argc
?
argv
[
0
]
:
jsval_string
(
undef_str
),
ei
,
NULL
,
&
match
,
NULL
,
NULL
,
&
b
);
hres
=
run_exec
(
ctx
,
jsthis
,
argc
?
argv
[
0
]
:
jsval_string
(
undef_str
),
NULL
,
&
match
,
NULL
,
NULL
,
&
b
);
if
(
!
argc
)
SysFreeString
(
undef_str
);
if
(
FAILED
(
hres
))
...
...
@@ -3744,13 +3742,13 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
}
static
HRESULT
RegExp_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
...
...
@@ -3909,8 +3907,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
return
create_regexp
(
ctx
,
src
,
-
1
,
flags
,
ret
);
}
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
BSTR
str
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
BSTR
str
,
jsval_t
*
r
)
{
static
const
WCHAR
indexW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
inputW
[]
=
{
'i'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
...
...
@@ -3937,7 +3934,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
if
(
hres
==
S_OK
)
{
IDispatch
*
ret
;
hres
=
create_match_array
(
ctx
,
str
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
hres
=
create_match_array
(
ctx
,
str
,
&
match
,
parens
,
parens_cnt
,
&
ret
);
if
(
SUCCEEDED
(
hres
))
*
r
=
jsval_disp
(
ret
);
}
else
{
...
...
@@ -3974,23 +3971,23 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
break
;
}
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
)
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
));
SysFreeString
(
tmp_str
);
if
(
FAILED
(
hres
))
break
;
}
while
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
));
if
(
FAILED
(
hres
))
break
;
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
+
match_result
[
match_cnt
-
1
].
len
)
,
ei
);
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
+
match_result
[
match_cnt
-
1
].
len
));
if
(
FAILED
(
hres
))
break
;
hres
=
jsdisp_propput_name
(
array
,
inputW
,
jsval_string
(
str
)
,
ei
);
hres
=
jsdisp_propput_name
(
array
,
inputW
,
jsval_string
(
str
));
break
;
}
...
...
@@ -4004,7 +4001,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
}
static
HRESULT
RegExpConstr_leftContext
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -4030,7 +4027,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD
}
static
HRESULT
RegExpConstr_rightContext
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -4056,7 +4053,7 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR
}
static
HRESULT
RegExpConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -4069,7 +4066,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
is_class
(
jsdisp
,
JSCLASS_REGEXP
))
{
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
jsdisp_release
(
jsdisp
);
return
throw_regexp_error
(
ctx
,
ei
,
JS_E_REGEXP_SYNTAX
,
NULL
);
return
throw_regexp_error
(
ctx
,
JS_E_REGEXP_SYNTAX
,
NULL
);
}
if
(
r
)
...
...
dlls/jscript/string.c
View file @
6f5475dd
...
...
@@ -77,8 +77,7 @@ static inline StringInstance *string_this(vdisp_t *jsthis)
return
is_vclass
(
jsthis
,
JSCLASS_STRING
)
?
string_from_vdisp
(
jsthis
)
:
NULL
;
}
static
HRESULT
get_string_val
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsexcept_t
*
ei
,
const
WCHAR
**
str
,
DWORD
*
len
,
BSTR
*
val_str
)
static
HRESULT
get_string_val
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
const
WCHAR
**
str
,
DWORD
*
len
,
BSTR
*
val_str
)
{
StringInstance
*
string
;
HRESULT
hres
;
...
...
@@ -90,7 +89,7 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei
return
S_OK
;
}
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
val_str
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -100,7 +99,7 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei
}
static
HRESULT
String_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"%p
\n
"
,
jsthis
);
...
...
@@ -140,7 +139,7 @@ static HRESULT stringobj_to_string(vdisp_t *jsthis, jsval_t *r)
/* ECMA-262 3rd Edition 15.5.4.2 */
static
HRESULT
String_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
...
...
@@ -149,15 +148,14 @@ static HRESULT String_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
/* ECMA-262 3rd Edition 15.5.4.2 */
static
HRESULT
String_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
TRACE
(
"
\n
"
);
return
stringobj_to_string
(
jsthis
,
r
);
}
static
HRESULT
do_attributeless_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
)
static
HRESULT
do_attributeless_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
*
r
,
const
WCHAR
*
tagname
)
{
const
WCHAR
*
str
;
DWORD
length
;
...
...
@@ -166,7 +164,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, j
static
const
WCHAR
tagfmt
[]
=
{
'<'
,
'%'
,
's'
,
'>'
,
'%'
,
's'
,
'<'
,
'/'
,
'%'
,
's'
,
'>'
,
0
};
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -186,7 +184,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, j
}
static
HRESULT
do_attribute_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
)
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
)
{
static
const
WCHAR
tagfmtW
[]
=
{
'<'
,
'%'
,
's'
,
' '
,
'%'
,
's'
,
'='
,
'\"'
,
'%'
,
's'
,
'\"'
,
'>'
,
'%'
,
's'
,
'<'
,
'/'
,
'%'
,
's'
,
'>'
,
0
};
...
...
@@ -199,7 +197,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
HRESULT
hres
;
if
(
!
(
string
=
string_this
(
jsthis
)))
{
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
&
val_str
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -212,7 +210,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
if
(
argc
)
{
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
attr_value
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
attr_value
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -245,38 +243,38 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
static
HRESULT
String_anchor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'N'
,
'A'
,
'M'
,
'E'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
fontW
,
colorW
);
}
static
HRESULT
String_big
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
bigtagW
[]
=
{
'B'
,
'I'
,
'G'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
bigtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
bigtagW
);
}
static
HRESULT
String_blink
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
blinktagW
[]
=
{
'B'
,
'L'
,
'I'
,
'N'
,
'K'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
blinktagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
blinktagW
);
}
static
HRESULT
String_bold
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
boldtagW
[]
=
{
'B'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
boldtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
boldtagW
);
}
/* ECMA-262 3rd Edition 15.5.4.5 */
static
HRESULT
String_charAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
DWORD
length
;
...
...
@@ -286,14 +284,14 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
)
{
double
d
;
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -321,7 +319,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.5.4.5 */
static
HRESULT
String_charCodeAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
BSTR
val_str
;
...
...
@@ -330,14 +328,14 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
0
)
{
double
d
;
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -362,7 +360,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.5.4.6 */
static
HRESULT
String_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
*
strs
=
NULL
,
ret
=
NULL
;
DWORD
len
=
0
,
i
,
l
,
str_cnt
;
...
...
@@ -376,10 +374,10 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
strs
)
return
E_OUTOFMEMORY
;
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
strs
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
strs
);
if
(
SUCCEEDED
(
hres
))
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_string
(
ctx
,
argv
[
i
],
ei
,
strs
+
i
+
1
);
hres
=
to_string
(
ctx
,
argv
[
i
],
strs
+
i
+
1
);
if
(
FAILED
(
hres
))
break
;
}
...
...
@@ -413,32 +411,32 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
static
HRESULT
String_fixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
fixedtagW
[]
=
{
'T'
,
'T'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
fixedtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
fixedtagW
);
}
static
HRESULT
String_fontcolor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'C'
,
'O'
,
'L'
,
'O'
,
'R'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
fontW
,
colorW
);
}
static
HRESULT
String_fontsize
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'S'
,
'I'
,
'Z'
,
'E'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
fontW
,
colorW
);
}
static
HRESULT
String_indexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
DWORD
length
,
pos
=
0
;
const
WCHAR
*
str
;
...
...
@@ -448,7 +446,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -459,7 +457,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
search_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -468,7 +466,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
argc
>=
2
)
{
double
d
;
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
SUCCEEDED
(
hres
)
&&
d
>
0
.
0
)
pos
=
is_int32
(
d
)
?
min
(
length
,
d
)
:
length
;
}
...
...
@@ -494,15 +492,15 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
String_italics
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
italicstagW
[]
=
{
'I'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
italicstagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
italicstagW
);
}
/* ECMA-262 3rd Edition 15.5.4.8 */
static
HRESULT
String_lastIndexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
search_str
,
val_str
;
DWORD
length
,
pos
=
0
,
search_len
;
...
...
@@ -512,7 +510,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -523,7 +521,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
search_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -534,7 +532,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
argc
>=
2
)
{
double
d
;
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
SUCCEEDED
(
hres
)
&&
d
>
0
)
pos
=
is_int32
(
d
)
?
min
(
length
,
d
)
:
length
;
}
else
{
...
...
@@ -563,17 +561,17 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
String_link
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'H'
,
'R'
,
'E'
,
'F'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
fontW
,
colorW
);
}
/* ECMA-262 3rd Edition 15.5.4.10 */
static
HRESULT
String_match
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
regexp
=
NULL
;
const
WCHAR
*
str
;
...
...
@@ -600,7 +598,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
regexp
)
{
BSTR
match_str
;
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
match_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -610,12 +608,12 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
return
hres
;
}
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
SUCCEEDED
(
hres
))
{
if
(
!
val_str
)
val_str
=
SysAllocStringLen
(
str
,
length
);
if
(
val_str
)
hres
=
regexp_string_match
(
ctx
,
regexp
,
val_str
,
r
,
ei
);
hres
=
regexp_string_match
(
ctx
,
regexp
,
val_str
,
r
);
else
hres
=
E_OUTOFMEMORY
;
}
...
...
@@ -660,7 +658,7 @@ static HRESULT strbuf_append(strbuf_t *buf, const WCHAR *str, DWORD len)
}
static
HRESULT
rep_call
(
script_ctx_t
*
ctx
,
jsdisp_t
*
func
,
const
WCHAR
*
str
,
match_result_t
*
match
,
match_result_t
*
parens
,
DWORD
parens_cnt
,
BSTR
*
ret
,
jsexcept_t
*
ei
)
match_result_t
*
parens
,
DWORD
parens_cnt
,
BSTR
*
ret
)
{
jsval_t
*
argv
;
unsigned
argc
;
...
...
@@ -700,7 +698,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
}
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_call_value
(
func
,
NULL
,
DISPATCH_METHOD
,
argc
,
argv
,
&
val
,
ei
);
hres
=
jsdisp_call_value
(
func
,
NULL
,
DISPATCH_METHOD
,
argc
,
argv
,
&
val
);
for
(
i
=
0
;
i
<
parens_cnt
+
3
;
i
++
)
{
if
(
i
!=
parens_cnt
+
1
)
...
...
@@ -711,14 +709,14 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
val
,
ei
,
ret
);
hres
=
to_string
(
ctx
,
val
,
ret
);
jsval_release
(
val
);
return
hres
;
}
/* ECMA-262 3rd Edition 15.5.4.11 */
static
HRESULT
String_replace
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
DWORD
parens_cnt
=
0
,
parens_size
=
0
,
rep_len
=
0
,
length
;
...
...
@@ -731,7 +729,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -757,7 +755,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
!
regexp
)
{
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
match_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -774,7 +772,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
!
rep_func
)
{
hres
=
to_string
(
ctx
,
argv
[
1
],
ei
,
&
rep_str
);
hres
=
to_string
(
ctx
,
argv
[
1
],
&
rep_str
);
if
(
SUCCEEDED
(
hres
))
{
rep_len
=
SysStringLen
(
rep_str
);
if
(
!
strchrW
(
rep_str
,
'$'
))
...
...
@@ -819,7 +817,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
rep_func
)
{
BSTR
cstr
;
hres
=
rep_call
(
ctx
,
rep_func
,
str
,
&
match
,
parens
,
parens_cnt
,
&
cstr
,
ei
);
hres
=
rep_call
(
ctx
,
rep_func
,
str
,
&
match
,
parens
,
parens_cnt
,
&
cstr
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -943,7 +941,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
static
HRESULT
String_search
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
jsdisp_t
*
regexp
=
NULL
;
const
WCHAR
*
str
,
*
cp
;
...
...
@@ -954,7 +952,7 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -995,7 +993,7 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.5.4.13 */
static
HRESULT
String_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
BSTR
val_str
;
...
...
@@ -1006,12 +1004,12 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
)
{
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1032,7 +1030,7 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
if
(
argc
>=
2
)
{
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1072,14 +1070,14 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
static
HRESULT
String_small
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
smalltagW
[]
=
{
'S'
,
'M'
,
'A'
,
'L'
,
'L'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
smalltagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
smalltagW
);
}
static
HRESULT
String_split
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
match_result_t
*
match_result
=
NULL
;
DWORD
length
,
match_cnt
,
i
,
match_len
=
0
;
...
...
@@ -1096,7 +1094,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
return
E_NOTIMPL
;
}
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1118,7 +1116,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
if
(
!
use_regexp
)
{
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
match_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1156,7 +1154,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
break
;
}
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
)
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
));
SysFreeString
(
tmp_str
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -1177,7 +1175,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
tmp_str
=
SysAllocStringLen
(
ptr
,
len
);
if
(
tmp_str
)
{
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
)
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
jsval_string
(
tmp_str
));
SysFreeString
(
tmp_str
);
}
else
{
hres
=
E_OUTOFMEMORY
;
...
...
@@ -1198,22 +1196,22 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
static
HRESULT
String_strike
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
striketagW
[]
=
{
'S'
,
'T'
,
'R'
,
'I'
,
'K'
,
'E'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
striketagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
striketagW
);
}
static
HRESULT
String_sub
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
subtagW
[]
=
{
'S'
,
'U'
,
'B'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
subtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
subtagW
);
}
/* ECMA-262 3rd Edition 15.5.4.15 */
static
HRESULT
String_substring
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
BSTR
val_str
;
...
...
@@ -1224,12 +1222,12 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>=
1
)
{
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1240,7 +1238,7 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
if
(
argc
>=
2
)
{
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1274,7 +1272,7 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition B.2.3 */
static
HRESULT
String_substr
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
BSTR
val_str
;
const
WCHAR
*
str
;
...
...
@@ -1285,12 +1283,12 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>=
1
)
{
hres
=
to_integer
(
ctx
,
argv
[
0
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
0
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1301,7 +1299,7 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
if
(
argc
>=
2
)
{
hres
=
to_integer
(
ctx
,
argv
[
1
],
ei
,
&
d
);
hres
=
to_integer
(
ctx
,
argv
[
1
],
&
d
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1329,14 +1327,14 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
static
HRESULT
String_sup
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
static
const
WCHAR
suptagW
[]
=
{
'S'
,
'U'
,
'P'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
suptagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
suptagW
);
}
static
HRESULT
String_toLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
DWORD
length
;
...
...
@@ -1345,7 +1343,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1364,7 +1362,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
String_toUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
const
WCHAR
*
str
;
DWORD
length
;
...
...
@@ -1373,7 +1371,7 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
hres
=
get_string_val
(
ctx
,
jsthis
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1392,28 +1390,28 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static
HRESULT
String_toLocaleLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
String_toLocaleUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
String_localeCompare
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
String_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
StringInstance
*
This
=
string_from_vdisp
(
jsthis
);
...
...
@@ -1421,7 +1419,7 @@ static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
switch
(
flags
)
{
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
DISPATCH_PROPERTYGET
:
{
BSTR
str
=
SysAllocString
(
This
->
str
);
if
(
!
str
)
...
...
@@ -1506,7 +1504,7 @@ static const builtin_info_t StringInst_info = {
/* ECMA-262 3rd Edition 15.5.3.2 */
static
HRESULT
StringConstr_fromCharCode
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DWORD
i
,
code
;
BSTR
ret
;
...
...
@@ -1519,7 +1517,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_uint32
(
ctx
,
argv
[
i
],
ei
,
&
code
);
hres
=
to_uint32
(
ctx
,
argv
[
i
],
&
code
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
ret
);
return
hres
;
...
...
@@ -1536,7 +1534,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
}
static
HRESULT
StringConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
HRESULT
hres
;
...
...
@@ -1547,7 +1545,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
BSTR
str
;
if
(
argc
)
{
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1565,7 +1563,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
argc
)
{
BSTR
str
;
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/vbarray.c
View file @
6f5475dd
...
...
@@ -45,7 +45,7 @@ static inline VBArrayInstance *vbarray_this(vdisp_t *jsthis)
}
static
HRESULT
VBArray_dimensions
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
...
...
@@ -53,7 +53,7 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
vbarray
=
vbarray_this
(
vthis
);
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
if
(
r
)
*
r
=
jsval_number
(
SafeArrayGetDim
(
vbarray
->
safearray
));
...
...
@@ -61,7 +61,7 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
}
static
HRESULT
VBArray_getItem
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
int
i
,
*
indexes
;
...
...
@@ -72,17 +72,17 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
vbarray
=
vbarray_this
(
vthis
);
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
if
(
argc
<
SafeArrayGetDim
(
vbarray
->
safearray
))
return
throw_range_error
(
ctx
,
ei
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
indexes
=
heap_alloc
(
sizeof
(
int
)
*
argc
);
if
(
!
indexes
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_int32
(
ctx
,
argv
[
i
],
ei
,
indexes
+
i
);
hres
=
to_int32
(
ctx
,
argv
[
i
],
indexes
+
i
);
if
(
FAILED
(
hres
))
{
heap_free
(
indexes
);
return
hres
;
...
...
@@ -92,7 +92,7 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
hres
=
SafeArrayGetElement
(
vbarray
->
safearray
,
indexes
,
(
void
*
)
&
out
);
heap_free
(
indexes
);
if
(
hres
==
DISP_E_BADINDEX
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
else
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -104,7 +104,7 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
}
static
HRESULT
VBArray_lbound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
int
dim
;
...
...
@@ -114,10 +114,10 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
vbarray
=
vbarray_this
(
vthis
);
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
dim
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
dim
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
...
...
@@ -125,7 +125,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
hres
=
SafeArrayGetLBound
(
vbarray
->
safearray
,
dim
,
&
dim
);
if
(
hres
==
DISP_E_BADINDEX
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
else
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -135,7 +135,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
}
static
HRESULT
VBArray_toArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
jsdisp_t
*
array
;
...
...
@@ -148,7 +148,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
vbarray
=
vbarray_this
(
vthis
);
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
for
(
i
=
1
;
i
<=
SafeArrayGetDim
(
vbarray
->
safearray
);
i
++
)
{
SafeArrayGetLBound
(
vbarray
->
safearray
,
i
,
&
lbound
);
...
...
@@ -169,7 +169,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
for
(
i
=
0
;
i
<
size
;
i
++
)
{
hres
=
variant_to_jsval
(
v
,
&
val
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_idx
(
array
,
i
,
val
,
ei
);
hres
=
jsdisp_propput_idx
(
array
,
i
,
val
);
jsval_release
(
val
);
}
if
(
FAILED
(
hres
))
{
...
...
@@ -188,7 +188,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
}
static
HRESULT
VBArray_ubound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
int
dim
;
...
...
@@ -198,10 +198,10 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
vbarray
=
vbarray_this
(
vthis
);
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
if
(
argc
)
{
hres
=
to_int32
(
ctx
,
argv
[
0
],
ei
,
&
dim
);
hres
=
to_int32
(
ctx
,
argv
[
0
],
&
dim
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
...
...
@@ -209,7 +209,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
hres
=
SafeArrayGetUBound
(
vbarray
->
safearray
,
dim
,
&
dim
);
if
(
hres
==
DISP_E_BADINDEX
)
return
throw_range_error
(
ctx
,
ei
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
return
throw_range_error
(
ctx
,
JS_E_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
else
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -219,7 +219,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
}
static
HRESULT
VBArray_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
...
...
@@ -281,7 +281,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
}
static
HRESULT
VBArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsval_t
*
r
)
{
VBArrayInstance
*
vbarray
;
HRESULT
hres
;
...
...
@@ -291,13 +291,13 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
switch
(
flags
)
{
case
DISPATCH_METHOD
:
if
(
argc
<
1
||
!
is_variant
(
argv
[
0
])
||
V_VT
(
get_variant
(
argv
[
0
]))
!=
(
VT_ARRAY
|
VT_VARIANT
))
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
jsval_copy
(
argv
[
0
],
r
);
case
DISPATCH_CONSTRUCT
:
if
(
argc
<
1
||
!
is_variant
(
argv
[
0
])
||
V_VT
(
get_variant
(
argv
[
0
]))
!=
(
VT_ARRAY
|
VT_VARIANT
))
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
hres
=
alloc_vbarray
(
ctx
,
NULL
,
&
vbarray
);
if
(
FAILED
(
hres
))
...
...
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