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
43bc4af0
Commit
43bc4af0
authored
Jan 23, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added String.replace implementation.
parent
7749951d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
3 deletions
+96
-3
string.c
dlls/jscript/string.c
+52
-2
regexp.js
dlls/jscript/tests/regexp.js
+44
-1
No files found.
dlls/jscript/string.c
View file @
43bc4af0
...
@@ -1032,8 +1032,58 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
...
@@ -1032,8 +1032,58 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
static
HRESULT
String_search
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
String_search
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
{
FIXME
(
"
\n
"
);
DispatchEx
*
regexp
=
NULL
;
return
E_NOTIMPL
;
const
WCHAR
*
str
,
*
cp
;
match_result_t
match
;
VARIANT
*
arg
;
DWORD
length
;
BSTR
val_str
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
get_string_val
(
ctx
,
jsthis
,
ei
,
&
str
,
&
length
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
arg_cnt
(
dp
))
{
if
(
retv
)
V_VT
(
retv
)
=
VT_NULL
;
SysFreeString
(
val_str
);
return
S_OK
;
}
arg
=
get_arg
(
dp
,
0
);
if
(
V_VT
(
arg
)
==
VT_DISPATCH
)
{
regexp
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
arg
));
if
(
regexp
)
{
if
(
!
is_class
(
regexp
,
JSCLASS_REGEXP
))
{
jsdisp_release
(
regexp
);
regexp
=
NULL
;
}
}
}
if
(
!
regexp
)
{
hres
=
create_regexp_var
(
ctx
,
arg
,
NULL
,
&
regexp
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
}
}
cp
=
str
;
hres
=
regexp_match_next
(
ctx
,
regexp
,
FALSE
,
str
,
length
,
&
cp
,
NULL
,
NULL
,
NULL
,
&
match
);
SysFreeString
(
val_str
);
jsdisp_release
(
regexp
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
{
V_VT
(
retv
)
=
VT_I4
;
V_I4
(
retv
)
=
hres
==
S_OK
?
match
.
str
-
str
:
-
1
;
}
return
S_OK
;
}
}
/* ECMA-262 3rd Edition 15.5.4.13 */
/* ECMA-262 3rd Edition 15.5.4.13 */
...
...
dlls/jscript/tests/regexp.js
View file @
43bc4af0
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
*/
*/
var
m
,
re
,
b
;
var
m
,
re
,
b
,
i
,
obj
;
re
=
/a+/
;
re
=
/a+/
;
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
);
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
);
...
@@ -409,4 +409,47 @@ m = re.exec(" ");
...
@@ -409,4 +409,47 @@ m = re.exec(" ");
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected 0"
);
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected 0"
);
ok
(
m
===
null
,
"m = "
+
m
+
" expected null"
);
ok
(
m
===
null
,
"m = "
+
m
+
" expected null"
);
re
=
/aa/g
;
i
=
'baacd'
.
search
(
re
);
ok
(
i
===
1
,
"'baacd'.search(re) = "
+
i
);
ok
(
re
.
lastIndex
===
3
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
.
lastIndex
=
2
;
i
=
'baacdaa'
.
search
(
re
);
ok
(
i
===
1
,
"'baacd'.search(re) = "
+
i
);
ok
(
re
.
lastIndex
===
3
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/aa/
;
i
=
'baacd'
.
search
(
re
);
ok
(
i
===
1
,
"'baacd'.search(re) = "
+
i
);
ok
(
re
.
lastIndex
===
3
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
.
lastIndex
=
2
;
i
=
'baacdaa'
.
search
(
re
);
ok
(
i
===
1
,
"'baacd'.search(re) = "
+
i
);
ok
(
re
.
lastIndex
===
3
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/d/g
;
re
.
lastIndex
=
1
;
i
=
'abc'
.
search
(
re
);
ok
(
i
===
-
1
,
"'abc'.search(/d/g) = "
+
i
);
i
=
'abcdde'
.
search
(
/
[
df
]
/
);
ok
(
i
===
3
,
"'abc'.search(/[df]/) = "
+
i
);
i
=
'abcdde'
.
search
(
/
[
df
]
/
,
"a"
);
ok
(
i
===
3
,
"'abc'.search(/[df]/) = "
+
i
);
i
=
'abcdde'
.
search
(
"[df]"
);
ok
(
i
===
3
,
"'abc'.search(/d*/) = "
+
i
);
obj
=
{
toString
:
function
()
{
return
"abc"
;
}
};
i
=
String
.
prototype
.
search
.
call
(
obj
,
"b"
);
ok
(
i
===
1
,
"String.prototype.seatch.apply(obj, 'b') = "
+
i
);
i
=
" undefined "
.
search
();
ok
(
i
===
null
,
"' undefined '.search() = "
+
i
);
reportSuccess
();
reportSuccess
();
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