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
5fa649ca
Commit
5fa649ca
authored
Sep 21, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Array.concat implementation.
parent
45cd5bc4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
3 deletions
+99
-3
array.c
dlls/jscript/array.c
+82
-3
api.js
dlls/jscript/tests/api.js
+17
-0
No files found.
dlls/jscript/array.c
View file @
5fa649ca
...
@@ -69,11 +69,90 @@ static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -69,11 +69,90 @@ static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
concat_array
(
DispatchEx
*
array
,
ArrayInstance
*
obj
,
DWORD
*
len
,
LCID
lcid
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
VARIANT
var
;
DWORD
i
;
HRESULT
hres
;
for
(
i
=
0
;
i
<
obj
->
length
;
i
++
)
{
hres
=
jsdisp_propget_idx
(
&
obj
->
dispex
,
i
,
lcid
,
&
var
,
ei
,
caller
);
if
(
hres
==
DISP_E_UNKNOWNNAME
)
continue
;
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_propput_idx
(
array
,
*
len
+
i
,
lcid
,
&
var
,
ei
,
caller
);
VariantClear
(
&
var
);
if
(
FAILED
(
hres
))
return
hres
;
}
*
len
+=
obj
->
length
;
return
S_OK
;
}
static
HRESULT
concat_obj
(
DispatchEx
*
array
,
IDispatch
*
obj
,
DWORD
*
len
,
LCID
lcid
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
DispatchEx
*
jsobj
;
VARIANT
var
;
HRESULT
hres
;
jsobj
=
iface_to_jsdisp
((
IUnknown
*
)
obj
);
if
(
jsobj
)
{
if
(
is_class
(
jsobj
,
JSCLASS_ARRAY
))
{
hres
=
concat_array
(
array
,
(
ArrayInstance
*
)
jsobj
,
len
,
lcid
,
ei
,
caller
);
jsdisp_release
(
jsobj
);
return
hres
;
}
jsdisp_release
(
jsobj
);
}
V_VT
(
&
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
var
)
=
obj
;
return
jsdisp_propput_idx
(
array
,
(
*
len
)
++
,
lcid
,
&
var
,
ei
,
caller
);
}
static
HRESULT
Array_concat
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
Array_concat
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
{
FIXME
(
"
\n
"
);
DispatchEx
*
ret
;
return
E_NOTIMPL
;
DWORD
len
=
0
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
create_array
(
dispex
->
ctx
,
0
,
&
ret
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
concat_obj
(
ret
,
(
IDispatch
*
)
_IDispatchEx_
(
dispex
),
&
len
,
lcid
,
ei
,
caller
);
if
(
SUCCEEDED
(
hres
))
{
VARIANT
*
arg
;
DWORD
i
;
for
(
i
=
0
;
i
<
arg_cnt
(
dp
);
i
++
)
{
arg
=
get_arg
(
dp
,
i
);
if
(
V_VT
(
arg
)
==
VT_DISPATCH
)
hres
=
concat_obj
(
ret
,
V_DISPATCH
(
arg
),
&
len
,
lcid
,
ei
,
caller
);
else
hres
=
jsdisp_propput_idx
(
ret
,
len
++
,
lcid
,
arg
,
ei
,
caller
);
if
(
FAILED
(
hres
))
break
;
}
}
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
{
V_VT
(
retv
)
=
VT_DISPATCH
;
V_DISPATCH
(
retv
)
=
(
IDispatch
*
)
_IDispatchEx_
(
ret
);
}
else
{
jsdisp_release
(
ret
);
}
return
S_OK
;
}
}
static
HRESULT
array_join
(
DispatchEx
*
array
,
LCID
lcid
,
DWORD
length
,
const
WCHAR
*
sep
,
VARIANT
*
retv
,
static
HRESULT
array_join
(
DispatchEx
*
array
,
LCID
lcid
,
DWORD
length
,
const
WCHAR
*
sep
,
VARIANT
*
retv
,
...
...
dlls/jscript/tests/api.js
View file @
5fa649ca
...
@@ -104,6 +104,23 @@ ok(arr.sort() === arr, "arr.sort() !== arr");
...
@@ -104,6 +104,23 @@ ok(arr.sort() === arr, "arr.sort() !== arr");
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
ok
(
arr
[
i
]
===
tmp
[
i
],
"arr["
+
i
+
"] = "
+
arr
[
i
]
+
" expected "
+
tmp
[
i
]);
ok
(
arr
[
i
]
===
tmp
[
i
],
"arr["
+
i
+
"] = "
+
arr
[
i
]
+
" expected "
+
tmp
[
i
]);
var
num
=
new
Number
(
6
);
arr
=
[
0
,
1
,
2
];
tmp
=
arr
.
concat
(
3
,
[
4
,
5
],
num
);
ok
(
tmp
!==
arr
,
"tmp === arr"
);
for
(
var
i
=
0
;
i
<
6
;
i
++
)
ok
(
tmp
[
i
]
===
i
,
"tmp["
+
i
+
"] = "
+
tmp
[
i
]);
ok
(
tmp
[
6
]
===
num
,
"tmp[6] !== num"
);
ok
(
tmp
.
length
===
7
,
"tmp.length = "
+
tmp
.
length
);
arr
=
[].
concat
();
ok
(
arr
.
length
===
0
,
"arr.length = "
+
arr
.
lrngth
);
arr
=
[
1
,];
tmp
=
arr
.
concat
([
2
]);
ok
(
tmp
.
length
===
3
,
"tmp.length = "
+
tmp
.
length
);
ok
(
tmp
[
1
]
===
undefined
,
"tmp[1] = "
+
tmp
[
1
]);
var
num
=
new
Number
(
2
);
var
num
=
new
Number
(
2
);
ok
(
num
.
toString
()
===
"2"
,
"num(2).toString !== 2"
);
ok
(
num
.
toString
()
===
"2"
,
"num(2).toString !== 2"
);
var
num
=
new
Number
();
var
num
=
new
Number
();
...
...
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