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
98f2dfee
Commit
98f2dfee
authored
Sep 24, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added RegExp contruction implementation.
parent
7a54be05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
3 deletions
+97
-3
global.c
dlls/jscript/global.c
+1
-1
regexp.c
dlls/jscript/regexp.c
+72
-2
regexp.js
dlls/jscript/tests/regexp.js
+24
-0
No files found.
dlls/jscript/global.c
View file @
98f2dfee
...
...
@@ -426,7 +426,7 @@ static HRESULT init_constructors(script_ctx_t *ctx)
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_
object
_constr
(
ctx
,
&
ctx
->
regexp_constr
);
hres
=
create_
regexp
_constr
(
ctx
,
&
ctx
->
regexp_constr
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/regexp.c
View file @
98f2dfee
...
...
@@ -3546,11 +3546,81 @@ static HRESULT create_regexp(script_ctx_t *ctx, const WCHAR *exp, int len, DWORD
return
S_OK
;
}
static
HRESULT
regexp_constructor
(
script_ctx_t
*
ctx
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
)
{
const
WCHAR
*
opt
=
emptyW
,
*
src
;
DispatchEx
*
ret
;
VARIANT
*
arg
;
HRESULT
hres
;
if
(
!
arg_cnt
(
dp
))
{
FIXME
(
"no args
\n
"
);
return
E_NOTIMPL
;
}
arg
=
get_arg
(
dp
,
0
);
if
(
V_VT
(
arg
)
==
VT_DISPATCH
)
{
DispatchEx
*
obj
;
obj
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
arg
));
if
(
obj
)
{
if
(
is_class
(
obj
,
JSCLASS_REGEXP
))
{
RegExpInstance
*
regexp
=
(
RegExpInstance
*
)
obj
;
hres
=
create_regexp
(
ctx
,
regexp
->
str
,
-
1
,
regexp
->
jsregexp
->
flags
,
&
ret
);
jsdisp_release
(
obj
);
if
(
FAILED
(
hres
))
return
hres
;
V_VT
(
retv
)
=
VT_DISPATCH
;
V_DISPATCH
(
retv
)
=
(
IDispatch
*
)
_IDispatchEx_
(
ret
);
return
S_OK
;
}
jsdisp_release
(
obj
);
}
}
if
(
V_VT
(
arg
)
!=
VT_BSTR
)
{
FIXME
(
"vt arg0 = %d
\n
"
,
V_VT
(
arg
));
return
E_NOTIMPL
;
}
src
=
V_BSTR
(
arg
);
if
(
arg_cnt
(
dp
)
>=
2
)
{
arg
=
get_arg
(
dp
,
1
);
if
(
V_VT
(
arg
)
!=
VT_BSTR
)
{
FIXME
(
"unimplemented for vt %d
\n
"
,
V_VT
(
arg
));
return
E_NOTIMPL
;
}
opt
=
V_BSTR
(
arg
);
}
hres
=
create_regexp_str
(
ctx
,
src
,
-
1
,
opt
,
strlenW
(
opt
),
&
ret
);
if
(
FAILED
(
hres
))
return
hres
;
V_VT
(
retv
)
=
VT_DISPATCH
;
V_DISPATCH
(
retv
)
=
(
IDispatch
*
)
_IDispatchEx_
(
ret
);
return
S_OK
;
}
static
HRESULT
RegExpConstr_value
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
DISPATCH_CONSTRUCT
:
return
regexp_constructor
(
dispex
->
ctx
,
dp
,
retv
);
default:
FIXME
(
"unimplemented flags: %x
\n
"
,
flags
);
return
E_NOTIMPL
;
}
return
S_OK
;
}
HRESULT
create_regexp_constr
(
script_ctx_t
*
ctx
,
DispatchEx
**
ret
)
...
...
dlls/jscript/tests/regexp.js
View file @
98f2dfee
...
...
@@ -51,4 +51,28 @@ ok(m.length === 2, "m.length is not 1");
ok
(
m
[
"0"
]
===
"aaab"
,
"m[0] is not
\"
ab
\"
"
);
ok
(
m
[
"1"
]
===
"ab"
,
"m[1] is not
\"
ab
\"
"
);
m
=
"abcabc"
.
match
(
new
RegExp
(
"ab"
));
ok
(
typeof
(
m
)
===
"object"
,
"typeof m is not object"
);
ok
(
m
.
length
===
1
,
"m.length is not 1"
);
ok
(
m
[
"0"
]
===
"ab"
,
"m[0] is not
\"
ab
\"
"
);
/*
m = "abcabc".match(new RegExp("ab","g"));
ok(typeof(m) === "object", "typeof m is not object");
ok(m.length === 2, "m.length is not 1");
ok(m["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\"");
m = "abcabc".match(new RegExp(/ab/g));
ok(typeof(m) === "object", "typeof m is not object");
ok(m.length === 2, "m.length is not 1");
ok(m["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\"");
m = "abcabc".match(new RegExp("ab","g", "test"));
ok(typeof(m) === "object", "typeof m is not object");
ok(m.length === 2, "m.length is not 1");
ok(m["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\"");
*/
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