Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
932b3dd0
Commit
932b3dd0
authored
Sep 17, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added new variable representation and use it for internal function return values.
parent
b57323a6
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1174 additions
and
955 deletions
+1174
-955
activex.c
dlls/jscript/activex.c
+2
-3
array.c
dlls/jscript/array.c
+58
-74
bool.c
dlls/jscript/bool.c
+11
-17
date.c
dlls/jscript/date.c
+185
-231
dispex.c
dlls/jscript/dispex.c
+45
-26
engine.c
dlls/jscript/engine.c
+22
-6
error.c
dlls/jscript/error.c
+28
-32
function.c
dlls/jscript/function.c
+43
-49
global.c
dlls/jscript/global.c
+126
-150
jscript.h
dlls/jscript/jscript.h
+14
-8
jsutils.c
dlls/jscript/jsutils.c
+152
-0
jsval.h
dlls/jscript/jsval.h
+163
-0
math.c
dlls/jscript/math.c
+90
-74
number.c
dlls/jscript/number.c
+28
-36
object.c
dlls/jscript/object.c
+32
-44
regexp.c
dlls/jscript/regexp.c
+37
-47
string.c
dlls/jscript/string.c
+119
-137
vbarray.c
dlls/jscript/vbarray.c
+19
-21
No files found.
dlls/jscript/activex.c
View file @
932b3dd0
...
@@ -139,7 +139,7 @@ static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid)
...
@@ -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
,
VARIANT
*
argv
,
static
HRESULT
ActiveXObject_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
IDispatch
*
disp
;
IDispatch
*
disp
;
IUnknown
*
obj
;
IUnknown
*
obj
;
...
@@ -180,8 +180,7 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -180,8 +180,7 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
jsval_disp
(
disp
);
V_DISPATCH
(
retv
)
=
disp
;
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/jscript/array.c
View file @
932b3dd0
...
@@ -117,7 +117,7 @@ static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr)
...
@@ -117,7 +117,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
,
VARIANT
*
argv
,
static
HRESULT
Array_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
ArrayInstance
*
This
=
array_from_vdisp
(
jsthis
);
ArrayInstance
*
This
=
array_from_vdisp
(
jsthis
);
...
@@ -125,7 +125,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -125,7 +125,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
switch
(
flags
)
{
switch
(
flags
)
{
case
DISPATCH_PROPERTYGET
:
case
DISPATCH_PROPERTYGET
:
num_set_int
(
retv
,
This
->
length
);
*
r
=
jsval_number
(
This
->
length
);
break
;
break
;
case
DISPATCH_PROPERTYPUT
:
{
case
DISPATCH_PROPERTYPUT
:
{
DOUBLE
len
=
-
1
;
DOUBLE
len
=
-
1
;
...
@@ -202,7 +202,7 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len, jsexcept_
...
@@ -202,7 +202,7 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len, jsexcept_
}
}
static
HRESULT
Array_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
ret
;
jsdisp_t
*
ret
;
DWORD
len
=
0
;
DWORD
len
=
0
;
...
@@ -233,14 +233,14 @@ static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -233,14 +233,14 @@ static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
ret
);
*
r
=
jsval_obj
(
ret
);
else
else
jsdisp_release
(
ret
);
jsdisp_release
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
array_join
(
script_ctx_t
*
ctx
,
jsdisp_t
*
array
,
DWORD
length
,
const
WCHAR
*
sep
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
static
HRESULT
array_join
(
script_ctx_t
*
ctx
,
jsdisp_t
*
array
,
DWORD
length
,
const
WCHAR
*
sep
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
*
str_tab
,
ret
=
NULL
;
BSTR
*
str_tab
,
ret
=
NULL
;
VARIANT
var
;
VARIANT
var
;
...
@@ -248,11 +248,11 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
...
@@ -248,11 +248,11 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
HRESULT
hres
=
E_FAIL
;
HRESULT
hres
=
E_FAIL
;
if
(
!
length
)
{
if
(
!
length
)
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocStringLen
(
NULL
,
0
);
V_BSTR
(
retv
)
=
SysAllocStringLen
(
NULL
,
0
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -323,15 +323,14 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
...
@@ -323,15 +323,14 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
TRACE
(
"= %s
\n
"
,
debugstr_w
(
ret
));
TRACE
(
"= %s
\n
"
,
debugstr_w
(
ret
));
if
(
r
etv
)
{
if
(
r
)
{
if
(
!
ret
)
{
if
(
!
ret
)
{
ret
=
SysAllocStringLen
(
NULL
,
0
);
ret
=
SysAllocStringLen
(
NULL
,
0
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
else
{
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
}
...
@@ -341,7 +340,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
...
@@ -341,7 +340,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
/* ECMA-262 3rd Edition 15.4.4.5 */
/* ECMA-262 3rd Edition 15.4.4.5 */
static
HRESULT
Array_join
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_join
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
DWORD
length
;
DWORD
length
;
...
@@ -360,18 +359,18 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
...
@@ -360,18 +359,18 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
array_join
(
ctx
,
jsthis
,
length
,
sep
,
r
etv
,
ei
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
sep
,
r
,
ei
);
SysFreeString
(
sep
);
SysFreeString
(
sep
);
}
else
{
}
else
{
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
r
etv
,
ei
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
r
,
ei
);
}
}
return
hres
;
return
hres
;
}
}
static
HRESULT
Array_pop
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_pop
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
VARIANT
val
;
VARIANT
val
;
...
@@ -389,8 +388,8 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
...
@@ -389,8 +388,8 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
V_VT
(
retv
)
=
VT_EMPTY
;
*
r
=
jsval_undefined
()
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -412,17 +411,15 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
...
@@ -412,17 +411,15 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
return
hres
;
return
hres
;
}
}
if
(
retv
)
if
(
r
)
*
retv
=
val
;
hres
=
variant_to_jsval
(
&
val
,
r
);
else
VariantClear
(
&
val
);
VariantClear
(
&
val
);
return
hres
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.4.4.7 */
/* ECMA-262 3rd Edition 15.4.4.7 */
static
HRESULT
Array_push
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_push
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
DWORD
length
=
0
;
DWORD
length
=
0
;
...
@@ -445,13 +442,13 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
...
@@ -445,13 +442,13 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
length
+
argc
);
*
r
=
jsval_number
(
length
+
argc
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Array_reverse
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_reverse
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
DWORD
length
,
k
,
l
;
DWORD
length
,
k
,
l
;
...
@@ -499,17 +496,14 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
...
@@ -499,17 +496,14 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
}
}
}
}
if
(
retv
)
{
if
(
r
)
jsdisp_addref
(
jsthis
);
*
r
=
jsval_obj
(
jsdisp_addref
(
jsthis
));
var_set_jsdisp
(
retv
,
jsthis
);
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.4.4.9 */
/* ECMA-262 3rd Edition 15.4.4.9 */
static
HRESULT
Array_shift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_shift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
DWORD
length
=
0
,
i
;
DWORD
length
=
0
,
i
;
...
@@ -529,8 +523,8 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
...
@@ -529,8 +523,8 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
}
}
if
(
!
length
)
{
if
(
!
length
)
{
if
(
r
etv
)
if
(
r
)
V_VT
(
retv
)
=
VT_EMPTY
;
*
r
=
jsval_undefined
()
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -554,16 +548,15 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
...
@@ -554,16 +548,15 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
hres
=
set_length
(
jsthis
,
ei
,
length
-
1
);
hres
=
set_length
(
jsthis
,
ei
,
length
-
1
);
}
}
if
(
SUCCEEDED
(
hres
)
&&
retv
)
if
(
SUCCEEDED
(
hres
)
&&
r
)
*
retv
=
ret
;
hres
=
variant_to_jsval
(
&
ret
,
r
);
else
VariantClear
(
&
ret
);
VariantClear
(
&
ret
);
return
hres
;
return
hres
;
}
}
/* ECMA-262 3rd Edition 15.4.4.10 */
/* ECMA-262 3rd Edition 15.4.4.10 */
static
HRESULT
Array_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
arr
,
*
jsthis
;
jsdisp_t
*
arr
,
*
jsthis
;
DOUBLE
range
;
DOUBLE
range
;
...
@@ -624,8 +617,8 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
...
@@ -624,8 +617,8 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
}
}
}
}
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
arr
);
*
r
=
jsval_obj
(
arr
);
else
else
jsdisp_release
(
arr
);
jsdisp_release
(
arr
);
...
@@ -639,7 +632,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
...
@@ -639,7 +632,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
if
(
cmp_func
)
{
if
(
cmp_func
)
{
VARIANTARG
args
[
2
];
VARIANTARG
args
[
2
];
double
n
;
double
n
;
VARIANT
res
;
jsval_t
res
;
args
[
0
]
=
*
v1
;
args
[
0
]
=
*
v1
;
args
[
1
]
=
*
v2
;
args
[
1
]
=
*
v2
;
...
@@ -648,8 +641,8 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
...
@@ -648,8 +641,8 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
to_number
(
ctx
,
&
res
,
ei
,
&
n
);
hres
=
to_number
_jsval
(
ctx
,
res
,
ei
,
&
n
);
VariantClear
(
&
res
);
jsval_release
(
res
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -688,7 +681,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
...
@@ -688,7 +681,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI
/* ECMA-262 3rd Edition 15.4.4.11 */
/* ECMA-262 3rd Edition 15.4.4.11 */
static
HRESULT
Array_sort
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_sort
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
,
*
cmp_func
=
NULL
;
jsdisp_t
*
jsthis
,
*
cmp_func
=
NULL
;
VARIANT
*
vtab
,
**
sorttab
=
NULL
;
VARIANT
*
vtab
,
**
sorttab
=
NULL
;
...
@@ -726,10 +719,8 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
...
@@ -726,10 +719,8 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
if
(
!
length
)
{
if
(
!
length
)
{
if
(
cmp_func
)
if
(
cmp_func
)
jsdisp_release
(
cmp_func
);
jsdisp_release
(
cmp_func
);
if
(
retv
)
{
if
(
r
)
jsdisp_addref
(
jsthis
);
*
r
=
jsval_obj
(
jsdisp_addref
(
jsthis
));
var_set_jsdisp
(
retv
,
jsthis
);
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -831,17 +822,14 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
...
@@ -831,17 +822,14 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
jsdisp_addref
(
jsthis
);
*
r
=
jsval_obj
(
jsdisp_addref
(
jsthis
));
var_set_jsdisp
(
retv
,
jsthis
);
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.4.4.12 */
/* ECMA-262 3rd Edition 15.4.4.12 */
static
HRESULT
Array_splice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_splice
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DWORD
length
,
start
=
0
,
delete_cnt
=
0
,
i
,
add_args
=
0
;
DWORD
length
,
start
=
0
,
delete_cnt
=
0
,
i
,
add_args
=
0
;
jsdisp_t
*
ret_array
=
NULL
,
*
jsthis
;
jsdisp_t
*
ret_array
=
NULL
,
*
jsthis
;
...
@@ -886,7 +874,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
...
@@ -886,7 +874,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
add_args
=
argc
-
2
;
add_args
=
argc
-
2
;
}
}
if
(
r
etv
)
{
if
(
r
)
{
hres
=
create_array
(
ctx
,
0
,
&
ret_array
);
hres
=
create_array
(
ctx
,
0
,
&
ret_array
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -940,14 +928,14 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
...
@@ -940,14 +928,14 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
return
hres
;
return
hres
;
}
}
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
ret_array
);
*
r
=
jsval_obj
(
ret_array
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.4.4.2 */
/* ECMA-262 3rd Edition 15.4.4.2 */
static
HRESULT
Array_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
ArrayInstance
*
array
;
ArrayInstance
*
array
;
...
@@ -957,11 +945,11 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -957,11 +945,11 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
!
array
)
if
(
!
array
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_ARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_ARRAY_EXPECTED
,
NULL
);
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
r
etv
,
ei
);
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
r
,
ei
);
}
}
static
HRESULT
Array_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -969,7 +957,7 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
...
@@ -969,7 +957,7 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
/* ECMA-262 3rd Edition 15.4.4.13 */
/* ECMA-262 3rd Edition 15.4.4.13 */
static
HRESULT
Array_unshift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_unshift
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
WCHAR
buf
[
14
],
*
buf_end
,
*
str
;
WCHAR
buf
[
14
],
*
buf_end
,
*
str
;
...
@@ -1022,17 +1010,13 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
...
@@ -1022,17 +1010,13 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
return
hres
;
return
hres
;
}
}
if
(
retv
)
{
if
(
r
)
if
(
ctx
->
version
<
2
)
*
r
=
ctx
->
version
<
2
?
jsval_undefined
()
:
jsval_number
(
length
);
V_VT
(
retv
)
=
VT_EMPTY
;
else
num_set_int
(
retv
,
length
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Array_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Array_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -1040,7 +1024,7 @@ static HRESULT Array_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
...
@@ -1040,7 +1024,7 @@ static HRESULT Array_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
case
INVOKE_FUNC
:
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
INVOKE_PROPERTYGET
:
case
INVOKE_PROPERTYGET
:
return
array_join
(
ctx
,
jsthis
->
u
.
jsdisp
,
array_from_vdisp
(
jsthis
)
->
length
,
default_separatorW
,
r
etv
,
ei
);
return
array_join
(
ctx
,
jsthis
->
u
.
jsdisp
,
array_from_vdisp
(
jsthis
)
->
length
,
default_separatorW
,
r
,
ei
);
default:
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -1114,7 +1098,7 @@ static const builtin_info_t ArrayInst_info = {
...
@@ -1114,7 +1098,7 @@ static const builtin_info_t ArrayInst_info = {
};
};
static
HRESULT
ArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
ArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
obj
;
jsdisp_t
*
obj
;
DWORD
i
;
DWORD
i
;
...
@@ -1133,7 +1117,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
...
@@ -1133,7 +1117,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
var_set_jsdisp
(
retv
,
obj
);
*
r
=
jsval_obj
(
obj
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1151,7 +1135,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
...
@@ -1151,7 +1135,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return
hres
;
return
hres
;
}
}
var_set_jsdisp
(
retv
,
obj
);
*
r
=
jsval_obj
(
obj
);
break
;
break
;
}
}
default:
default:
...
...
dlls/jscript/bool.c
View file @
932b3dd0
...
@@ -39,7 +39,7 @@ static inline BoolInstance *bool_this(vdisp_t *jsthis)
...
@@ -39,7 +39,7 @@ static inline BoolInstance *bool_this(vdisp_t *jsthis)
/* ECMA-262 3rd Edition 15.6.4.2 */
/* ECMA-262 3rd Edition 15.6.4.2 */
static
HRESULT
Bool_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Bool_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BoolInstance
*
bool
;
BoolInstance
*
bool
;
...
@@ -51,7 +51,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -51,7 +51,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
(
bool
=
bool_this
(
jsthis
)))
if
(
!
(
bool
=
bool_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
if
(
r
etv
)
{
if
(
r
)
{
BSTR
val
;
BSTR
val
;
if
(
bool
->
val
)
val
=
SysAllocString
(
trueW
);
if
(
bool
->
val
)
val
=
SysAllocString
(
trueW
);
...
@@ -60,8 +60,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -60,8 +60,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
val
)
if
(
!
val
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
val
);
V_BSTR
(
retv
)
=
val
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -69,7 +68,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -69,7 +68,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
/* ECMA-262 3rd Edition 15.6.4.3 */
/* ECMA-262 3rd Edition 15.6.4.3 */
static
HRESULT
Bool_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Bool_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BoolInstance
*
bool
;
BoolInstance
*
bool
;
...
@@ -78,16 +77,13 @@ static HRESULT Bool_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -78,16 +77,13 @@ static HRESULT Bool_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
(
bool
=
bool_this
(
jsthis
)))
if
(
!
(
bool
=
bool_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_BOOLEAN_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
bool
->
val
);
V_BOOL
(
retv
)
=
bool
->
val
;
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Bool_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Bool_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -126,7 +122,7 @@ static const builtin_info_t BoolInst_info = {
...
@@ -126,7 +122,7 @@ static const builtin_info_t BoolInst_info = {
};
};
static
HRESULT
BoolConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
BoolConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
HRESULT
hres
;
HRESULT
hres
;
VARIANT_BOOL
value
=
VARIANT_FALSE
;
VARIANT_BOOL
value
=
VARIANT_FALSE
;
...
@@ -145,15 +141,13 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -145,15 +141,13 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
var_set_jsdisp
(
retv
,
bool
);
*
r
=
jsval_obj
(
bool
);
return
S_OK
;
return
S_OK
;
}
}
case
INVOKE_FUNC
:
case
INVOKE_FUNC
:
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
value
);
V_BOOL
(
retv
)
=
value
;
}
return
S_OK
;
return
S_OK
;
default:
default:
...
...
dlls/jscript/date.c
View file @
932b3dd0
...
@@ -465,7 +465,7 @@ static SYSTEMTIME create_systemtime(DOUBLE time)
...
@@ -465,7 +465,7 @@ static SYSTEMTIME create_systemtime(DOUBLE time)
return
st
;
return
st
;
}
}
static
inline
HRESULT
date_to_string
(
DOUBLE
time
,
BOOL
show_offset
,
int
offset
,
VARIANT
*
retv
)
static
inline
HRESULT
date_to_string
(
DOUBLE
time
,
BOOL
show_offset
,
int
offset
,
jsval_t
*
r
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
...
@@ -498,16 +498,16 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
...
@@ -498,16 +498,16 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
WCHAR
sign
=
'-'
;
WCHAR
sign
=
'-'
;
if
(
isnan
(
time
))
{
if
(
isnan
(
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
if
(
r
etv
)
{
if
(
r
)
{
len
=
21
;
len
=
21
;
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
...
@@ -583,14 +583,13 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
...
@@ -583,14 +583,13 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
SysFreeString
(
week
);
SysFreeString
(
week
);
SysFreeString
(
month
);
SysFreeString
(
month
);
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.1.2 */
/* ECMA-262 3rd Edition 15.9.1.2 */
static
HRESULT
dateobj_to_string
(
DateInstance
*
date
,
VARIANT
*
retv
)
static
HRESULT
dateobj_to_string
(
DateInstance
*
date
,
jsval_t
*
r
)
{
{
DOUBLE
time
;
DOUBLE
time
;
int
offset
;
int
offset
;
...
@@ -599,11 +598,11 @@ static HRESULT dateobj_to_string(DateInstance *date, VARIANT *retv)
...
@@ -599,11 +598,11 @@ static HRESULT dateobj_to_string(DateInstance *date, VARIANT *retv)
offset
=
date
->
bias
+
offset
=
date
->
bias
+
daylight_saving_ta
(
time
,
date
);
daylight_saving_ta
(
time
,
date
);
return
date_to_string
(
time
,
TRUE
,
offset
,
r
etv
);
return
date_to_string
(
time
,
TRUE
,
offset
,
r
);
}
}
static
HRESULT
Date_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -612,12 +611,12 @@ static HRESULT Date_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -612,12 +611,12 @@ static HRESULT Date_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
dateobj_to_string
(
date
,
r
etv
);
return
dateobj_to_string
(
date
,
r
);
}
}
/* ECMA-262 3rd Edition 15.9.1.5 */
/* ECMA-262 3rd Edition 15.9.1.5 */
static
HRESULT
Date_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
SYSTEMTIME
st
;
...
@@ -631,11 +630,11 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -631,11 +630,11 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -643,9 +642,9 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -643,9 +642,9 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
return
dateobj_to_string
(
date
,
r
etv
);
return
dateobj_to_string
(
date
,
r
);
if
(
r
etv
)
{
if
(
r
)
{
date_len
=
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
NULL
,
0
);
date_len
=
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
NULL
,
0
);
time_len
=
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
NULL
,
0
);
time_len
=
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
NULL
,
0
);
date_str
=
SysAllocStringLen
(
NULL
,
date_len
+
time_len
-
1
);
date_str
=
SysAllocStringLen
(
NULL
,
date_len
+
time_len
-
1
);
...
@@ -655,14 +654,13 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -655,14 +654,13 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
&
date_str
[
date_len
],
time_len
);
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
&
date_str
[
date_len
],
time_len
);
date_str
[
date_len
-
1
]
=
' '
;
date_str
[
date_len
-
1
]
=
' '
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Date_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -671,13 +669,13 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -671,13 +669,13 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
static
inline
HRESULT
create_utc_string
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
static
inline
HRESULT
create_utc_string
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatADW
[]
=
{
'%'
,
's'
,
','
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
static
const
WCHAR
formatADW
[]
=
{
'%'
,
's'
,
','
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
...
@@ -706,16 +704,16 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
...
@@ -706,16 +704,16 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
if
(
r
etv
)
{
if
(
r
)
{
len
=
17
;
len
=
17
;
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
...
@@ -773,29 +771,28 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
...
@@ -773,29 +771,28 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
SysFreeString
(
week
);
SysFreeString
(
week
);
SysFreeString
(
month
);
SysFreeString
(
month
);
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.42 */
/* ECMA-262 3rd Edition 15.9.5.42 */
static
HRESULT
Date_toUTCString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toUTCString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
create_utc_string
(
ctx
,
jsthis
,
r
etv
,
ei
);
return
create_utc_string
(
ctx
,
jsthis
,
r
,
ei
);
}
}
static
HRESULT
Date_toGMTString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toGMTString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
create_utc_string
(
ctx
,
jsthis
,
r
etv
,
ei
);
return
create_utc_string
(
ctx
,
jsthis
,
r
,
ei
);
}
}
/* ECMA-262 3rd Edition 15.9.5.3 */
/* ECMA-262 3rd Edition 15.9.5.3 */
static
HRESULT
dateobj_to_date_string
(
DateInstance
*
date
,
VARIANT
*
retv
)
static
HRESULT
dateobj_to_date_string
(
DateInstance
*
date
,
jsval_t
*
r
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatADW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'd'
,
0
};
static
const
WCHAR
formatADW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'd'
,
0
};
...
@@ -819,18 +816,18 @@ static HRESULT dateobj_to_date_string(DateInstance *date, VARIANT *retv)
...
@@ -819,18 +816,18 @@ static HRESULT dateobj_to_date_string(DateInstance *date, VARIANT *retv)
DWORD
lcid_en
,
week_id
,
month_id
;
DWORD
lcid_en
,
week_id
,
month_id
;
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
time
=
local_time
(
date
->
time
,
date
);
time
=
local_time
(
date
->
time
,
date
);
if
(
r
etv
)
{
if
(
r
)
{
len
=
5
;
len
=
5
;
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
...
@@ -886,26 +883,25 @@ static HRESULT dateobj_to_date_string(DateInstance *date, VARIANT *retv)
...
@@ -886,26 +883,25 @@ static HRESULT dateobj_to_date_string(DateInstance *date, VARIANT *retv)
SysFreeString
(
week
);
SysFreeString
(
week
);
SysFreeString
(
month
);
SysFreeString
(
month
);
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Date_toDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
dateobj_to_date_string
(
date
,
r
etv
);
return
dateobj_to_date_string
(
date
,
r
);
}
}
/* ECMA-262 3rd Edition 15.9.5.4 */
/* ECMA-262 3rd Edition 15.9.5.4 */
static
HRESULT
Date_toTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
static
const
WCHAR
formatW
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
...
@@ -924,18 +920,17 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -924,18 +920,17 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
}
}
time
=
local_time
(
date
->
time
,
date
);
time
=
local_time
(
date
->
time
,
date
);
if
(
r
etv
)
{
if
(
r
)
{
date_str
=
SysAllocStringLen
(
NULL
,
17
);
date_str
=
SysAllocStringLen
(
NULL
,
17
);
if
(
!
date_str
)
if
(
!
date_str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -957,15 +952,14 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -957,15 +952,14 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
sprintfW
(
date_str
,
formatUTCW
,
(
int
)
hour_from_time
(
time
),
sprintfW
(
date_str
,
formatUTCW
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
));
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
));
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.6 */
/* ECMA-262 3rd Edition 15.9.5.6 */
static
HRESULT
Date_toLocaleDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toLocaleDateString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
SYSTEMTIME
st
;
...
@@ -979,11 +973,11 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -979,11 +973,11 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -991,24 +985,23 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -991,24 +985,23 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
return
dateobj_to_date_string
(
date
,
r
etv
);
return
dateobj_to_date_string
(
date
,
r
);
if
(
r
etv
)
{
if
(
r
)
{
len
=
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
NULL
,
0
);
len
=
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
NULL
,
0
);
date_str
=
SysAllocStringLen
(
NULL
,
len
);
date_str
=
SysAllocStringLen
(
NULL
,
len
);
if
(
!
date_str
)
if
(
!
date_str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
date_str
,
len
);
GetDateFormatW
(
ctx
->
lcid
,
DATE_LONGDATE
,
&
st
,
NULL
,
date_str
,
len
);
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.7 */
/* ECMA-262 3rd Edition 15.9.5.7 */
static
HRESULT
Date_toLocaleTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_toLocaleTimeString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
static
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
SYSTEMTIME
st
;
SYSTEMTIME
st
;
...
@@ -1022,11 +1015,11 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -1022,11 +1015,11 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
isnan
(
date
->
time
))
{
if
(
isnan
(
date
->
time
))
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
NaNW
);
V_BSTR
(
retv
)
=
SysAllocString
(
NaNW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1034,24 +1027,23 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -1034,24 +1027,23 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
st
=
create_systemtime
(
local_time
(
date
->
time
,
date
));
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
if
(
st
.
wYear
<
1601
||
st
.
wYear
>
9999
)
return
Date_toTimeString
(
ctx
,
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
Date_toTimeString
(
ctx
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
if
(
r
etv
)
{
if
(
r
)
{
len
=
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
NULL
,
0
);
len
=
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
NULL
,
0
);
date_str
=
SysAllocStringLen
(
NULL
,
len
);
date_str
=
SysAllocStringLen
(
NULL
,
len
);
if
(
!
date_str
)
if
(
!
date_str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
date_str
,
len
);
GetTimeFormatW
(
ctx
->
lcid
,
0
,
&
st
,
NULL
,
date_str
,
len
);
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
date_str
);
V_BSTR
(
retv
)
=
date_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.9 */
/* ECMA-262 3rd Edition 15.9.5.9 */
static
HRESULT
Date_getTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1060,14 +1052,14 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1060,14 +1052,14 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.10 */
/* ECMA-262 3rd Edition 15.9.5.10 */
static
HRESULT
Date_getFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1076,17 +1068,17 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1076,17 +1068,17 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
{
if
(
r
)
{
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
num_set_val
(
retv
,
year_from_time
(
time
));
*
r
=
jsval_number
(
year_from_time
(
time
));
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.11 */
/* ECMA-262 3rd Edition 15.9.5.11 */
static
HRESULT
Date_getUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1095,14 +1087,14 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -1095,14 +1087,14 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
year_from_time
(
date
->
time
));
*
r
=
jsval_number
(
year_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.12 */
/* ECMA-262 3rd Edition 15.9.5.12 */
static
HRESULT
Date_getMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1111,17 +1103,14 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1111,17 +1103,14 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
month_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
month_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.13 */
/* ECMA-262 3rd Edition 15.9.5.13 */
static
HRESULT
Date_getUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1130,14 +1119,14 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1130,14 +1119,14 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
month_from_time
(
date
->
time
));
*
r
=
jsval_number
(
month_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.14 */
/* ECMA-262 3rd Edition 15.9.5.14 */
static
HRESULT
Date_getDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1146,17 +1135,14 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1146,17 +1135,14 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
date_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
date_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.15 */
/* ECMA-262 3rd Edition 15.9.5.15 */
static
HRESULT
Date_getUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1165,14 +1151,14 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1165,14 +1151,14 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
date_from_time
(
date
->
time
));
*
r
=
jsval_number
(
date_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.16 */
/* ECMA-262 3rd Edition 15.9.5.16 */
static
HRESULT
Date_getDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1181,17 +1167,14 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
...
@@ -1181,17 +1167,14 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
week_day
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
week_day
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.17 */
/* ECMA-262 3rd Edition 15.9.5.17 */
static
HRESULT
Date_getUTCDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCDay
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1200,14 +1183,14 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -1200,14 +1183,14 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
week_day
(
date
->
time
));
*
r
=
jsval_number
(
week_day
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.18 */
/* ECMA-262 3rd Edition 15.9.5.18 */
static
HRESULT
Date_getHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1216,17 +1199,14 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1216,17 +1199,14 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
hour_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
hour_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.19 */
/* ECMA-262 3rd Edition 15.9.5.19 */
static
HRESULT
Date_getUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1235,14 +1215,14 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1235,14 +1215,14 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
hour_from_time
(
date
->
time
));
*
r
=
jsval_number
(
hour_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.20 */
/* ECMA-262 3rd Edition 15.9.5.20 */
static
HRESULT
Date_getMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1251,17 +1231,14 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1251,17 +1231,14 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
min_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
min_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.21 */
/* ECMA-262 3rd Edition 15.9.5.21 */
static
HRESULT
Date_getUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1270,14 +1247,14 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1270,14 +1247,14 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
min_from_time
(
date
->
time
));
*
r
=
jsval_number
(
min_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.22 */
/* ECMA-262 3rd Edition 15.9.5.22 */
static
HRESULT
Date_getSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1286,17 +1263,14 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1286,17 +1263,14 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
sec_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
sec_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.23 */
/* ECMA-262 3rd Edition 15.9.5.23 */
static
HRESULT
Date_getUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1305,14 +1279,14 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1305,14 +1279,14 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
sec_from_time
(
date
->
time
));
*
r
=
jsval_number
(
sec_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.24 */
/* ECMA-262 3rd Edition 15.9.5.24 */
static
HRESULT
Date_getMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1321,17 +1295,14 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -1321,17 +1295,14 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
{
if
(
r
)
DOUBLE
time
=
local_time
(
date
->
time
,
date
);
*
r
=
jsval_number
(
ms_from_time
(
local_time
(
date
->
time
,
date
)));
num_set_val
(
retv
,
ms_from_time
(
time
));
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.25 */
/* ECMA-262 3rd Edition 15.9.5.25 */
static
HRESULT
Date_getUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1340,14 +1311,14 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -1340,14 +1311,14 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
ms_from_time
(
date
->
time
));
*
r
=
jsval_number
(
ms_from_time
(
date
->
time
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.26 */
/* ECMA-262 3rd Edition 15.9.5.26 */
static
HRESULT
Date_getTimezoneOffset
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getTimezoneOffset
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
...
@@ -1356,15 +1327,14 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f
...
@@ -1356,15 +1327,14 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f
if
(
!
(
date
=
date_this
(
jsthis
)))
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_DATE_EXPECTED
,
NULL
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
floor
(
*
r
=
jsval_number
(
floor
((
date
->
time
-
local_time
(
date
->
time
,
date
))
/
MS_PER_MINUTE
));
(
date
->
time
-
local_time
(
date
->
time
,
date
))
/
MS_PER_MINUTE
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.27 */
/* ECMA-262 3rd Edition 15.9.5.27 */
static
HRESULT
Date_setTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setTime
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
n
;
double
n
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -1384,15 +1354,14 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1384,15 +1354,14 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
date
->
time
=
time_clip
(
n
);
date
->
time
=
time_clip
(
n
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.28 */
/* ECMA-262 3rd Edition 15.9.5.28 */
static
HRESULT
Date_setMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
n
,
t
;
double
n
,
t
;
...
@@ -1415,15 +1384,14 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -1415,15 +1384,14 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
sec_from_time
(
t
),
n
));
sec_from_time
(
t
),
n
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.29 */
/* ECMA-262 3rd Edition 15.9.5.29 */
static
HRESULT
Date_setUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCMilliseconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
n
,
t
;
double
n
,
t
;
...
@@ -1446,15 +1414,14 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -1446,15 +1414,14 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
sec_from_time
(
t
),
n
));
sec_from_time
(
t
),
n
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.30 */
/* ECMA-262 3rd Edition 15.9.5.30 */
static
HRESULT
Date_setSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
sec
,
ms
;
double
t
,
sec
,
ms
;
...
@@ -1486,15 +1453,14 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1486,15 +1453,14 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
min_from_time
(
t
),
sec
,
ms
));
min_from_time
(
t
),
sec
,
ms
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.31 */
/* ECMA-262 3rd Edition 15.9.5.31 */
static
HRESULT
Date_setUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCSeconds
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
sec
,
ms
;
double
t
,
sec
,
ms
;
...
@@ -1526,15 +1492,14 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1526,15 +1492,14 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
min_from_time
(
t
),
sec
,
ms
));
min_from_time
(
t
),
sec
,
ms
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.33 */
/* ECMA-262 3rd Edition 15.9.5.33 */
static
HRESULT
Date_setMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
min
,
sec
,
ms
;
double
t
,
min
,
sec
,
ms
;
...
@@ -1574,15 +1539,14 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1574,15 +1539,14 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
min
,
sec
,
ms
));
min
,
sec
,
ms
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.34 */
/* ECMA-262 3rd Edition 15.9.5.34 */
static
HRESULT
Date_setUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCMinutes
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
min
,
sec
,
ms
;
double
t
,
min
,
sec
,
ms
;
...
@@ -1622,15 +1586,14 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1622,15 +1586,14 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
min
,
sec
,
ms
));
min
,
sec
,
ms
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.35 */
/* ECMA-262 3rd Edition 15.9.5.35 */
static
HRESULT
Date_setHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
hour
,
min
,
sec
,
ms
;
double
t
,
hour
,
min
,
sec
,
ms
;
...
@@ -1677,15 +1640,14 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1677,15 +1640,14 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
t
=
make_date
(
day
(
t
),
make_time
(
hour
,
min
,
sec
,
ms
));
t
=
make_date
(
day
(
t
),
make_time
(
hour
,
min
,
sec
,
ms
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.36 */
/* ECMA-262 3rd Edition 15.9.5.36 */
static
HRESULT
Date_setUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCHours
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
hour
,
min
,
sec
,
ms
;
double
t
,
hour
,
min
,
sec
,
ms
;
...
@@ -1732,15 +1694,14 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1732,15 +1694,14 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
t
=
make_date
(
day
(
t
),
make_time
(
hour
,
min
,
sec
,
ms
));
t
=
make_date
(
day
(
t
),
make_time
(
hour
,
min
,
sec
,
ms
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.36 */
/* ECMA-262 3rd Edition 15.9.5.36 */
static
HRESULT
Date_setDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
n
;
double
t
,
n
;
...
@@ -1762,15 +1723,14 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1762,15 +1723,14 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
t
=
make_date
(
make_day
(
year_from_time
(
t
),
month_from_time
(
t
),
n
),
time_within_day
(
t
));
t
=
make_date
(
make_day
(
year_from_time
(
t
),
month_from_time
(
t
),
n
),
time_within_day
(
t
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.37 */
/* ECMA-262 3rd Edition 15.9.5.37 */
static
HRESULT
Date_setUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCDate
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
n
;
double
t
,
n
;
...
@@ -1792,15 +1752,14 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -1792,15 +1752,14 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
t
=
make_date
(
make_day
(
year_from_time
(
t
),
month_from_time
(
t
),
n
),
time_within_day
(
t
));
t
=
make_date
(
make_day
(
year_from_time
(
t
),
month_from_time
(
t
),
n
),
time_within_day
(
t
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.38 */
/* ECMA-262 3rd Edition 15.9.5.38 */
static
HRESULT
Date_setMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
DOUBLE
t
,
month
,
ddate
;
DOUBLE
t
,
month
,
ddate
;
...
@@ -1832,15 +1791,14 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1832,15 +1791,14 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
time_within_day
(
t
));
time_within_day
(
t
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.39 */
/* ECMA-262 3rd Edition 15.9.5.39 */
static
HRESULT
Date_setUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCMonth
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
month
,
ddate
;
double
t
,
month
,
ddate
;
...
@@ -1872,15 +1830,14 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1872,15 +1830,14 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
time_within_day
(
t
));
time_within_day
(
t
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.40 */
/* ECMA-262 3rd Edition 15.9.5.40 */
static
HRESULT
Date_setFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
year
,
month
,
ddate
;
double
t
,
year
,
month
,
ddate
;
...
@@ -1919,15 +1876,14 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1919,15 +1876,14 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
t
=
make_date
(
make_day
(
year
,
month
,
ddate
),
time_within_day
(
t
));
t
=
make_date
(
make_day
(
year
,
month
,
ddate
),
time_within_day
(
t
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
date
->
time
=
time_clip
(
utc
(
t
,
date
));
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.9.5.41 */
/* ECMA-262 3rd Edition 15.9.5.41 */
static
HRESULT
Date_setUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setUTCFullYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
double
t
,
year
,
month
,
ddate
;
double
t
,
year
,
month
,
ddate
;
...
@@ -1966,15 +1922,14 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -1966,15 +1922,14 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
t
=
make_date
(
make_day
(
year
,
month
,
ddate
),
time_within_day
(
t
));
t
=
make_date
(
make_day
(
year
,
month
,
ddate
),
time_within_day
(
t
));
date
->
time
=
time_clip
(
t
);
date
->
time
=
time_clip
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition B2.4 */
/* ECMA-262 3rd Edition B2.4 */
static
HRESULT
Date_getYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_getYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
DOUBLE
t
,
year
;
DOUBLE
t
,
year
;
...
@@ -1986,21 +1941,20 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1986,21 +1941,20 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
t
=
local_time
(
date
->
time
,
date
);
t
=
local_time
(
date
->
time
,
date
);
if
(
isnan
(
t
))
{
if
(
isnan
(
t
))
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
year
=
year_from_time
(
t
);
year
=
year_from_time
(
t
);
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
(
1900
<=
year
&&
year
<
2000
)
?
year
-
1900
:
year
);
*
r
=
jsval_number
((
1900
<=
year
&&
year
<
2000
)
?
year
-
1900
:
year
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition B2.5 */
/* ECMA-262 3rd Edition B2.5 */
static
HRESULT
Date_setYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_setYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DateInstance
*
date
;
DateInstance
*
date
;
DOUBLE
t
,
year
;
DOUBLE
t
,
year
;
...
@@ -2022,8 +1976,8 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -2022,8 +1976,8 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
isnan
(
year
))
{
if
(
isnan
(
year
))
{
date
->
time
=
year
;
date
->
time
=
year
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -2033,13 +1987,13 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -2033,13 +1987,13 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
date
->
time
=
time_clip
(
utc
(
make_date
(
make_day
(
year
,
month_from_time
(
t
),
date_from_time
(
t
)),
time_within_day
(
t
)),
date
));
date
->
time
=
time_clip
(
utc
(
make_date
(
make_day
(
year
,
month_from_time
(
t
),
date_from_time
(
t
)),
time_within_day
(
t
)),
date
));
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
date
->
time
);
*
r
=
jsval_number
(
date
->
time
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Date_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Date_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -2412,7 +2366,7 @@ static inline HRESULT date_parse(BSTR input, double *ret) {
...
@@ -2412,7 +2366,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
,
VARIANT
*
argv
,
static
HRESULT
DateConstr_parse
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
parse_str
;
BSTR
parse_str
;
double
n
;
double
n
;
...
@@ -2421,8 +2375,8 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -2421,8 +2375,8 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -2435,7 +2389,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -2435,7 +2389,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
num_set_val
(
retv
,
n
);
*
r
=
jsval_number
(
n
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -2510,7 +2464,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, VARIANT *argv, double
...
@@ -2510,7 +2464,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, VARIANT *argv, double
}
}
static
HRESULT
DateConstr_UTC
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
DateConstr_UTC
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
n
;
double
n
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -2518,13 +2472,13 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -2518,13 +2472,13 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
n
,
ei
);
hres
=
date_utc
(
ctx
,
argc
,
argv
,
&
n
,
ei
);
if
(
SUCCEEDED
(
hres
)
&&
r
etv
)
if
(
SUCCEEDED
(
hres
)
&&
r
)
num_set_val
(
retv
,
n
);
*
r
=
jsval_number
(
n
);
return
hres
;
return
hres
;
}
}
static
HRESULT
DateConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
DateConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
date
;
jsdisp_t
*
date
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -2591,7 +2545,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -2591,7 +2545,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
}
}
}
var_set_jsdisp
(
retv
,
date
);
*
r
=
jsval_obj
(
date
);
return
S_OK
;
return
S_OK
;
case
INVOKE_FUNC
:
{
case
INVOKE_FUNC
:
{
...
@@ -2603,7 +2557,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -2603,7 +2557,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
lltime
=
((
LONGLONG
)
local_time
.
dwHighDateTime
<<
32
)
lltime
=
((
LONGLONG
)
local_time
.
dwHighDateTime
<<
32
)
+
local_time
.
dwLowDateTime
;
+
local_time
.
dwLowDateTime
;
return
date_to_string
(
lltime
/
10000
-
TIME_EPOCH
,
FALSE
,
0
,
r
etv
);
return
date_to_string
(
lltime
/
10000
-
TIME_EPOCH
,
FALSE
,
0
,
r
);
}
}
default:
default:
...
...
dlls/jscript/dispex.c
View file @
932b3dd0
...
@@ -348,7 +348,7 @@ static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, unsigned *argc
...
@@ -348,7 +348,7 @@ static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, unsigned *argc
}
}
static
HRESULT
invoke_prop_func
(
jsdisp_t
*
This
,
IDispatch
*
jsthis
,
dispex_prop_t
*
prop
,
WORD
flags
,
static
HRESULT
invoke_prop_func
(
jsdisp_t
*
This
,
IDispatch
*
jsthis
,
dispex_prop_t
*
prop
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -366,17 +366,17 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
...
@@ -366,17 +366,17 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
set_disp
(
&
vthis
,
jsthis
);
set_disp
(
&
vthis
,
jsthis
);
else
else
set_jsdisp
(
&
vthis
,
This
);
set_jsdisp
(
&
vthis
,
This
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
,
ei
);
vdisp_release
(
&
vthis
);
vdisp_release
(
&
vthis
);
}
else
{
}
else
{
/* Function object calls are special case */
/* Function object calls are special case */
hres
=
Function_invoke
(
This
,
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
Function_invoke
(
This
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
return
hres
;
return
hres
;
}
}
case
PROP_PROTREF
:
case
PROP_PROTREF
:
return
invoke_prop_func
(
This
->
prototype
,
jsthis
,
This
->
prototype
->
props
+
prop
->
u
.
ref
,
return
invoke_prop_func
(
This
->
prototype
,
jsthis
,
This
->
prototype
->
props
+
prop
->
u
.
ref
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
caller
);
flags
,
argc
,
argv
,
r
,
ei
,
caller
);
case
PROP_VARIANT
:
{
case
PROP_VARIANT
:
{
if
(
V_VT
(
&
prop
->
u
.
var
)
!=
VT_DISPATCH
)
{
if
(
V_VT
(
&
prop
->
u
.
var
)
!=
VT_DISPATCH
)
{
FIXME
(
"invoke vt %d
\n
"
,
V_VT
(
&
prop
->
u
.
var
));
FIXME
(
"invoke vt %d
\n
"
,
V_VT
(
&
prop
->
u
.
var
));
...
@@ -385,7 +385,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
...
@@ -385,7 +385,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
TRACE
(
"call %s %p
\n
"
,
debugstr_w
(
prop
->
name
),
V_DISPATCH
(
&
prop
->
u
.
var
));
TRACE
(
"call %s %p
\n
"
,
debugstr_w
(
prop
->
name
),
V_DISPATCH
(
&
prop
->
u
.
var
));
return
disp_call_value
(
This
->
ctx
,
V_DISPATCH
(
&
prop
->
u
.
var
),
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
disp_call_value
(
This
->
ctx
,
V_DISPATCH
(
&
prop
->
u
.
var
),
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
default:
default:
ERR
(
"type %d
\n
"
,
prop
->
type
);
ERR
(
"type %d
\n
"
,
prop
->
type
);
...
@@ -413,10 +413,15 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
...
@@ -413,10 +413,15 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
hres
=
VariantCopy
(
retv
,
&
prop
->
u
.
var
);
hres
=
VariantCopy
(
retv
,
&
prop
->
u
.
var
);
}
else
{
}
else
{
vdisp_t
vthis
;
vdisp_t
vthis
;
jsval_t
r
;
set_jsdisp
(
&
vthis
,
This
);
set_jsdisp
(
&
vthis
,
This
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYGET
,
0
,
NULL
,
retv
,
ei
);
hres
=
prop
->
u
.
p
->
invoke
(
This
->
ctx
,
&
vthis
,
DISPATCH_PROPERTYGET
,
0
,
NULL
,
&
r
,
ei
);
vdisp_release
(
&
vthis
);
vdisp_release
(
&
vthis
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsval_to_variant
(
r
,
retv
);
jsval_release
(
r
);
}
}
}
break
;
break
;
case
PROP_PROTREF
:
case
PROP_PROTREF
:
...
@@ -679,15 +684,20 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
...
@@ -679,15 +684,20 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
case
DISPATCH_CONSTRUCT
:
{
case
DISPATCH_CONSTRUCT
:
{
VARIANT
*
argv
;
VARIANT
*
argv
;
unsigned
argc
;
unsigned
argc
;
jsval_t
r
;
VARIANT
buf
[
6
];
VARIANT
buf
[
6
];
hres
=
convert_params
(
pdp
,
buf
,
&
argc
,
&
argv
);
hres
=
convert_params
(
pdp
,
buf
,
&
argc
,
&
argv
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
invoke_prop_func
(
This
,
get_this
(
pdp
),
prop
,
wFlags
,
argc
,
argv
,
pvarRes
,
&
jsexcept
,
pspCaller
);
hres
=
invoke_prop_func
(
This
,
get_this
(
pdp
),
prop
,
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
,
&
jsexcept
,
pspCaller
);
if
(
argv
!=
buf
)
if
(
argv
!=
buf
)
heap_free
(
argv
);
heap_free
(
argv
);
if
(
SUCCEEDED
(
hres
)
&&
pvarRes
)
{
hres
=
jsval_to_variant
(
r
,
pvarRes
);
jsval_release
(
r
);
}
break
;
break
;
}
}
case
DISPATCH_PROPERTYGET
:
case
DISPATCH_PROPERTYGET
:
...
@@ -995,18 +1005,18 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *
...
@@ -995,18 +1005,18 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *
return
DISP_E_UNKNOWNNAME
;
return
DISP_E_UNKNOWNNAME
;
}
}
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsexcept_t
*
ei
)
{
{
HRESULT
hres
;
HRESULT
hres
;
if
(
is_class
(
jsfunc
,
JSCLASS_FUNCTION
))
{
if
(
is_class
(
jsfunc
,
JSCLASS_FUNCTION
))
{
hres
=
Function_invoke
(
jsfunc
,
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
Function_invoke
(
jsfunc
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
}
else
{
}
else
{
vdisp_t
vdisp
;
vdisp_t
vdisp
;
set_disp
(
&
vdisp
,
jsthis
);
set_disp
(
&
vdisp
,
jsthis
);
hres
=
jsfunc
->
builtin_info
->
value_prop
.
invoke
(
jsfunc
->
ctx
,
&
vdisp
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
jsfunc
->
builtin_info
->
value_prop
.
invoke
(
jsfunc
->
ctx
,
&
vdisp
,
flags
,
argc
,
argv
,
r
,
ei
);
vdisp_release
(
&
vdisp
);
vdisp_release
(
&
vdisp
);
}
}
return
hres
;
return
hres
;
...
@@ -1015,6 +1025,8 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsig
...
@@ -1015,6 +1025,8 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsig
HRESULT
jsdisp_call
(
jsdisp_t
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_call
(
jsdisp_t
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
{
{
dispex_prop_t
*
prop
;
dispex_prop_t
*
prop
;
jsval_t
r
;
HRESULT
hres
;
memset
(
ei
,
0
,
sizeof
(
*
ei
));
memset
(
ei
,
0
,
sizeof
(
*
ei
));
if
(
retv
)
if
(
retv
)
...
@@ -1024,10 +1036,18 @@ HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, VARIAN
...
@@ -1024,10 +1036,18 @@ HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, VARIAN
if
(
!
prop
)
if
(
!
prop
)
return
DISP_E_MEMBERNOTFOUND
;
return
DISP_E_MEMBERNOTFOUND
;
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
retv
,
ei
,
NULL
);
hres
=
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
retv
?
&
r
:
NULL
,
ei
,
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
{
hres
=
jsval_to_variant
(
r
,
retv
);
jsval_release
(
r
);
}
return
hres
;
}
}
HRESULT
jsdisp_call_name
(
jsdisp_t
*
disp
,
const
WCHAR
*
name
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
HRESULT
jsdisp_call_name
(
jsdisp_t
*
disp
,
const
WCHAR
*
name
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
jsexcept_t
*
ei
)
{
{
dispex_prop_t
*
prop
;
dispex_prop_t
*
prop
;
...
@@ -1038,10 +1058,7 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned
...
@@ -1038,10 +1058,7 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned
return
hres
;
return
hres
;
memset
(
ei
,
0
,
sizeof
(
*
ei
));
memset
(
ei
,
0
,
sizeof
(
*
ei
));
if
(
retv
)
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
r
,
ei
,
NULL
);
V_VT
(
retv
)
=
VT_EMPTY
;
return
invoke_prop_func
(
disp
,
to_disp
(
disp
),
prop
,
flags
,
argc
,
argv
,
retv
,
ei
,
NULL
);
}
}
HRESULT
disp_call
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
HRESULT
disp_call
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
DISPID
id
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
...
@@ -1123,11 +1140,11 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
...
@@ -1123,11 +1140,11 @@ 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
,
VARIANT
*
argv
,
HRESULT
disp_call_value
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsdisp
;
jsdisp_t
*
jsdisp
;
IDispatchEx
*
dispex
;
IDispatchEx
*
dispex
;
VARIANT
buf
[
6
];
VARIANT
buf
[
6
]
,
retv
;
DISPPARAMS
dp
;
DISPPARAMS
dp
;
unsigned
i
;
unsigned
i
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -1139,13 +1156,13 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
...
@@ -1139,13 +1156,13 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
return
E_FAIL
;
return
E_FAIL
;
}
}
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
jsdisp_release
(
jsdisp
);
jsdisp_release
(
jsdisp
);
return
hres
;
return
hres
;
}
}
memset
(
ei
,
0
,
sizeof
(
*
ei
));
memset
(
ei
,
0
,
sizeof
(
*
ei
));
if
(
r
etv
&&
argc
)
if
(
r
&&
argc
)
flags
|=
DISPATCH_PROPERTYGET
;
flags
|=
DISPATCH_PROPERTYGET
;
...
@@ -1176,11 +1193,10 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
...
@@ -1176,11 +1193,10 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
V_DISPATCH
(
dp
.
rgvarg
)
=
jsthis
;
V_DISPATCH
(
dp
.
rgvarg
)
=
jsthis
;
}
}
if
(
retv
)
V_VT
(
&
retv
)
=
VT_EMPTY
;
V_VT
(
retv
)
=
VT_EMPTY
;
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_InvokeEx
(
dispex
,
DISPID_VALUE
,
ctx
->
lcid
,
flags
,
&
dp
,
r
etv
,
&
ei
->
ei
,
hres
=
IDispatchEx_InvokeEx
(
dispex
,
DISPID_VALUE
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ei
->
ei
,
&
ctx
->
jscaller
->
IServiceProvider_iface
);
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IDispatchEx_Release
(
dispex
);
IDispatchEx_Release
(
dispex
);
}
else
{
}
else
{
...
@@ -1192,7 +1208,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
...
@@ -1192,7 +1208,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
}
}
TRACE
(
"using IDispatch
\n
"
);
TRACE
(
"using IDispatch
\n
"
);
hres
=
IDispatch_Invoke
(
disp
,
DISPID_VALUE
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
r
etv
,
&
ei
->
ei
,
&
err
);
hres
=
IDispatch_Invoke
(
disp
,
DISPID_VALUE
,
&
IID_NULL
,
ctx
->
lcid
,
flags
,
&
dp
,
r
?
&
retv
:
NULL
,
&
ei
->
ei
,
&
err
);
}
}
if
(
dp
.
rgvarg
!=
buf
)
if
(
dp
.
rgvarg
!=
buf
)
...
@@ -1200,9 +1216,12 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
...
@@ -1200,9 +1216,12 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
if
(
!
r
)
ensure_retval_type
(
retv
);
return
S_OK
;
return
S_OK
;
hres
=
variant_to_jsval
(
&
retv
,
r
);
VariantClear
(
&
retv
);
return
hres
;
}
}
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
VARIANT
*
val
,
jsexcept_t
*
ei
)
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
VARIANT
*
val
,
jsexcept_t
*
ei
)
...
...
dlls/jscript/engine.c
View file @
932b3dd0
...
@@ -385,7 +385,7 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, BSTR name, DWORD
...
@@ -385,7 +385,7 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, BSTR name, DWORD
return
hres
;
return
hres
;
}
}
static
inline
BOOL
is_null
(
const
VARIANT
*
v
)
static
inline
BOOL
is_null
_var
(
const
VARIANT
*
v
)
{
{
return
V_VT
(
v
)
==
VT_NULL
||
(
V_VT
(
v
)
==
VT_DISPATCH
&&
!
V_DISPATCH
(
v
));
return
V_VT
(
v
)
==
VT_NULL
||
(
V_VT
(
v
)
==
VT_DISPATCH
&&
!
V_DISPATCH
(
v
));
}
}
...
@@ -442,8 +442,8 @@ static HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
...
@@ -442,8 +442,8 @@ static HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
if
(
V_VT
(
lval
)
!=
V_VT
(
rval
))
{
if
(
V_VT
(
lval
)
!=
V_VT
(
rval
))
{
if
(
is_num_vt
(
V_VT
(
lval
))
&&
is_num_vt
(
V_VT
(
rval
)))
if
(
is_num_vt
(
V_VT
(
lval
))
&&
is_num_vt
(
V_VT
(
rval
)))
*
ret
=
num_val
(
lval
)
==
num_val
(
rval
);
*
ret
=
num_val
(
lval
)
==
num_val
(
rval
);
else
if
(
is_null
(
lval
))
else
if
(
is_null
_var
(
lval
))
*
ret
=
is_null
(
rval
);
*
ret
=
is_null
_var
(
rval
);
else
else
*
ret
=
FALSE
;
*
ret
=
FALSE
;
return
S_OK
;
return
S_OK
;
...
@@ -981,6 +981,7 @@ static HRESULT interp_new(exec_ctx_t *ctx)
...
@@ -981,6 +981,7 @@ static HRESULT interp_new(exec_ctx_t *ctx)
{
{
const
unsigned
arg
=
get_op_uint
(
ctx
,
0
);
const
unsigned
arg
=
get_op_uint
(
ctx
,
0
);
VARIANT
*
constr
,
v
;
VARIANT
*
constr
,
v
;
jsval_t
r
;
HRESULT
hres
;
HRESULT
hres
;
TRACE
(
"%d
\n
"
,
arg
);
TRACE
(
"%d
\n
"
,
arg
);
...
@@ -996,7 +997,12 @@ static HRESULT interp_new(exec_ctx_t *ctx)
...
@@ -996,7 +997,12 @@ static HRESULT interp_new(exec_ctx_t *ctx)
else
if
(
!
V_DISPATCH
(
constr
))
else
if
(
!
V_DISPATCH
(
constr
))
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
hres
=
disp_call_value
(
ctx
->
script
,
V_DISPATCH
(
constr
),
NULL
,
DISPATCH_CONSTRUCT
,
arg
,
stack_args
(
ctx
,
arg
),
&
v
,
ctx
->
ei
);
hres
=
disp_call_value
(
ctx
->
script
,
V_DISPATCH
(
constr
),
NULL
,
DISPATCH_CONSTRUCT
,
arg
,
stack_args
(
ctx
,
arg
),
&
r
,
ctx
->
ei
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsval_to_variant
(
r
,
&
v
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -1010,6 +1016,7 @@ static HRESULT interp_call(exec_ctx_t *ctx)
...
@@ -1010,6 +1016,7 @@ static HRESULT interp_call(exec_ctx_t *ctx)
const
unsigned
argn
=
get_op_uint
(
ctx
,
0
);
const
unsigned
argn
=
get_op_uint
(
ctx
,
0
);
const
int
do_ret
=
get_op_int
(
ctx
,
1
);
const
int
do_ret
=
get_op_int
(
ctx
,
1
);
VARIANT
v
,
*
objv
;
VARIANT
v
,
*
objv
;
jsval_t
r
;
HRESULT
hres
;
HRESULT
hres
;
TRACE
(
"%d %d
\n
"
,
argn
,
do_ret
);
TRACE
(
"%d %d
\n
"
,
argn
,
do_ret
);
...
@@ -1019,12 +1026,21 @@ static HRESULT interp_call(exec_ctx_t *ctx)
...
@@ -1019,12 +1026,21 @@ static HRESULT interp_call(exec_ctx_t *ctx)
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
return
throw_type_error
(
ctx
->
script
,
ctx
->
ei
,
JS_E_INVALID_PROPERTY
,
NULL
);
hres
=
disp_call_value
(
ctx
->
script
,
V_DISPATCH
(
objv
),
NULL
,
DISPATCH_METHOD
,
argn
,
stack_args
(
ctx
,
argn
),
hres
=
disp_call_value
(
ctx
->
script
,
V_DISPATCH
(
objv
),
NULL
,
DISPATCH_METHOD
,
argn
,
stack_args
(
ctx
,
argn
),
do_ret
?
&
v
:
NULL
,
ctx
->
ei
);
do_ret
?
&
r
:
NULL
,
ctx
->
ei
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
stack_popn
(
ctx
,
argn
+
1
);
stack_popn
(
ctx
,
argn
+
1
);
return
do_ret
?
stack_push
(
ctx
,
&
v
)
:
S_OK
;
if
(
!
do_ret
)
return
S_OK
;
hres
=
jsval_to_variant
(
r
,
&
v
);
jsval_release
(
r
);
if
(
FAILED
(
hres
))
return
hres
;
return
stack_push
(
ctx
,
&
v
);
}
}
...
...
dlls/jscript/error.c
View file @
932b3dd0
...
@@ -35,7 +35,7 @@ static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
...
@@ -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 */
/* ECMA-262 3rd Edition 15.11.4.4 */
static
HRESULT
Error_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
static
HRESULT
Error_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsthis
;
jsdisp_t
*
jsthis
;
BSTR
name
=
NULL
,
msg
=
NULL
,
ret
=
NULL
;
BSTR
name
=
NULL
,
msg
=
NULL
,
ret
=
NULL
;
...
@@ -48,11 +48,11 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
...
@@ -48,11 +48,11 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
jsthis
=
get_jsdisp
(
vthis
);
jsthis
=
get_jsdisp
(
vthis
);
if
(
!
jsthis
||
ctx
->
version
<
2
)
{
if
(
!
jsthis
||
ctx
->
version
<
2
)
{
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
object_errorW
);
V_BSTR
(
retv
)
=
SysAllocString
(
object_errorW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -116,18 +116,15 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
...
@@ -116,18 +116,15 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Error_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
Error_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -227,7 +224,7 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
...
@@ -227,7 +224,7 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
}
}
static
HRESULT
error_constr
(
script_ctx_t
*
ctx
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
error_constr
(
script_ctx_t
*
ctx
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
jsdisp_t
*
constr
)
{
jsval_t
*
r
,
jsexcept_t
*
ei
,
jsdisp_t
*
constr
)
{
jsdisp_t
*
err
;
jsdisp_t
*
err
;
UINT
num
=
0
;
UINT
num
=
0
;
BSTR
msg
=
NULL
;
BSTR
msg
=
NULL
;
...
@@ -261,11 +258,10 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, VARIAN
...
@@ -261,11 +258,10 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, VARIAN
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
err
);
*
r
=
jsval_obj
(
err
);
else
else
jsdisp_release
(
err
);
jsdisp_release
(
err
);
return
S_OK
;
return
S_OK
;
default:
default:
...
@@ -275,59 +271,59 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, VARIAN
...
@@ -275,59 +271,59 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, VARIAN
}
}
static
HRESULT
ErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
ErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
error_constr
);
}
}
static
HRESULT
EvalErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
EvalErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
eval_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
eval_error_constr
);
}
}
static
HRESULT
RangeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
RangeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
range_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
range_error_constr
);
}
}
static
HRESULT
ReferenceErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
ReferenceErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
reference_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
reference_error_constr
);
}
}
static
HRESULT
RegExpErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
RegExpErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
regexp_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
regexp_error_constr
);
}
}
static
HRESULT
SyntaxErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
SyntaxErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
syntax_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
syntax_error_constr
);
}
}
static
HRESULT
TypeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
TypeErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
type_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
type_error_constr
);
}
}
static
HRESULT
URIErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
URIErrorConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
etv
,
ei
,
ctx
->
uri_error_constr
);
return
error_constr
(
ctx
,
flags
,
argc
,
argv
,
r
,
ei
,
ctx
->
uri_error_constr
);
}
}
HRESULT
init_error_constr
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
)
HRESULT
init_error_constr
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
)
...
...
dlls/jscript/function.c
View file @
932b3dd0
...
@@ -75,7 +75,7 @@ static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, u
...
@@ -75,7 +75,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
,
VARIANT
*
argv
,
static
HRESULT
Arguments_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -160,7 +160,7 @@ static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, js
...
@@ -160,7 +160,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
,
VARIANT
*
argv
,
static
HRESULT
invoke_source
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
var_disp
,
*
arg_disp
;
jsdisp_t
*
var_disp
,
*
arg_disp
;
exec_ctx_t
*
exec_ctx
;
exec_ctx_t
*
exec_ctx
;
...
@@ -190,24 +190,28 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
...
@@ -190,24 +190,28 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
jsdisp_release
(
var_disp
);
jsdisp_release
(
var_disp
);
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
{
jsdisp_t
*
prev_args
;
jsdisp_t
*
prev_args
;
VARIANT
retv
;
prev_args
=
function
->
arguments
;
prev_args
=
function
->
arguments
;
function
->
arguments
=
arg_disp
;
function
->
arguments
=
arg_disp
;
hres
=
exec_source
(
exec_ctx
,
function
->
code
,
function
->
func_code
,
FALSE
,
ei
,
r
etv
);
hres
=
exec_source
(
exec_ctx
,
function
->
code
,
function
->
func_code
,
FALSE
,
ei
,
r
?
&
retv
:
NULL
);
function
->
arguments
=
prev_args
;
function
->
arguments
=
prev_args
;
if
(
SUCCEEDED
(
hres
)
&&
r
)
{
hres
=
variant_to_jsval
(
&
retv
,
r
);
VariantClear
(
&
retv
);
}
}
jsdisp_release
(
arg_disp
);
jsdisp_release
(
arg_disp
);
exec_release
(
exec_ctx
);
exec_release
(
exec_ctx
);
}
return
hres
;
return
hres
;
}
}
static
HRESULT
invoke_constructor
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
invoke_constructor
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
this_obj
;
jsdisp_t
*
this_obj
;
VARIANT
var
;
jsval_t
var
;
HRESULT
hres
;
HRESULT
hres
;
hres
=
create_object
(
ctx
,
&
function
->
dispex
,
&
this_obj
);
hres
=
create_object
(
ctx
,
&
function
->
dispex
,
&
this_obj
);
...
@@ -220,19 +224,18 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function,
...
@@ -220,19 +224,18 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function,
return
hres
;
return
hres
;
}
}
if
(
V_VT
(
&
var
)
==
VT_DISPATCH
)
{
if
(
is_object_instance
(
var
)
)
{
jsdisp_release
(
this_obj
);
jsdisp_release
(
this_obj
);
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
var
;
V_DISPATCH
(
retv
)
=
V_DISPATCH
(
&
var
);
}
else
{
}
else
{
VariantClear
(
&
var
);
jsval_release
(
var
);
var_set_jsdisp
(
retv
,
this_obj
);
*
r
=
jsval_obj
(
this_obj
);
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
invoke_value_proc
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_disp
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
invoke_value_proc
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_disp
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
vdisp_t
vthis
;
vdisp_t
vthis
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -244,19 +247,19 @@ static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function,
...
@@ -244,19 +247,19 @@ static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function,
else
else
set_jsdisp
(
&
vthis
,
ctx
->
global
);
set_jsdisp
(
&
vthis
,
ctx
->
global
);
hres
=
function
->
value_proc
(
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
hres
=
function
->
value_proc
(
ctx
,
&
vthis
,
flags
,
argc
,
argv
,
r
,
ei
);
vdisp_release
(
&
vthis
);
vdisp_release
(
&
vthis
);
return
hres
;
return
hres
;
}
}
static
HRESULT
call_function
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
static
HRESULT
call_function
(
script_ctx_t
*
ctx
,
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
if
(
function
->
value_proc
)
if
(
function
->
value_proc
)
return
invoke_value_proc
(
ctx
,
function
,
this_obj
,
DISPATCH_METHOD
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
this_obj
,
DISPATCH_METHOD
,
argc
,
argv
,
r
,
ei
);
return
invoke_source
(
ctx
,
function
,
this_obj
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_source
(
ctx
,
function
,
this_obj
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
function_to_string
(
FunctionInstance
*
function
,
BSTR
*
ret
)
static
HRESULT
function_to_string
(
FunctionInstance
*
function
,
BSTR
*
ret
)
...
@@ -288,7 +291,7 @@ static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
...
@@ -288,7 +291,7 @@ static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
return
S_OK
;
return
S_OK
;
}
}
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
IDispatch
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
;
FunctionInstance
*
function
;
...
@@ -298,17 +301,17 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi
...
@@ -298,17 +301,17 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi
function
=
(
FunctionInstance
*
)
func_this
;
function
=
(
FunctionInstance
*
)
func_this
;
if
(
function
->
value_proc
)
if
(
function
->
value_proc
)
return
invoke_value_proc
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_value_proc
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
flags
,
argc
,
argv
,
r
,
ei
);
if
(
flags
==
DISPATCH_CONSTRUCT
)
if
(
flags
==
DISPATCH_CONSTRUCT
)
return
invoke_constructor
(
function
->
dispex
.
ctx
,
function
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_constructor
(
function
->
dispex
.
ctx
,
function
,
argc
,
argv
,
r
,
ei
);
assert
(
flags
==
DISPATCH_METHOD
);
assert
(
flags
==
DISPATCH_METHOD
);
return
invoke_source
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_source
(
function
->
dispex
.
ctx
,
function
,
jsthis
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
Function_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Function_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
This
=
function_from_vdisp
(
jsthis
);
FunctionInstance
*
This
=
function_from_vdisp
(
jsthis
);
...
@@ -316,7 +319,7 @@ static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -316,7 +319,7 @@ static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
switch
(
flags
)
{
switch
(
flags
)
{
case
DISPATCH_PROPERTYGET
:
case
DISPATCH_PROPERTYGET
:
num_set_int
(
retv
,
This
->
length
);
*
r
=
jsval_number
(
This
->
length
);
break
;
break
;
default:
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
...
@@ -327,7 +330,7 @@ static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -327,7 +330,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
,
VARIANT
*
argv
,
static
HRESULT
Function_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
;
FunctionInstance
*
function
;
BSTR
str
;
BSTR
str
;
...
@@ -342,12 +345,10 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -342,12 +345,10 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
else
}
else
{
SysFreeString
(
str
);
SysFreeString
(
str
);
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -388,7 +389,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
...
@@ -388,7 +389,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
}
}
static
HRESULT
Function_apply
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Function_apply
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
;
FunctionInstance
*
function
;
VARIANT
*
args
=
NULL
;
VARIANT
*
args
=
NULL
;
...
@@ -431,7 +432,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -431,7 +432,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
}
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
r
etv
,
ei
);
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
r
,
ei
);
if
(
this_obj
)
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
IDispatch_Release
(
this_obj
);
...
@@ -442,7 +443,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -442,7 +443,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
,
VARIANT
*
argv
,
static
HRESULT
Function_call
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
;
FunctionInstance
*
function
;
IDispatch
*
this_obj
=
NULL
;
IDispatch
*
this_obj
=
NULL
;
...
@@ -464,7 +465,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -464,7 +465,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
cnt
=
argc
-
1
;
cnt
=
argc
-
1
;
}
}
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
argv
+
1
,
r
etv
,
ei
);
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
argv
+
1
,
r
,
ei
);
if
(
this_obj
)
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
IDispatch_Release
(
this_obj
);
...
@@ -472,7 +473,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -472,7 +473,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
,
VARIANT
*
argv
,
HRESULT
Function_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
;
FunctionInstance
*
function
;
...
@@ -488,7 +489,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -488,7 +489,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
switch
(
flags
)
{
switch
(
flags
)
{
case
DISPATCH_METHOD
:
case
DISPATCH_METHOD
:
assert
(
function
->
value_proc
!=
NULL
);
assert
(
function
->
value_proc
!=
NULL
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
case
DISPATCH_PROPERTYGET
:
{
case
DISPATCH_PROPERTYGET
:
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -498,14 +499,13 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -498,14 +499,13 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
break
;
break
;
}
}
case
DISPATCH_CONSTRUCT
:
case
DISPATCH_CONSTRUCT
:
assert
(
function
->
value_proc
!=
NULL
);
assert
(
function
->
value_proc
!=
NULL
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
invoke_value_proc
(
ctx
,
function
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
default:
default:
FIXME
(
"not implemented flags %x
\n
"
,
flags
);
FIXME
(
"not implemented flags %x
\n
"
,
flags
);
...
@@ -516,7 +516,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -516,7 +516,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
,
static
HRESULT
Function_arguments
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FunctionInstance
*
function
=
(
FunctionInstance
*
)
jsthis
->
u
.
jsdisp
;
FunctionInstance
*
function
=
(
FunctionInstance
*
)
jsthis
->
u
.
jsdisp
;
HRESULT
hres
=
S_OK
;
HRESULT
hres
=
S_OK
;
...
@@ -525,12 +525,7 @@ static HRESULT Function_arguments(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -525,12 +525,7 @@ static HRESULT Function_arguments(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
switch
(
flags
)
{
switch
(
flags
)
{
case
DISPATCH_PROPERTYGET
:
{
case
DISPATCH_PROPERTYGET
:
{
if
(
function
->
arguments
)
{
*
r
=
function
->
arguments
?
jsval_obj
(
jsdisp_addref
(
function
->
arguments
))
:
jsval_null
();
jsdisp_addref
(
function
->
arguments
);
var_set_jsdisp
(
retv
,
function
->
arguments
);
}
else
{
V_VT
(
retv
)
=
VT_NULL
;
}
break
;
break
;
}
}
case
DISPATCH_PROPERTYPUT
:
case
DISPATCH_PROPERTYPUT
:
...
@@ -809,7 +804,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, VARIANT *arg
...
@@ -809,7 +804,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, VARIANT *arg
}
}
static
HRESULT
FunctionConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
FunctionConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -823,8 +818,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -823,8 +818,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
jsval_disp
(
ret
);
V_DISPATCH
(
retv
)
=
ret
;
break
;
break
;
}
}
default:
default:
...
@@ -836,7 +830,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -836,7 +830,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
,
VARIANT
*
argv
,
static
HRESULT
FunctionProt_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
...
dlls/jscript/global.c
View file @
932b3dd0
...
@@ -115,169 +115,168 @@ static WCHAR int_to_char(int i)
...
@@ -115,169 +115,168 @@ static WCHAR int_to_char(int i)
}
}
static
HRESULT
constructor_call
(
jsdisp_t
*
constr
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
constructor_call
(
jsdisp_t
*
constr
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
if
(
flags
!=
DISPATCH_PROPERTYGET
)
if
(
flags
!=
DISPATCH_PROPERTYGET
)
return
jsdisp_call_value
(
constr
,
NULL
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
jsdisp_call_value
(
constr
,
NULL
,
flags
,
argc
,
argv
,
r
,
ei
);
jsdisp_addref
(
constr
);
*
r
=
jsval_obj
(
jsdisp_addref
(
constr
));
var_set_jsdisp
(
retv
,
constr
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_Array
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Array
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
array_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
array_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Boolean
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Boolean
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
bool_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
bool_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Date
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Date
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
date_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
date_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Error
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Error
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_EvalError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_EvalError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
eval_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
eval_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_RangeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_RangeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
range_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
range_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_RegExpError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_RegExpError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
regexp_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
regexp_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_ReferenceError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ReferenceError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
reference_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
reference_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_SyntaxError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_SyntaxError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
syntax_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
syntax_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_TypeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_TypeError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
type_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
type_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_URIError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_URIError
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
uri_error_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
uri_error_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Function
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Function
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
function_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
function_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Number
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Number
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
number_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
number_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Object
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Object
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
object_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
object_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_String
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_String
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
string_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
string_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_RegExp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_RegExp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
regexp_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
regexp_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_ActiveXObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ActiveXObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
activex_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
activex_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_VBArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_VBArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
constructor_call
(
ctx
->
vbarray_constr
,
flags
,
argc
,
argv
,
r
etv
,
ei
);
return
constructor_call
(
ctx
->
vbarray_constr
,
flags
,
argc
,
argv
,
r
,
ei
);
}
}
static
HRESULT
JSGlobal_Enumerator
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_Enumerator
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
JSGlobal_escape
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_escape
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
ret
,
str
;
BSTR
ret
,
str
;
const
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
...
@@ -287,13 +286,12 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -287,13 +286,12 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -339,36 +337,32 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -339,36 +337,32 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
else
else
SysFreeString
(
ret
);
SysFreeString
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.1.2.1 */
/* ECMA-262 3rd Edition 15.1.2.1 */
static
HRESULT
JSGlobal_eval
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_eval
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
bytecode_t
*
code
;
bytecode_t
*
code
;
VARIANT
retv
;
HRESULT
hres
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
V_VT
(
retv
)
=
VT_EMPTY
;
*
r
=
jsval_undefined
()
;
return
S_OK
;
return
S_OK
;
}
}
if
(
V_VT
(
argv
)
!=
VT_BSTR
)
{
if
(
V_VT
(
argv
)
!=
VT_BSTR
)
{
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_EMPTY
;
return
variant_to_jsval
(
argv
,
r
);
return
VariantCopy
(
retv
,
argv
);
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -384,16 +378,22 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -384,16 +378,22 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
throw_syntax_error
(
ctx
,
ei
,
hres
,
NULL
);
return
throw_syntax_error
(
ctx
,
ei
,
hres
,
NULL
);
}
}
hres
=
exec_source
(
ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
TRUE
,
ei
,
retv
);
hres
=
exec_source
(
ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
TRUE
,
ei
,
r
?
&
retv
:
NULL
);
release_bytecode
(
code
);
release_bytecode
(
code
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
r
)
{
hres
=
variant_to_jsval
(
&
retv
,
r
);
VariantClear
(
&
retv
);
}
return
hres
;
return
hres
;
}
}
static
HRESULT
JSGlobal_isNaN
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_isNaN
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VARIANT_BOOL
ret
=
VARIANT_
TRUE
;
BOOL
ret
=
TRUE
;
double
n
;
double
n
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -405,20 +405,18 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -405,20 +405,18 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return
hres
;
return
hres
;
if
(
!
isnan
(
n
))
if
(
!
isnan
(
n
))
ret
=
VARIANT_
FALSE
;
ret
=
FALSE
;
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
ret
);
V_BOOL
(
retv
)
=
ret
;
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_isFinite
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_isFinite
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VARIANT_BOOL
ret
=
VARIANT_
FALSE
;
BOOL
ret
=
FALSE
;
HRESULT
hres
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -431,13 +429,11 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -431,13 +429,11 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
hres
;
return
hres
;
if
(
!
isinf
(
n
)
&&
!
isnan
(
n
))
if
(
!
isinf
(
n
)
&&
!
isnan
(
n
))
ret
=
VARIANT_
TRUE
;
ret
=
TRUE
;
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
ret
);
V_BOOL
(
retv
)
=
ret
;
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -453,7 +449,7 @@ static INT char_to_int(WCHAR c)
...
@@ -453,7 +449,7 @@ static INT char_to_int(WCHAR c)
}
}
static
HRESULT
JSGlobal_parseInt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_parseInt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BOOL
neg
=
FALSE
,
empty
=
TRUE
;
BOOL
neg
=
FALSE
,
empty
=
TRUE
;
DOUBLE
ret
=
0
.
0
;
DOUBLE
ret
=
0
.
0
;
...
@@ -463,7 +459,8 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -463,7 +459,8 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
HRESULT
hres
;
HRESULT
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -474,8 +471,8 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -474,8 +471,8 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
radix
&&
(
radix
<
2
||
radix
>
36
))
{
if
(
radix
&&
(
radix
<
2
||
radix
>
36
))
{
WARN
(
"radix %d out of range
\n
"
,
radix
);
WARN
(
"radix %d out of range
\n
"
,
radix
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
}
}
...
@@ -526,13 +523,13 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -526,13 +523,13 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
neg
)
if
(
neg
)
ret
=
-
ret
;
ret
=
-
ret
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
ret
);
*
r
=
jsval_number
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_parseFloat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_parseFloat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
LONGLONG
d
=
0
,
hlp
;
LONGLONG
d
=
0
,
hlp
;
int
exp
=
0
;
int
exp
=
0
;
...
@@ -542,8 +539,8 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -542,8 +539,8 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
HRESULT
hres
;
HRESULT
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -620,15 +617,15 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
...
@@ -620,15 +617,15 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
if
(
ret_nan
)
{
if
(
ret_nan
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
V_VT
(
retv
)
=
VT_R8
;
if
(
!
positive
)
if
(
!
positive
)
d
=
-
d
;
d
=
-
d
;
V_R8
(
retv
)
=
(
exp
>
0
?
d
*
pow
(
10
,
exp
)
:
d
/
pow
(
10
,
-
exp
));
if
(
r
)
*
r
=
jsval_number
(
exp
>
0
?
d
*
pow
(
10
,
exp
)
:
d
/
pow
(
10
,
-
exp
));
return
S_OK
;
return
S_OK
;
}
}
...
@@ -639,7 +636,7 @@ static inline int hex_to_int(const WCHAR wch) {
...
@@ -639,7 +636,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
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_unescape
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
ret
,
str
;
BSTR
ret
,
str
;
const
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
...
@@ -649,13 +646,11 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -649,13 +646,11 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -707,83 +702,79 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -707,83 +702,79 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
else
else
SysFreeString
(
ret
);
SysFreeString
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_GetObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_GetObject
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
JSGlobal_ScriptEngine
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ScriptEngine
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
JScriptW
[]
=
{
'J'
,
'S'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
0
};
static
const
WCHAR
JScriptW
[]
=
{
'J'
,
'S'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
0
};
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
r
etv
)
{
if
(
r
)
{
BSTR
ret
;
BSTR
ret
;
ret
=
SysAllocString
(
JScriptW
);
ret
=
SysAllocString
(
JScriptW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_ScriptEngineMajorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ScriptEngineMajorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
JSCRIPT_MAJOR_VERSION
);
*
r
=
jsval_number
(
JSCRIPT_MAJOR_VERSION
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_ScriptEngineMinorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ScriptEngineMinorVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
JSCRIPT_MINOR_VERSION
);
*
r
=
jsval_number
(
JSCRIPT_MINOR_VERSION
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_ScriptEngineBuildVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_ScriptEngineBuildVersion
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
JSCRIPT_BUILD_VERSION
);
*
r
=
jsval_number
(
JSCRIPT_BUILD_VERSION
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_CollectGarbage
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_CollectGarbage
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
JSGlobal_encodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_encodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
DWORD
len
=
0
,
i
;
DWORD
len
=
0
,
i
;
...
@@ -795,13 +786,12 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -795,13 +786,12 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -847,17 +837,15 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -847,17 +837,15 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
str
),
debugstr_w
(
ret
));
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
str
),
debugstr_w
(
ret
));
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_decodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_decodeURI
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
str
,
ret
;
BSTR
str
,
ret
;
WCHAR
*
ptr
;
WCHAR
*
ptr
;
...
@@ -869,13 +857,12 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -869,13 +857,12 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -942,18 +929,15 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -942,18 +929,15 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
str
),
debugstr_w
(
ret
));
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
str
),
debugstr_w
(
ret
));
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
JSGlobal_encodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_encodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
str
,
ret
;
BSTR
str
,
ret
;
char
buf
[
4
];
char
buf
[
4
];
...
@@ -964,13 +948,12 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
...
@@ -964,13 +948,12 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -1015,19 +998,16 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
...
@@ -1015,19 +998,16 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.1.3.2 */
/* ECMA-262 3rd Edition 15.1.3.2 */
static
HRESULT
JSGlobal_decodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
JSGlobal_decodeURIComponent
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
str
,
ret
;
BSTR
str
,
ret
;
const
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
...
@@ -1038,13 +1018,12 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
...
@@ -1038,13 +1018,12 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
ret
=
SysAllocString
(
undefinedW
);
ret
=
SysAllocString
(
undefinedW
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -1138,13 +1117,10 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
...
@@ -1138,13 +1117,10 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
SysFreeString
(
str
);
SysFreeString
(
str
);
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/jscript/jscript.h
View file @
932b3dd0
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "wine/unicode.h"
#include "wine/unicode.h"
#include "wine/list.h"
#include "wine/list.h"
typedef
struct
_jsval_t
jsval_t
;
typedef
struct
_script_ctx_t
script_ctx_t
;
typedef
struct
_script_ctx_t
script_ctx_t
;
typedef
struct
_exec_ctx_t
exec_ctx_t
;
typedef
struct
_exec_ctx_t
exec_ctx_t
;
typedef
struct
_dispex_prop_t
dispex_prop_t
;
typedef
struct
_dispex_prop_t
dispex_prop_t
;
...
@@ -152,7 +153,7 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp)
...
@@ -152,7 +153,7 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp)
return
is_jsdisp
(
vdisp
)
?
vdisp
->
u
.
jsdisp
:
NULL
;
return
is_jsdisp
(
vdisp
)
?
vdisp
->
u
.
jsdisp
:
NULL
;
}
}
typedef
HRESULT
(
*
builtin_invoke_t
)(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
);
typedef
HRESULT
(
*
builtin_invoke_t
)(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
);
typedef
struct
{
typedef
struct
{
const
WCHAR
*
name
;
const
WCHAR
*
name
;
...
@@ -192,9 +193,10 @@ static inline IDispatch *to_disp(jsdisp_t *jsdisp)
...
@@ -192,9 +193,10 @@ static inline IDispatch *to_disp(jsdisp_t *jsdisp)
jsdisp_t
*
as_jsdisp
(
IDispatch
*
)
DECLSPEC_HIDDEN
;
jsdisp_t
*
as_jsdisp
(
IDispatch
*
)
DECLSPEC_HIDDEN
;
jsdisp_t
*
to_jsdisp
(
IDispatch
*
)
DECLSPEC_HIDDEN
;
jsdisp_t
*
to_jsdisp
(
IDispatch
*
)
DECLSPEC_HIDDEN
;
static
inline
void
jsdisp_addref
(
jsdisp_t
*
jsdisp
)
static
inline
jsdisp_t
*
jsdisp_addref
(
jsdisp_t
*
jsdisp
)
{
{
IDispatchEx_AddRef
(
&
jsdisp
->
IDispatchEx_iface
);
IDispatchEx_AddRef
(
&
jsdisp
->
IDispatchEx_iface
);
return
jsdisp
;
}
}
static
inline
void
jsdisp_release
(
jsdisp_t
*
jsdisp
)
static
inline
void
jsdisp_release
(
jsdisp_t
*
jsdisp
)
...
@@ -207,10 +209,10 @@ HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DEC
...
@@ -207,10 +209,10 @@ HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DEC
HRESULT
init_dispex_from_constr
(
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
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_value
(
script_ctx_t
*
,
IDispatch
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_value
(
script_ctx_t
*
,
IDispatch
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call
(
jsdisp_t
*
,
DISPID
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call
(
jsdisp_t
*
,
DISPID
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_name
(
jsdisp_t
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_name
(
jsdisp_t
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propget
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propget
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propput
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propput
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget
(
jsdisp_t
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget
(
jsdisp_t
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
...
@@ -228,8 +230,8 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
...
@@ -228,8 +230,8 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_builtin_constructor
(
script_ctx_t
*
,
builtin_invoke_t
,
const
WCHAR
*
,
const
builtin_info_t
*
,
DWORD
,
HRESULT
create_builtin_constructor
(
script_ctx_t
*
,
builtin_invoke_t
,
const
WCHAR
*
,
const
builtin_info_t
*
,
DWORD
,
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
Function_value
(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_value
(
script_ctx_t
*
,
vdisp_t
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
VARIANT
*
,
jsexcept_t
*
)
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
VARIANT
*
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
throw_eval_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
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_generic_error
(
script_ctx_t
*
,
jsexcept_t
*
,
HRESULT
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
...
@@ -259,10 +261,12 @@ typedef enum {
...
@@ -259,10 +261,12 @@ typedef enum {
HRESULT
to_primitive
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
VARIANT
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_primitive
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
VARIANT
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean
(
VARIANT
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean
(
VARIANT
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number_jsval
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_int32
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
INT
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_int32
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
INT
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_uint32
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_uint32
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string_jsval
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_object
(
script_ctx_t
*
,
VARIANT
*
,
IDispatch
**
)
DECLSPEC_HIDDEN
;
HRESULT
to_object
(
script_ctx_t
*
,
VARIANT
*
,
IDispatch
**
)
DECLSPEC_HIDDEN
;
HRESULT
variant_change_type
(
script_ctx_t
*
,
VARIANT
*
,
VARIANT
*
,
VARTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
variant_change_type
(
script_ctx_t
*
,
VARIANT
*
,
VARIANT
*
,
VARTYPE
)
DECLSPEC_HIDDEN
;
...
@@ -377,7 +381,7 @@ HRESULT regexp_match_next(script_ctx_t*,jsdisp_t*,DWORD,const WCHAR*,DWORD,const
...
@@ -377,7 +381,7 @@ HRESULT regexp_match_next(script_ctx_t*,jsdisp_t*,DWORD,const WCHAR*,DWORD,const
DWORD
*
,
DWORD
*
,
match_result_t
*
)
DECLSPEC_HIDDEN
;
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
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
parse_regexp_flags
(
const
WCHAR
*
,
DWORD
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
regexp_string_match
(
script_ctx_t
*
,
jsdisp_t
*
,
BSTR
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
regexp_string_match
(
script_ctx_t
*
,
jsdisp_t
*
,
BSTR
,
jsval_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
is_class
(
jsdisp_t
*
jsdisp
,
jsclass_t
class
)
static
inline
BOOL
is_class
(
jsdisp_t
*
jsdisp
,
jsclass_t
class
)
{
{
...
@@ -536,3 +540,5 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
...
@@ -536,3 +540,5 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return
ret
;
return
ret
;
}
}
#include "jsval.h"
dlls/jscript/jsutils.c
View file @
932b3dd0
...
@@ -185,6 +185,118 @@ jsheap_t *jsheap_mark(jsheap_t *heap)
...
@@ -185,6 +185,118 @@ jsheap_t *jsheap_mark(jsheap_t *heap)
return
heap
;
return
heap
;
}
}
static
BSTR
clone_bstr
(
BSTR
str
)
{
return
SysAllocStringLen
(
str
,
str
?
SysStringLen
(
str
)
:
0
);
}
void
jsval_release
(
jsval_t
val
)
{
switch
(
val
.
type
)
{
case
JSV_OBJECT
:
IDispatch_Release
(
val
.
u
.
obj
);
break
;
case
JSV_STRING
:
SysFreeString
(
val
.
u
.
str
);
break
;
case
JSV_VARIANT
:
VariantClear
(
val
.
u
.
v
);
heap_free
(
val
.
u
.
v
);
break
;
default:
break
;
}
}
HRESULT
jsval_variant
(
jsval_t
*
val
,
VARIANT
*
var
)
{
HRESULT
hres
;
val
->
type
=
JSV_VARIANT
;
val
->
u
.
v
=
heap_alloc
(
sizeof
(
VARIANT
));
if
(
!
val
->
u
.
v
)
return
E_OUTOFMEMORY
;
V_VT
(
val
->
u
.
v
)
=
VT_EMPTY
;
hres
=
VariantCopy
(
val
->
u
.
v
,
var
);
if
(
FAILED
(
hres
))
heap_free
(
val
->
u
.
v
);
return
hres
;
}
HRESULT
variant_to_jsval
(
VARIANT
*
var
,
jsval_t
*
r
)
{
switch
(
V_VT
(
var
))
{
case
VT_EMPTY
:
*
r
=
jsval_undefined
();
return
S_OK
;
case
VT_NULL
:
*
r
=
jsval_null
();
return
S_OK
;
case
VT_BOOL
:
*
r
=
jsval_bool
(
V_BOOL
(
var
));
return
S_OK
;
case
VT_I4
:
*
r
=
jsval_number
(
V_I4
(
var
));
return
S_OK
;
case
VT_R8
:
*
r
=
jsval_number
(
V_R8
(
var
));
return
S_OK
;
case
VT_BSTR
:
{
BSTR
str
=
clone_bstr
(
V_BSTR
(
var
));
if
(
!
str
)
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
str
);
return
S_OK
;
}
case
VT_DISPATCH
:
{
IDispatch_AddRef
(
V_DISPATCH
(
var
));
*
r
=
jsval_disp
(
V_DISPATCH
(
var
));
return
S_OK
;
}
case
VT_I2
:
case
VT_INT
:
assert
(
0
);
default:
return
jsval_variant
(
r
,
var
);
}
}
HRESULT
jsval_to_variant
(
jsval_t
val
,
VARIANT
*
retv
)
{
switch
(
val
.
type
)
{
case
JSV_UNDEFINED
:
V_VT
(
retv
)
=
VT_EMPTY
;
return
S_OK
;
case
JSV_NULL
:
V_VT
(
retv
)
=
VT_NULL
;
return
S_OK
;
case
JSV_OBJECT
:
V_VT
(
retv
)
=
VT_DISPATCH
;
IDispatch_AddRef
(
val
.
u
.
obj
);
V_DISPATCH
(
retv
)
=
val
.
u
.
obj
;
return
S_OK
;
case
JSV_STRING
:
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
clone_bstr
(
val
.
u
.
str
);
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
S_OK
;
case
JSV_NUMBER
:
num_set_val
(
retv
,
val
.
u
.
n
);
return
S_OK
;
case
JSV_BOOL
:
V_VT
(
retv
)
=
VT_BOOL
;
V_BOOL
(
retv
)
=
val
.
u
.
b
?
VARIANT_TRUE
:
VARIANT_FALSE
;
return
S_OK
;
case
JSV_VARIANT
:
return
VariantCopy
(
retv
,
val
.
u
.
v
);
}
assert
(
0
);
return
E_FAIL
;
}
/* ECMA-262 3rd Edition 9.1 */
/* ECMA-262 3rd Edition 9.1 */
HRESULT
to_primitive
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
VARIANT
*
ret
,
hint_t
hint
)
HRESULT
to_primitive
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
VARIANT
*
ret
,
hint_t
hint
)
{
{
...
@@ -457,6 +569,26 @@ HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, double *ret)
...
@@ -457,6 +569,26 @@ HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, double *ret)
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 9.3 */
HRESULT
to_number_jsval
(
script_ctx_t
*
ctx
,
jsval_t
v
,
jsexcept_t
*
ei
,
double
*
ret
)
{
VARIANT
var
;
HRESULT
hres
;
if
(
v
.
type
==
JSV_NUMBER
)
{
*
ret
=
v
.
u
.
n
;
return
S_OK
;
}
hres
=
jsval_to_variant
(
v
,
&
var
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_number
(
ctx
,
&
var
,
ei
,
ret
);
VariantClear
(
&
var
);
return
hres
;
}
/* ECMA-262 3rd Edition 9.4 */
/* ECMA-262 3rd Edition 9.4 */
HRESULT
to_integer
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
double
*
ret
)
HRESULT
to_integer
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
double
*
ret
)
{
{
...
@@ -619,6 +751,26 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
...
@@ -619,6 +751,26 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
}
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string_jsval
(
script_ctx_t
*
ctx
,
jsval_t
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
VARIANT
var
;
HRESULT
hres
;
if
(
v
.
type
==
JSV_STRING
)
{
*
str
=
clone_bstr
(
v
.
u
.
str
);
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
}
hres
=
jsval_to_variant
(
v
,
&
var
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
&
var
,
ei
,
str
);
VariantClear
(
&
var
);
return
hres
;
}
/* ECMA-262 3rd Edition 9.9 */
/* ECMA-262 3rd Edition 9.9 */
HRESULT
to_object
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
IDispatch
**
disp
)
HRESULT
to_object
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
IDispatch
**
disp
)
{
{
...
...
dlls/jscript/jsval.h
0 → 100644
View file @
932b3dd0
/*
* Copyright 2012 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef JSVAL_H
#define JSVAL_H
typedef
enum
{
JSV_UNDEFINED
,
JSV_NULL
,
JSV_OBJECT
,
JSV_STRING
,
JSV_NUMBER
,
JSV_BOOL
,
JSV_VARIANT
}
jsval_type_t
;
struct
_jsval_t
{
jsval_type_t
type
;
union
{
IDispatch
*
obj
;
BSTR
str
;
double
n
;
BOOL
b
;
VARIANT
*
v
;
}
u
;
};
static
inline
jsval_t
jsval_bool
(
BOOL
b
)
{
jsval_t
ret
;
ret
.
type
=
JSV_BOOL
;
ret
.
u
.
b
=
b
;
return
ret
;
}
static
inline
jsval_t
jsval_string
(
BSTR
str
)
{
jsval_t
ret
;
ret
.
type
=
JSV_STRING
;
ret
.
u
.
str
=
str
;
return
ret
;
}
static
inline
jsval_t
jsval_disp
(
IDispatch
*
obj
)
{
jsval_t
ret
;
ret
.
type
=
JSV_OBJECT
;
ret
.
u
.
obj
=
obj
;
return
ret
;
}
static
inline
jsval_t
jsval_obj
(
jsdisp_t
*
obj
)
{
return
jsval_disp
(
to_disp
(
obj
));
}
static
inline
jsval_t
jsval_null
(
void
)
{
jsval_t
ret
=
{
JSV_NULL
};
return
ret
;
}
static
inline
jsval_t
jsval_undefined
(
void
)
{
jsval_t
ret
=
{
JSV_UNDEFINED
};
return
ret
;
}
static
inline
jsval_t
jsval_number
(
double
n
)
{
jsval_t
ret
;
ret
.
type
=
JSV_NUMBER
;
ret
.
u
.
n
=
n
;
return
ret
;
}
static
inline
BOOL
is_object_instance
(
jsval_t
v
)
{
return
v
.
type
==
JSV_OBJECT
;
}
static
inline
BOOL
is_undefined
(
jsval_t
v
)
{
return
v
.
type
==
JSV_UNDEFINED
;
}
static
inline
BOOL
is_null
(
jsval_t
v
)
{
return
v
.
type
==
JSV_NULL
;
}
static
inline
BOOL
is_null_instance
(
jsval_t
v
)
{
return
v
.
type
==
JSV_NULL
||
(
v
.
type
==
JSV_OBJECT
&&
!
v
.
u
.
obj
);
}
static
inline
BOOL
is_string
(
jsval_t
v
)
{
return
v
.
type
==
JSV_STRING
;
}
static
inline
BOOL
is_number
(
jsval_t
v
)
{
return
v
.
type
==
JSV_NUMBER
;
}
static
inline
BOOL
is_variant
(
jsval_t
v
)
{
return
v
.
type
==
JSV_VARIANT
;
}
static
inline
BOOL
is_bool
(
jsval_t
v
)
{
return
v
.
type
==
JSV_BOOL
;
}
static
inline
IDispatch
*
get_object
(
jsval_t
v
)
{
return
v
.
u
.
obj
;
}
static
inline
double
get_number
(
jsval_t
v
)
{
return
v
.
u
.
n
;
}
static
inline
BSTR
get_string
(
jsval_t
v
)
{
return
v
.
u
.
str
;
}
static
inline
VARIANT
*
get_variant
(
jsval_t
v
)
{
return
v
.
u
.
v
;
}
static
inline
BOOL
get_bool
(
jsval_t
v
)
{
return
v
.
u
.
b
;
}
HRESULT
variant_to_jsval
(
VARIANT
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsval_to_variant
(
jsval_t
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
void
jsval_release
(
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsval_variant
(
jsval_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsval_copy
(
jsval_t
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
#endif
dlls/jscript/math.c
View file @
932b3dd0
...
@@ -59,7 +59,7 @@ static const WCHAR tanW[] = {'t','a','n',0};
...
@@ -59,7 +59,7 @@ static const WCHAR tanW[] = {'t','a','n',0};
/* ECMA-262 3rd Edition 15.8.2.12 */
/* ECMA-262 3rd Edition 15.8.2.12 */
static
HRESULT
Math_abs
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_abs
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
d
;
double
d
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -67,8 +67,8 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -67,8 +67,8 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -76,13 +76,13 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -76,13 +76,13 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
d
<
0
.
0
?
-
d
:
d
);
*
r
=
jsval_number
(
d
<
0
.
0
?
-
d
:
d
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_acos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_acos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -90,7 +90,8 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -90,7 +90,8 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -98,13 +99,13 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -98,13 +99,13 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
x
<
-
1
.
0
||
x
>
1
.
0
?
NAN
:
acos
(
x
));
*
r
=
jsval_number
(
x
<
-
1
.
0
||
x
>
1
.
0
?
NAN
:
acos
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_asin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_asin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -112,7 +113,8 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -112,7 +113,8 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -120,13 +122,13 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -120,13 +122,13 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
x
<
-
1
.
0
||
x
>
1
.
0
?
NAN
:
asin
(
x
));
*
r
=
jsval_number
(
x
<
-
1
.
0
||
x
>
1
.
0
?
NAN
:
asin
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_atan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_atan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -134,7 +136,8 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -134,7 +136,8 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -142,12 +145,13 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -142,12 +145,13 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
atan
(
x
));
if
(
r
)
*
r
=
jsval_number
(
atan
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_atan2
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_atan2
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
,
y
;
double
x
,
y
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -155,7 +159,8 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -155,7 +159,8 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -167,13 +172,14 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -167,13 +172,14 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
atan2
(
y
,
x
));
if
(
r
)
*
r
=
jsval_number
(
atan2
(
y
,
x
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.6 */
/* ECMA-262 3rd Edition 15.8.2.6 */
static
HRESULT
Math_ceil
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_ceil
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -181,8 +187,8 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -181,8 +187,8 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -190,13 +196,13 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -190,13 +196,13 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
ceil
(
x
));
*
r
=
jsval_number
(
ceil
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_cos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_cos
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -204,7 +210,8 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -204,7 +210,8 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -212,12 +219,13 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -212,12 +219,13 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
cos
(
x
));
if
(
r
)
*
r
=
jsval_number
(
cos
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_exp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_exp
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -225,7 +233,8 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -225,7 +233,8 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -233,12 +242,13 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -233,12 +242,13 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
exp
(
x
));
if
(
r
)
*
r
=
jsval_number
(
exp
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_floor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_floor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -246,8 +256,8 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -246,8 +256,8 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -255,13 +265,13 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -255,13 +265,13 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
floor
(
x
));
*
r
=
jsval_number
(
floor
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_log
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_log
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -269,8 +279,8 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -269,8 +279,8 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -278,14 +288,14 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -278,14 +288,14 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
x
<
-
0
.
0
?
NAN
:
log
(
x
));
*
r
=
jsval_number
(
x
<
-
0
.
0
?
NAN
:
log
(
x
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.11 */
/* ECMA-262 3rd Edition 15.8.2.11 */
static
HRESULT
Math_max
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_max
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DOUBLE
max
,
d
;
DOUBLE
max
,
d
;
DWORD
i
;
DWORD
i
;
...
@@ -294,8 +304,8 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -294,8 +304,8 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
-
INFINITY
);
*
r
=
jsval_number
(
-
INFINITY
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -312,14 +322,14 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -312,14 +322,14 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
max
=
d
;
max
=
d
;
}
}
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
max
);
*
r
=
jsval_number
(
max
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.12 */
/* ECMA-262 3rd Edition 15.8.2.12 */
static
HRESULT
Math_min
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_min
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DOUBLE
min
,
d
;
DOUBLE
min
,
d
;
DWORD
i
;
DWORD
i
;
...
@@ -328,8 +338,8 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -328,8 +338,8 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
INFINITY
);
*
r
=
jsval_number
(
INFINITY
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -346,14 +356,14 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -346,14 +356,14 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
min
=
d
;
min
=
d
;
}
}
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
min
);
*
r
=
jsval_number
(
min
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.13 */
/* ECMA-262 3rd Edition 15.8.2.13 */
static
HRESULT
Math_pow
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_pow
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
,
y
;
double
x
,
y
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -361,7 +371,8 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -361,7 +371,8 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -373,31 +384,30 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -373,31 +384,30 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
pow
(
x
,
y
));
*
r
=
jsval_number
(
pow
(
x
,
y
));
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.14 */
/* ECMA-262 3rd Edition 15.8.2.14 */
static
HRESULT
Math_random
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_random
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
UINT
r
;
UINT
x
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
RtlGenRandom
(
&
r
,
sizeof
(
r
)))
if
(
!
RtlGenRandom
(
&
x
,
sizeof
(
x
)))
return
E_UNEXPECTED
;
return
E_UNEXPECTED
;
if
(
retv
)
if
(
r
)
num_set_val
(
retv
,
(
DOUBLE
)
r
/
(
DOUBLE
)
UINT_MAX
);
*
r
=
jsval_number
((
double
)
x
/
(
double
)
UINT_MAX
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.8.2.15 */
/* ECMA-262 3rd Edition 15.8.2.15 */
static
HRESULT
Math_round
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_round
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -405,8 +415,8 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -405,8 +415,8 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -414,13 +424,13 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
...
@@ -414,13 +424,13 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
floor
(
x
+
0
.
5
));
*
r
=
jsval_number
(
floor
(
x
+
0
.
5
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_sin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_sin
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -428,7 +438,8 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -428,7 +438,8 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -436,12 +447,13 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -436,12 +447,13 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
sin
(
x
));
if
(
r
)
*
r
=
jsval_number
(
sin
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_sqrt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_sqrt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -449,7 +461,8 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -449,7 +461,8 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -457,12 +470,13 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
...
@@ -457,12 +470,13 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
sqrt
(
x
));
if
(
r
)
*
r
=
jsval_number
(
sqrt
(
x
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Math_tan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Math_tan
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
x
;
double
x
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -470,7 +484,8 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -470,7 +484,8 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
num_set_val
(
retv
,
NAN
);
if
(
r
)
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -478,7 +493,8 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
...
@@ -478,7 +493,8 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
num_set_val
(
retv
,
tan
(
x
));
if
(
r
)
*
r
=
jsval_number
(
tan
(
x
));
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/jscript/number.c
View file @
932b3dd0
...
@@ -219,7 +219,7 @@ static inline void number_to_exponential(double val, int prec, BSTR *out)
...
@@ -219,7 +219,7 @@ static inline void number_to_exponential(double val, int prec, BSTR *out)
/* ECMA-262 3rd Edition 15.7.4.2 */
/* ECMA-262 3rd Edition 15.7.4.2 */
static
HRESULT
Number_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
;
NumberInstance
*
number
;
INT
radix
=
10
;
INT
radix
=
10
;
...
@@ -334,24 +334,22 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -334,24 +334,22 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
else
}
else
{
SysFreeString
(
str
);
SysFreeString
(
str
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Number_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
Number_toFixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_toFixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
;
NumberInstance
*
number
;
DOUBLE
val
;
DOUBLE
val
;
...
@@ -385,17 +383,15 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -385,17 +383,15 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
number_to_fixed
(
val
,
prec
,
&
str
);
number_to_fixed
(
val
,
prec
,
&
str
);
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
else
}
else
{
SysFreeString
(
str
);
SysFreeString
(
str
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Number_toExponential
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_toExponential
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
;
NumberInstance
*
number
;
DOUBLE
val
;
DOUBLE
val
;
...
@@ -431,17 +427,15 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -431,17 +427,15 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
number_to_exponential
(
val
,
prec
,
&
str
);
number_to_exponential
(
val
,
prec
,
&
str
);
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
else
}
else
{
SysFreeString
(
str
);
SysFreeString
(
str
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Number_toPrecision
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_toPrecision
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
;
NumberInstance
*
number
;
INT
prec
=
0
,
size
;
INT
prec
=
0
,
size
;
...
@@ -481,17 +475,15 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -481,17 +475,15 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
number_to_fixed
(
val
,
prec
-
size
,
&
str
);
number_to_fixed
(
val
,
prec
-
size
,
&
str
);
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
else
}
else
{
SysFreeString
(
str
);
SysFreeString
(
str
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Number_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
;
NumberInstance
*
number
;
...
@@ -500,13 +492,13 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -500,13 +492,13 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
!
(
number
=
number_this
(
jsthis
)))
if
(
!
(
number
=
number_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_NUMBER_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
number
->
value
);
*
r
=
jsval_number
(
number
->
value
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Number_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Number_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
NumberInstance
*
number
=
number_from_vdisp
(
jsthis
);
NumberInstance
*
number
=
number_from_vdisp
(
jsthis
);
...
@@ -514,7 +506,7 @@ static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -514,7 +506,7 @@ static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
case
INVOKE_FUNC
:
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
DISPATCH_PROPERTYGET
:
case
DISPATCH_PROPERTYGET
:
num_set_val
(
retv
,
number
->
value
);
*
r
=
jsval_number
(
number
->
value
);
break
;
break
;
default:
default:
...
@@ -552,7 +544,7 @@ static const builtin_info_t NumberInst_info = {
...
@@ -552,7 +544,7 @@ static const builtin_info_t NumberInst_info = {
};
};
static
HRESULT
NumberConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
NumberConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
double
n
;
double
n
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -562,8 +554,8 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -562,8 +554,8 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
switch
(
flags
)
{
switch
(
flags
)
{
case
INVOKE_FUNC
:
case
INVOKE_FUNC
:
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
0
);
*
r
=
jsval_number
(
0
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -571,8 +563,8 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -571,8 +563,8 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
n
);
*
r
=
jsval_number
(
n
);
break
;
break
;
case
DISPATCH_CONSTRUCT
:
{
case
DISPATCH_CONSTRUCT
:
{
...
@@ -590,7 +582,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -590,7 +582,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
var_set_jsdisp
(
retv
,
obj
);
*
r
=
jsval_obj
(
obj
);
break
;
break
;
}
}
default:
default:
...
...
dlls/jscript/object.c
View file @
932b3dd0
...
@@ -33,7 +33,7 @@ static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','
...
@@ -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
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
,
VARIANT
*
argv
,
static
HRESULT
Object_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
jsdisp
;
jsdisp_t
*
jsdisp
;
const
WCHAR
*
str
;
const
WCHAR
*
str
;
...
@@ -66,20 +66,20 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -66,20 +66,20 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocStringLen
(
NULL
,
9
+
strlenW
(
str
));
V_BSTR
(
retv
)
=
SysAllocStringLen
(
NULL
,
9
+
strlenW
(
str
));
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
sprintfW
(
V_BSTR
(
retv
),
formatW
,
str
);
sprintfW
(
ret
,
formatW
,
str
);
*
r
=
jsval_string
(
ret
);
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Object_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_toLocaleString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -88,26 +88,23 @@ static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
...
@@ -88,26 +88,23 @@ static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
return
E_FAIL
;
return
E_FAIL
;
}
}
return
jsdisp_call_name
(
jsthis
->
u
.
jsdisp
,
toStringW
,
DISPATCH_METHOD
,
0
,
NULL
,
r
etv
,
ei
);
return
jsdisp_call_name
(
jsthis
->
u
.
jsdisp
,
toStringW
,
DISPATCH_METHOD
,
0
,
NULL
,
r
,
ei
);
}
}
static
HRESULT
Object_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
r
etv
)
{
if
(
r
)
{
IDispatch_AddRef
(
jsthis
->
u
.
disp
);
IDispatch_AddRef
(
jsthis
->
u
.
disp
);
*
r
=
jsval_disp
(
jsthis
->
u
.
disp
);
V_VT
(
retv
)
=
VT_DISPATCH
;
V_DISPATCH
(
retv
)
=
jsthis
->
u
.
disp
;
}
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Object_hasOwnProperty
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_hasOwnProperty
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
name
;
BSTR
name
;
DISPID
id
;
DISPID
id
;
...
@@ -116,11 +113,8 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
...
@@ -116,11 +113,8 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
FALSE
);
V_BOOL
(
retv
)
=
VARIANT_FALSE
;
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -135,11 +129,8 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
...
@@ -135,11 +129,8 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
result
);
V_BOOL
(
retv
)
=
result
;
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -151,41 +142,40 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
...
@@ -151,41 +142,40 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
&
name
,
1
,
ctx
->
lcid
,
&
id
);
&
name
,
1
,
ctx
->
lcid
,
&
id
);
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
SUCCEEDED
(
hres
));
V_BOOL
(
retv
)
=
SUCCEEDED
(
hres
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
Object_propertyIsEnumerable
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_propertyIsEnumerable
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
Object_isPrototypeOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_isPrototypeOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
Object_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
Object_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
switch
(
flags
)
{
switch
(
flags
)
{
case
INVOKE_FUNC
:
case
INVOKE_FUNC
:
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
case
DISPATCH_PROPERTYGET
:
case
DISPATCH_PROPERTYGET
:
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocString
(
default_valueW
);
V_BSTR
(
retv
)
=
SysAllocString
(
default_valueW
);
if
(
!
ret
)
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
break
;
break
;
}
default:
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -226,7 +216,7 @@ static const builtin_info_t ObjectInst_info = {
...
@@ -226,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
,
VARIANT
*
argv
,
static
HRESULT
ObjectConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -242,12 +232,10 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -242,12 +232,10 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
jsval_disp
(
disp
);
V_DISPATCH
(
retv
)
=
disp
;
else
}
else
{
IDispatch_Release
(
disp
);
IDispatch_Release
(
disp
);
}
return
S_OK
;
return
S_OK
;
}
}
}
}
...
@@ -259,8 +247,8 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -259,8 +247,8 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
obj
);
*
r
=
jsval_obj
(
obj
);
else
else
jsdisp_release
(
obj
);
jsdisp_release
(
obj
);
break
;
break
;
...
...
dlls/jscript/regexp.c
View file @
932b3dd0
...
@@ -3474,18 +3474,17 @@ HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, const WCHAR *str, DWOR
...
@@ -3474,18 +3474,17 @@ 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
,
VARIANT
*
argv
,
static
HRESULT
RegExp_source
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
switch
(
flags
)
{
switch
(
flags
)
{
case
DISPATCH_PROPERTYGET
:
{
case
DISPATCH_PROPERTYGET
:
{
RegExpInstance
*
This
=
regexp_from_vdisp
(
jsthis
);
RegExpInstance
*
This
=
regexp_from_vdisp
(
jsthis
);
BSTR
ret
=
SysAllocString
(
This
->
str
);
V_VT
(
retv
)
=
VT_BSTR
;
if
(
!
ret
)
V_BSTR
(
retv
)
=
SysAllocString
(
This
->
str
);
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
break
;
break
;
}
}
default:
default:
...
@@ -3497,21 +3496,21 @@ static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -3497,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
,
VARIANT
*
argv
,
static
HRESULT
RegExp_global
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
RegExp_ignoreCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
RegExp_ignoreCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
RegExp_multiline
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
RegExp_multiline
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -3535,7 +3534,7 @@ static INT index_from_var(script_ctx_t *ctx, VARIANT *v)
...
@@ -3535,7 +3534,7 @@ static INT index_from_var(script_ctx_t *ctx, VARIANT *v)
}
}
static
HRESULT
RegExp_lastIndex
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
RegExp_lastIndex
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -3543,8 +3542,7 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -3543,8 +3542,7 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
case
DISPATCH_PROPERTYGET
:
{
case
DISPATCH_PROPERTYGET
:
{
RegExpInstance
*
regexp
=
regexp_from_vdisp
(
jsthis
);
RegExpInstance
*
regexp
=
regexp_from_vdisp
(
jsthis
);
V_VT
(
retv
)
=
VT_EMPTY
;
return
variant_to_jsval
(
&
regexp
->
last_index_var
,
r
);
return
VariantCopy
(
retv
,
&
regexp
->
last_index_var
);
}
}
case
DISPATCH_PROPERTYPUT
:
{
case
DISPATCH_PROPERTYPUT
:
{
RegExpInstance
*
regexp
=
regexp_from_vdisp
(
jsthis
);
RegExpInstance
*
regexp
=
regexp_from_vdisp
(
jsthis
);
...
@@ -3566,7 +3564,7 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -3566,7 +3564,7 @@ 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
,
VARIANT
*
argv
,
static
HRESULT
RegExp_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -3697,7 +3695,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce
...
@@ -3697,7 +3695,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce
}
}
static
HRESULT
RegExp_exec
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
RegExp_exec
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
match_result_t
*
parens
=
NULL
,
match
;
match_result_t
*
parens
=
NULL
,
match
;
DWORD
parens_cnt
=
0
;
DWORD
parens_cnt
=
0
;
...
@@ -3711,17 +3709,15 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
...
@@ -3711,17 +3709,15 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
{
if
(
r
)
{
if
(
b
)
{
if
(
b
)
{
IDispatch
*
ret
;
IDispatch
*
ret
;
hres
=
create_match_array
(
ctx
,
string
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
hres
=
create_match_array
(
ctx
,
string
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
jsval_disp
(
ret
);
V_DISPATCH
(
retv
)
=
ret
;
}
}
else
{
}
else
{
V_VT
(
retv
)
=
VT_NULL
;
*
r
=
jsval_null
()
;
}
}
}
}
...
@@ -3731,7 +3727,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
...
@@ -3731,7 +3727,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
,
VARIANT
*
argv
,
static
HRESULT
RegExp_test
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
match_result_t
match
;
match_result_t
match
;
VARIANT
undef_var
;
VARIANT
undef_var
;
...
@@ -3753,15 +3749,13 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
...
@@ -3753,15 +3749,13 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BOOL
;
*
r
=
jsval_bool
(
b
);
V_BOOL
(
retv
)
=
b
;
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
RegExp_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
RegExp_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -3927,7 +3921,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, VARIANT *src_arg, VARIANT *flags_ar
...
@@ -3927,7 +3921,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, VARIANT *src_arg, VARIANT *flags_ar
}
}
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
BSTR
str
,
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
BSTR
str
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
indexW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
indexW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
inputW
[]
=
{
'i'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
WCHAR
inputW
[]
=
{
'i'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
...
@@ -3951,17 +3945,15 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
...
@@ -3951,17 +3945,15 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
{
if
(
r
)
{
if
(
hres
==
S_OK
)
{
if
(
hres
==
S_OK
)
{
IDispatch
*
ret
;
IDispatch
*
ret
;
hres
=
create_match_array
(
ctx
,
str
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
hres
=
create_match_array
(
ctx
,
str
,
&
match
,
parens
,
parens_cnt
,
ei
,
&
ret
);
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
V_VT
(
retv
)
=
VT_DISPATCH
;
*
r
=
jsval_disp
(
ret
);
V_DISPATCH
(
retv
)
=
ret
;
}
}
else
{
}
else
{
V_VT
(
retv
)
=
VT_NULL
;
*
r
=
jsval_null
()
;
}
}
}
}
...
@@ -3976,8 +3968,8 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
...
@@ -3976,8 +3968,8 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
if
(
!
match_cnt
)
{
if
(
!
match_cnt
)
{
TRACE
(
"no match
\n
"
);
TRACE
(
"no match
\n
"
);
if
(
r
etv
)
if
(
r
)
V_VT
(
retv
)
=
VT_NULL
;
*
r
=
jsval_null
()
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -4019,15 +4011,15 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
...
@@ -4019,15 +4011,15 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
heap_free
(
match_result
);
heap_free
(
match_result
);
if
(
SUCCEEDED
(
hres
)
&&
r
etv
)
if
(
SUCCEEDED
(
hres
)
&&
r
)
var_set_jsdisp
(
retv
,
array
);
*
r
=
jsval_obj
(
array
);
else
else
jsdisp_release
(
array
);
jsdisp_release
(
array
);
return
hres
;
return
hres
;
}
}
static
HRESULT
RegExpConstr_leftContext
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
RegExpConstr_leftContext
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -4039,8 +4031,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -4039,8 +4031,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
break
;
break
;
}
}
case
DISPATCH_PROPERTYPUT
:
case
DISPATCH_PROPERTYPUT
:
...
@@ -4054,7 +4045,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD
...
@@ -4054,7 +4045,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
,
static
HRESULT
RegExpConstr_rightContext
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -4066,8 +4057,7 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR
...
@@ -4066,8 +4057,7 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
break
;
break
;
}
}
case
DISPATCH_PROPERTYPUT
:
case
DISPATCH_PROPERTYPUT
:
...
@@ -4081,7 +4071,7 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR
...
@@ -4081,7 +4071,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
,
VARIANT
*
argv
,
static
HRESULT
RegExpConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -4097,8 +4087,8 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -4097,8 +4087,8 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
throw_regexp_error
(
ctx
,
ei
,
JS_E_REGEXP_SYNTAX
,
NULL
);
return
throw_regexp_error
(
ctx
,
ei
,
JS_E_REGEXP_SYNTAX
,
NULL
);
}
}
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
jsdisp
);
*
r
=
jsval_obj
(
jsdisp
);
else
else
jsdisp_release
(
jsdisp
);
jsdisp_release
(
jsdisp
);
return
S_OK
;
return
S_OK
;
...
@@ -4121,8 +4111,8 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -4121,8 +4111,8 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
ret
);
*
r
=
jsval_obj
(
ret
);
else
else
jsdisp_release
(
ret
);
jsdisp_release
(
ret
);
return
S_OK
;
return
S_OK
;
...
...
dlls/jscript/string.c
View file @
932b3dd0
...
@@ -103,7 +103,7 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei
...
@@ -103,7 +103,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
,
VARIANT
*
argv
,
static
HRESULT
String_length
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"%p
\n
"
,
jsthis
);
TRACE
(
"%p
\n
"
,
jsthis
);
...
@@ -111,7 +111,7 @@ static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -111,7 +111,7 @@ static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
case
DISPATCH_PROPERTYGET
:
{
case
DISPATCH_PROPERTYGET
:
{
StringInstance
*
string
=
string_from_vdisp
(
jsthis
);
StringInstance
*
string
=
string_from_vdisp
(
jsthis
);
num_set_int
(
retv
,
string
->
length
);
*
r
=
jsval_number
(
string
->
length
);
break
;
break
;
}
}
default:
default:
...
@@ -122,7 +122,7 @@ static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -122,7 +122,7 @@ static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
stringobj_to_string
(
vdisp_t
*
jsthis
,
VARIANT
*
retv
)
static
HRESULT
stringobj_to_string
(
vdisp_t
*
jsthis
,
jsval_t
*
r
)
{
{
StringInstance
*
string
;
StringInstance
*
string
;
...
@@ -131,36 +131,35 @@ static HRESULT stringobj_to_string(vdisp_t *jsthis, VARIANT *retv)
...
@@ -131,36 +131,35 @@ static HRESULT stringobj_to_string(vdisp_t *jsthis, VARIANT *retv)
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
r
etv
)
{
if
(
r
)
{
BSTR
str
=
SysAllocString
(
string
->
str
);
BSTR
str
=
SysAllocString
(
string
->
str
);
if
(
!
str
)
if
(
!
str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.5.4.2 */
/* ECMA-262 3rd Edition 15.5.4.2 */
static
HRESULT
String_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
stringobj_to_string
(
jsthis
,
r
etv
);
return
stringobj_to_string
(
jsthis
,
r
);
}
}
/* ECMA-262 3rd Edition 15.5.4.2 */
/* ECMA-262 3rd Edition 15.5.4.2 */
static
HRESULT
String_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
return
stringobj_to_string
(
jsthis
,
r
etv
);
return
stringobj_to_string
(
jsthis
,
r
);
}
}
static
HRESULT
do_attributeless_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
VARIANT
*
retv
,
static
HRESULT
do_attributeless_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
)
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
...
@@ -174,7 +173,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, V
...
@@ -174,7 +173,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, V
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
{
if
(
r
)
{
BSTR
ret
=
SysAllocStringLen
(
NULL
,
length
+
2
*
strlenW
(
tagname
)
+
5
);
BSTR
ret
=
SysAllocStringLen
(
NULL
,
length
+
2
*
strlenW
(
tagname
)
+
5
);
if
(
!
ret
)
{
if
(
!
ret
)
{
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
...
@@ -182,16 +181,14 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, V
...
@@ -182,16 +181,14 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, V
}
}
sprintfW
(
ret
,
tagfmt
,
tagname
,
str
,
tagname
);
sprintfW
(
ret
,
tagfmt
,
tagname
,
str
,
tagname
);
*
r
=
jsval_string
(
ret
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret
;
}
}
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
do_attribute_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
static
HRESULT
do_attribute_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
)
jsexcept_t
*
ei
,
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
)
{
{
static
const
WCHAR
tagfmtW
[]
static
const
WCHAR
tagfmtW
[]
...
@@ -237,7 +234,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
...
@@ -237,7 +234,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
}
}
}
if
(
r
etv
)
{
if
(
r
)
{
BSTR
ret
=
SysAllocStringLen
(
NULL
,
length
+
2
*
strlenW
(
tagname
)
BSTR
ret
=
SysAllocStringLen
(
NULL
,
length
+
2
*
strlenW
(
tagname
)
+
strlenW
(
attr
)
+
SysStringLen
(
attr_value
)
+
9
);
+
strlenW
(
attr
)
+
SysStringLen
(
attr_value
)
+
9
);
if
(
!
ret
)
{
if
(
!
ret
)
{
...
@@ -247,9 +244,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
...
@@ -247,9 +244,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
}
sprintfW
(
ret
,
tagfmtW
,
tagname
,
attr
,
attr_value
,
str
,
tagname
);
sprintfW
(
ret
,
tagfmtW
,
tagname
,
attr
,
attr_value
,
str
,
tagname
);
*
r
=
jsval_string
(
ret
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret
;
}
}
SysFreeString
(
attr_value
);
SysFreeString
(
attr_value
);
...
@@ -258,38 +253,38 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
...
@@ -258,38 +253,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
,
VARIANT
*
argv
,
static
HRESULT
String_anchor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'N'
,
'A'
,
'M'
,
'E'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'N'
,
'A'
,
'M'
,
'E'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
etv
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
}
}
static
HRESULT
String_big
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_big
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
bigtagW
[]
=
{
'B'
,
'I'
,
'G'
,
0
};
static
const
WCHAR
bigtagW
[]
=
{
'B'
,
'I'
,
'G'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
bigtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
bigtagW
);
}
}
static
HRESULT
String_blink
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_blink
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
blinktagW
[]
=
{
'B'
,
'L'
,
'I'
,
'N'
,
'K'
,
0
};
static
const
WCHAR
blinktagW
[]
=
{
'B'
,
'L'
,
'I'
,
'N'
,
'K'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
blinktagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
blinktagW
);
}
}
static
HRESULT
String_bold
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_bold
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
boldtagW
[]
=
{
'B'
,
0
};
static
const
WCHAR
boldtagW
[]
=
{
'B'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
boldtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
boldtagW
);
}
}
/* ECMA-262 3rd Edition 15.5.4.5 */
/* ECMA-262 3rd Edition 15.5.4.5 */
static
HRESULT
String_charAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_charAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
DWORD
length
;
DWORD
length
;
...
@@ -314,7 +309,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -314,7 +309,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
pos
=
is_int32
(
d
)
?
d
:
-
1
;
pos
=
is_int32
(
d
)
?
d
:
-
1
;
}
}
if
(
!
r
etv
)
{
if
(
!
r
)
{
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -328,14 +323,13 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -328,14 +323,13 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.5.4.5 */
/* ECMA-262 3rd Edition 15.5.4.5 */
static
HRESULT
String_charCodeAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_charCodeAt
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
BSTR
val_str
;
BSTR
val_str
;
...
@@ -359,16 +353,16 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -359,16 +353,16 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
!
is_int32
(
d
)
||
d
<
0
||
d
>=
length
)
{
if
(
!
is_int32
(
d
)
||
d
<
0
||
d
>=
length
)
{
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
if
(
r
etv
)
if
(
r
)
num_set_val
(
retv
,
NAN
);
*
r
=
jsval_number
(
NAN
);
return
S_OK
;
return
S_OK
;
}
}
idx
=
d
;
idx
=
d
;
}
}
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
str
[
idx
]);
*
r
=
jsval_number
(
str
[
idx
]);
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
...
@@ -376,7 +370,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -376,7 +370,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.5.4.6 */
/* ECMA-262 3rd Edition 15.5.4.6 */
static
HRESULT
String_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_concat
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
*
strs
=
NULL
,
ret
=
NULL
;
BSTR
*
strs
=
NULL
,
ret
=
NULL
;
DWORD
len
=
0
,
i
,
l
,
str_cnt
;
DWORD
len
=
0
,
i
,
l
,
str_cnt
;
...
@@ -423,42 +417,40 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -423,42 +417,40 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
else
{
SysFreeString
(
ret
);
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
String_fixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_fixed
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
fixedtagW
[]
=
{
'T'
,
'T'
,
0
};
static
const
WCHAR
fixedtagW
[]
=
{
'T'
,
'T'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
fixedtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
fixedtagW
);
}
}
static
HRESULT
String_fontcolor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_fontcolor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'C'
,
'O'
,
'L'
,
'O'
,
'R'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'C'
,
'O'
,
'L'
,
'O'
,
'R'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
etv
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
}
}
static
HRESULT
String_fontsize
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_fontsize
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
fontW
[]
=
{
'F'
,
'O'
,
'N'
,
'T'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'S'
,
'I'
,
'Z'
,
'E'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'S'
,
'I'
,
'Z'
,
'E'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
etv
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
}
}
static
HRESULT
String_indexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_indexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DWORD
length
,
pos
=
0
;
DWORD
length
,
pos
=
0
;
const
WCHAR
*
str
;
const
WCHAR
*
str
;
...
@@ -473,8 +465,8 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -473,8 +465,8 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return
hres
;
return
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
-
1
);
*
r
=
jsval_number
(
-
1
);
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -508,21 +500,21 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -508,21 +500,21 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
ret
);
*
r
=
jsval_number
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
String_italics
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_italics
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
italicstagW
[]
=
{
'I'
,
0
};
static
const
WCHAR
italicstagW
[]
=
{
'I'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
italicstagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
italicstagW
);
}
}
/* ECMA-262 3rd Edition 15.5.4.8 */
/* ECMA-262 3rd Edition 15.5.4.8 */
static
HRESULT
String_lastIndexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_lastIndexOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
search_str
,
val_str
;
BSTR
search_str
,
val_str
;
DWORD
length
,
pos
=
0
,
search_len
;
DWORD
length
,
pos
=
0
,
search_len
;
...
@@ -537,8 +529,8 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -537,8 +529,8 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
hres
;
return
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
-
1
);
*
r
=
jsval_number
(
-
1
);
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -577,23 +569,23 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -577,23 +569,23 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
ret
);
*
r
=
jsval_number
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
String_link
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_link
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
fontW
[]
=
{
'A'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'H'
,
'R'
,
'E'
,
'F'
,
0
};
static
const
WCHAR
colorW
[]
=
{
'H'
,
'R'
,
'E'
,
'F'
,
0
};
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
etv
,
ei
,
fontW
,
colorW
);
return
do_attribute_tag_format
(
ctx
,
jsthis
,
argc
,
argv
,
r
,
ei
,
fontW
,
colorW
);
}
}
/* ECMA-262 3rd Edition 15.5.4.10 */
/* ECMA-262 3rd Edition 15.5.4.10 */
static
HRESULT
String_match
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_match
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
jsdisp_t
*
regexp
;
jsdisp_t
*
regexp
;
...
@@ -604,10 +596,8 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -604,10 +596,8 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_NULL
;
*
r
=
jsval_null
();
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -638,7 +628,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -638,7 +628,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
val_str
)
if
(
!
val_str
)
val_str
=
SysAllocStringLen
(
str
,
length
);
val_str
=
SysAllocStringLen
(
str
,
length
);
if
(
val_str
)
if
(
val_str
)
hres
=
regexp_string_match
(
ctx
,
regexp
,
val_str
,
r
etv
,
ei
);
hres
=
regexp_string_match
(
ctx
,
regexp
,
val_str
,
r
,
ei
);
else
else
hres
=
E_OUTOFMEMORY
;
hres
=
E_OUTOFMEMORY
;
}
}
...
@@ -687,7 +677,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
...
@@ -687,7 +677,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
{
{
VARIANT
*
argv
;
VARIANT
*
argv
;
unsigned
argc
;
unsigned
argc
;
VARIANT
var
;
jsval_t
val
;
DWORD
i
;
DWORD
i
;
HRESULT
hres
=
S_OK
;
HRESULT
hres
=
S_OK
;
...
@@ -722,7 +712,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
...
@@ -722,7 +712,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
}
}
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_call_value
(
func
,
NULL
,
DISPATCH_METHOD
,
argc
,
argv
,
&
va
r
,
ei
);
hres
=
jsdisp_call_value
(
func
,
NULL
,
DISPATCH_METHOD
,
argc
,
argv
,
&
va
l
,
ei
);
for
(
i
=
0
;
i
<
parens_cnt
+
3
;
i
++
)
{
for
(
i
=
0
;
i
<
parens_cnt
+
3
;
i
++
)
{
if
(
i
!=
parens_cnt
+
1
)
if
(
i
!=
parens_cnt
+
1
)
...
@@ -733,14 +723,14 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
...
@@ -733,14 +723,14 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
to_string
(
ctx
,
&
var
,
ei
,
ret
);
hres
=
to_string
_jsval
(
ctx
,
val
,
ei
,
ret
);
VariantClear
(
&
var
);
jsval_release
(
val
);
return
hres
;
return
hres
;
}
}
/* ECMA-262 3rd Edition 15.5.4.11 */
/* ECMA-262 3rd Edition 15.5.4.11 */
static
HRESULT
String_replace
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_replace
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
DWORD
parens_cnt
=
0
,
parens_size
=
0
,
rep_len
=
0
,
length
;
DWORD
parens_cnt
=
0
,
parens_size
=
0
,
rep_len
=
0
,
length
;
...
@@ -758,15 +748,14 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -758,15 +748,14 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return
hres
;
return
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
{
if
(
r
)
{
if
(
!
val_str
)
{
if
(
!
val_str
)
{
val_str
=
SysAllocStringLen
(
str
,
length
);
val_str
=
SysAllocStringLen
(
str
,
length
);
if
(
!
val_str
)
if
(
!
val_str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
val_str
);
V_BSTR
(
retv
)
=
val_str
;
}
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -961,14 +950,13 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -961,14 +950,13 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
jsdisp_release
(
regexp
);
jsdisp_release
(
regexp
);
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
if
(
SUCCEEDED
(
hres
)
&&
r
etv
)
{
if
(
SUCCEEDED
(
hres
)
&&
r
)
{
ret_str
=
SysAllocStringLen
(
ret
.
buf
,
ret
.
len
);
ret_str
=
SysAllocStringLen
(
ret
.
buf
,
ret
.
len
);
if
(
!
ret_str
)
if
(
!
ret_str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret_str
;
TRACE
(
"= %s
\n
"
,
debugstr_w
(
ret_str
));
TRACE
(
"= %s
\n
"
,
debugstr_w
(
ret_str
));
*
r
=
jsval_string
(
ret_str
);
}
}
heap_free
(
ret
.
buf
);
heap_free
(
ret
.
buf
);
...
@@ -976,7 +964,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -976,7 +964,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
,
VARIANT
*
argv
,
static
HRESULT
String_search
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
jsdisp_t
*
regexp
=
NULL
;
jsdisp_t
*
regexp
=
NULL
;
const
WCHAR
*
str
,
*
cp
;
const
WCHAR
*
str
,
*
cp
;
...
@@ -992,8 +980,8 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -992,8 +980,8 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
hres
;
return
hres
;
if
(
!
argc
)
{
if
(
!
argc
)
{
if
(
r
etv
)
if
(
r
)
V_VT
(
retv
)
=
VT_NULL
;
*
r
=
jsval_null
()
;
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1023,14 +1011,14 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1023,14 +1011,14 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
hres
==
S_OK
?
match
.
str
-
str
:
-
1
);
*
r
=
jsval_number
(
hres
==
S_OK
?
match
.
str
-
str
:
-
1
);
return
S_OK
;
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.5.4.13 */
/* ECMA-262 3rd Edition 15.5.4.13 */
static
HRESULT
String_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_slice
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
BSTR
val_str
;
BSTR
val_str
;
...
@@ -1092,15 +1080,14 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1092,15 +1080,14 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
end
<
start
)
if
(
end
<
start
)
end
=
start
;
end
=
start
;
if
(
r
etv
)
{
if
(
r
)
{
BSTR
retstr
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
BSTR
retstr
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
if
(
!
retstr
)
{
if
(
!
retstr
)
{
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
retstr
);
V_BSTR
(
retv
)
=
retstr
;
}
}
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
...
@@ -1108,14 +1095,14 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1108,14 +1095,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
,
VARIANT
*
argv
,
static
HRESULT
String_small
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
smalltagW
[]
=
{
'S'
,
'M'
,
'A'
,
'L'
,
'L'
,
0
};
static
const
WCHAR
smalltagW
[]
=
{
'S'
,
'M'
,
'A'
,
'L'
,
'L'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
smalltagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
smalltagW
);
}
}
static
HRESULT
String_split
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_split
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
match_result_t
*
match_result
=
NULL
;
match_result_t
*
match_result
=
NULL
;
DWORD
length
,
match_cnt
,
i
,
match_len
=
0
;
DWORD
length
,
match_cnt
,
i
,
match_len
=
0
;
...
@@ -1230,8 +1217,8 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1230,8 +1217,8 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
heap_free
(
match_result
);
heap_free
(
match_result
);
if
(
SUCCEEDED
(
hres
)
&&
r
etv
)
if
(
SUCCEEDED
(
hres
)
&&
r
)
var_set_jsdisp
(
retv
,
array
);
*
r
=
jsval_obj
(
array
);
else
else
jsdisp_release
(
array
);
jsdisp_release
(
array
);
...
@@ -1239,22 +1226,22 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1239,22 +1226,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
,
VARIANT
*
argv
,
static
HRESULT
String_strike
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
striketagW
[]
=
{
'S'
,
'T'
,
'R'
,
'I'
,
'K'
,
'E'
,
0
};
static
const
WCHAR
striketagW
[]
=
{
'S'
,
'T'
,
'R'
,
'I'
,
'K'
,
'E'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
striketagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
striketagW
);
}
}
static
HRESULT
String_sub
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_sub
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
subtagW
[]
=
{
'S'
,
'U'
,
'B'
,
0
};
static
const
WCHAR
subtagW
[]
=
{
'S'
,
'U'
,
'B'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
subtagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
subtagW
);
}
}
/* ECMA-262 3rd Edition 15.5.4.15 */
/* ECMA-262 3rd Edition 15.5.4.15 */
static
HRESULT
String_substring
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_substring
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
BSTR
val_str
;
BSTR
val_str
;
...
@@ -1301,13 +1288,13 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1301,13 +1288,13 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
end
=
tmp
;
end
=
tmp
;
}
}
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
V_BSTR
(
retv
)
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
if
(
!
ret
)
{
if
(
!
V_BSTR
(
retv
))
{
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
*
r
=
jsval_string
(
ret
);
}
}
SysFreeString
(
val_str
);
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
...
@@ -1315,7 +1302,7 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -1315,7 +1302,7 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition B.2.3 */
/* ECMA-262 3rd Edition B.2.3 */
static
HRESULT
String_substr
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_substr
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
BSTR
val_str
;
BSTR
val_str
;
const
WCHAR
*
str
;
const
WCHAR
*
str
;
...
@@ -1357,10 +1344,11 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1357,10 +1344,11 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
}
hres
=
S_OK
;
hres
=
S_OK
;
if
(
retv
)
{
if
(
r
)
{
V_VT
(
retv
)
=
VT_BSTR
;
BSTR
ret
=
SysAllocStringLen
(
str
+
start
,
len
);
V_BSTR
(
retv
)
=
SysAllocStringLen
(
str
+
start
,
len
);
if
(
ret
)
if
(
!
V_BSTR
(
retv
))
*
r
=
jsval_string
(
ret
);
else
hres
=
E_OUTOFMEMORY
;
hres
=
E_OUTOFMEMORY
;
}
}
...
@@ -1369,14 +1357,14 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
...
@@ -1369,14 +1357,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
,
VARIANT
*
argv
,
static
HRESULT
String_sup
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
static
const
WCHAR
suptagW
[]
=
{
'S'
,
'U'
,
'P'
,
0
};
static
const
WCHAR
suptagW
[]
=
{
'S'
,
'U'
,
'P'
,
0
};
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
etv
,
ei
,
suptagW
);
return
do_attributeless_tag_format
(
ctx
,
jsthis
,
r
,
ei
,
suptagW
);
}
}
static
HRESULT
String_toLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_toLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
DWORD
length
;
DWORD
length
;
...
@@ -1389,7 +1377,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1389,7 +1377,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
{
if
(
r
)
{
if
(
!
val_str
)
{
if
(
!
val_str
)
{
val_str
=
SysAllocStringLen
(
str
,
length
);
val_str
=
SysAllocStringLen
(
str
,
length
);
if
(
!
val_str
)
if
(
!
val_str
)
...
@@ -1397,16 +1385,14 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1397,16 +1385,14 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
}
strlwrW
(
val_str
);
strlwrW
(
val_str
);
*
r
=
jsval_string
(
val_str
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
val_str
;
}
}
else
SysFreeString
(
val_str
);
else
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
String_toUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_toUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
DWORD
length
;
DWORD
length
;
...
@@ -1419,7 +1405,7 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1419,7 +1405,7 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
{
if
(
r
)
{
if
(
!
val_str
)
{
if
(
!
val_str
)
{
val_str
=
SysAllocStringLen
(
str
,
length
);
val_str
=
SysAllocStringLen
(
str
,
length
);
if
(
!
val_str
)
if
(
!
val_str
)
...
@@ -1427,37 +1413,35 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1427,37 +1413,35 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
}
struprW
(
val_str
);
struprW
(
val_str
);
*
r
=
jsval_string
(
val_str
);
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
val_str
;
}
}
else
SysFreeString
(
val_str
);
else
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
String_toLocaleLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_toLocaleLowerCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
String_toLocaleUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_toLocaleUpperCase
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
String_localeCompare
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_localeCompare
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
String_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
String_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
StringInstance
*
This
=
string_from_vdisp
(
jsthis
);
StringInstance
*
This
=
string_from_vdisp
(
jsthis
);
...
@@ -1471,8 +1455,7 @@ static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
...
@@ -1471,8 +1455,7 @@ static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
str
)
if
(
!
str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
break
;
break
;
}
}
default:
default:
...
@@ -1551,12 +1534,14 @@ static const builtin_info_t StringInst_info = {
...
@@ -1551,12 +1534,14 @@ static const builtin_info_t StringInst_info = {
/* ECMA-262 3rd Edition 15.5.3.2 */
/* ECMA-262 3rd Edition 15.5.3.2 */
static
HRESULT
StringConstr_fromCharCode
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
StringConstr_fromCharCode
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
unsigned
argc
,
VARIANT
*
argv
,
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
DWORD
i
,
code
;
DWORD
i
,
code
;
BSTR
ret
;
BSTR
ret
;
HRESULT
hres
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
ret
=
SysAllocStringLen
(
NULL
,
argc
);
ret
=
SysAllocStringLen
(
NULL
,
argc
);
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1571,17 +1556,15 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
...
@@ -1571,17 +1556,15 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
ret
[
i
]
=
code
;
ret
[
i
]
=
code
;
}
}
if
(
retv
)
{
if
(
r
)
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
ret
);
V_BSTR
(
retv
)
=
ret
;
else
}
SysFreeString
(
ret
);
else
SysFreeString
(
ret
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
StringConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
StringConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -1601,8 +1584,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1601,8 +1584,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
V_VT
(
retv
)
=
VT_BSTR
;
*
r
=
jsval_string
(
str
);
V_BSTR
(
retv
)
=
str
;
break
;
break
;
}
}
case
DISPATCH_CONSTRUCT
:
{
case
DISPATCH_CONSTRUCT
:
{
...
@@ -1624,7 +1606,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -1624,7 +1606,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
var_set_jsdisp
(
retv
,
ret
);
*
r
=
jsval_obj
(
ret
);
break
;
break
;
}
}
...
...
dlls/jscript/vbarray.c
View file @
932b3dd0
...
@@ -45,7 +45,7 @@ static inline VBArrayInstance *vbarray_this(vdisp_t *jsthis)
...
@@ -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
,
VARIANT
*
argv
,
static
HRESULT
VBArray_dimensions
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
...
@@ -55,13 +55,13 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
...
@@ -55,13 +55,13 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
if
(
!
vbarray
)
if
(
!
vbarray
)
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
SafeArrayGetDim
(
vbarray
->
safearray
));
*
r
=
jsval_number
(
SafeArrayGetDim
(
vbarray
->
safearray
));
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
VBArray_getItem
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
VBArray_getItem
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
int
i
,
*
indexes
;
int
i
,
*
indexes
;
...
@@ -96,14 +96,13 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
...
@@ -96,14 +96,13 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
else
if
(
FAILED
(
hres
))
else
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
retv
)
if
(
r
)
hres
=
VariantCopy
(
retv
,
&
out
);
hres
=
jsval_variant
(
r
,
&
out
);
return
hres
;
return
hres
;
}
}
static
HRESULT
VBArray_lbound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
VBArray_lbound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
int
dim
;
int
dim
;
...
@@ -128,13 +127,13 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
...
@@ -128,13 +127,13 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
else
if
(
FAILED
(
hres
))
else
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
dim
);
*
r
=
jsval_number
(
dim
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
VBArray_toArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
VBArray_toArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
jsdisp_t
*
array
;
jsdisp_t
*
array
;
...
@@ -176,13 +175,13 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
...
@@ -176,13 +175,13 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
SafeArrayUnaccessData
(
vbarray
->
safearray
);
SafeArrayUnaccessData
(
vbarray
->
safearray
);
if
(
r
etv
)
if
(
r
)
var_set_jsdisp
(
retv
,
array
);
*
r
=
jsval_obj
(
array
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
VBArray_ubound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
VBArray_ubound
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
int
dim
;
int
dim
;
...
@@ -207,13 +206,13 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
...
@@ -207,13 +206,13 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
else
if
(
FAILED
(
hres
))
else
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
r
etv
)
if
(
r
)
num_set_int
(
retv
,
dim
);
*
r
=
jsval_number
(
dim
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
VBArray_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
static
HRESULT
VBArray_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
...
@@ -275,7 +274,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
...
@@ -275,7 +274,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
,
VARIANT
*
argv
,
static
HRESULT
VBArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
VARIANT
*
argv
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
jsval_t
*
r
,
jsexcept_t
*
ei
)
{
{
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -287,8 +286,7 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
...
@@ -287,8 +286,7 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
if
(
argc
<
1
||
V_VT
(
argv
)
!=
(
VT_ARRAY
|
VT_VARIANT
))
if
(
argc
<
1
||
V_VT
(
argv
)
!=
(
VT_ARRAY
|
VT_VARIANT
))
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
return
throw_type_error
(
ctx
,
ei
,
JS_E_VBARRAY_EXPECTED
,
NULL
);
hres
=
VariantCopy
(
retv
,
argv
);
return
variant_to_jsval
(
argv
,
r
);
return
hres
;
case
DISPATCH_CONSTRUCT
:
case
DISPATCH_CONSTRUCT
:
if
(
argc
<
1
||
V_VT
(
argv
)
!=
(
VT_ARRAY
|
VT_VARIANT
))
if
(
argc
<
1
||
V_VT
(
argv
)
!=
(
VT_ARRAY
|
VT_VARIANT
))
...
@@ -304,7 +302,7 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
...
@@ -304,7 +302,7 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
return
hres
;
return
hres
;
}
}
var_set_jsdisp
(
retv
,
&
vbarray
->
dispex
);
*
r
=
jsval_obj
(
&
vbarray
->
dispex
);
break
;
break
;
default:
default:
...
...
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