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
f123556f
Commit
f123556f
authored
Mar 18, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Allow creating RegExp object by new expression.
parent
d7a4f0eb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
12 deletions
+55
-12
interp.c
dlls/vbscript/interp.c
+11
-0
lang.vbs
dlls/vbscript/tests/lang.vbs
+12
-0
regexp.vbs
dlls/vbscript/tests/regexp.vbs
+6
-0
vbregexp.c
dlls/vbscript/vbregexp.c
+24
-12
vbscript.h
dlls/vbscript/vbscript.h
+2
-0
No files found.
dlls/vbscript/interp.c
View file @
f123556f
...
...
@@ -975,8 +975,19 @@ static HRESULT interp_new(exec_ctx_t *ctx)
VARIANT
v
;
HRESULT
hres
;
static
const
WCHAR
regexpW
[]
=
{
'r'
,
'e'
,
'g'
,
'e'
,
'x'
,
'p'
,
0
};
TRACE
(
"%s
\n
"
,
debugstr_w
(
arg
));
if
(
!
strcmpiW
(
arg
,
regexpW
))
{
V_VT
(
&
v
)
=
VT_DISPATCH
;
hres
=
create_regexp
(
&
V_DISPATCH
(
&
v
));
if
(
FAILED
(
hres
))
return
hres
;
return
stack_push
(
ctx
,
&
v
);
}
for
(
class_desc
=
ctx
->
script
->
classes
;
class_desc
;
class_desc
=
class_desc
->
next
)
{
if
(
!
strcmpiW
(
class_desc
->
name
,
arg
))
break
;
...
...
dlls/vbscript/tests/lang.vbs
View file @
f123556f
...
...
@@ -1132,4 +1132,16 @@ Call testarrarg(1, "VT_I2*")
Call
testarrarg
(
false
,
"VT_BOOL*"
)
Call
testarrarg
(
Empty
,
"VT_EMPTY*"
)
' It's allowed to declare non-builtin RegExp class...
class
RegExp
public
property
get
Global
()
Call
ok
(
false
,
"Global called"
)
Global
=
"fail"
end
property
end
class
' ...but there is no way to use it because builtin instance is always created
set
x
=
new
RegExp
Call
ok
(
x
.
Global
=
false
,
"x.Global = "
&
x
.
Global
)
reportSuccess
()
dlls/vbscript/tests/regexp.vbs
View file @
f123556f
...
...
@@ -168,4 +168,10 @@ Call ok(submatch.Count = 2, "submatch.Count = " & submatch.Count)
Call
ok
(
submatch
.
Item
(
0
)
=
"a"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
0
))
Call
ok
(
submatch
.
Item
(
1
)
=
"b"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
1
))
Set
x
=
new
regexp
Call
ok
(
x
.
Pattern
=
""
,
"RegExp.Pattern = "
&
x
.
Pattern
)
Call
ok
(
x
.
IgnoreCase
=
false
,
"RegExp.IgnoreCase = "
&
x
.
IgnoreCase
)
Call
ok
(
x
.
Global
=
false
,
"RegExp.Global = "
&
x
.
Global
)
Call
ok
(
x
.
Multiline
=
false
,
"RegExp.Multiline = "
&
x
.
Multiline
)
Call
reportSuccess
()
dlls/vbscript/vbregexp.c
View file @
f123556f
...
...
@@ -1599,29 +1599,41 @@ static IRegExpVtbl RegExpVtbl = {
RegExp_Replace
};
HRESULT
WINAPI
VBScriptRegExpFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
)
HRESULT
create_regexp
(
IDispatch
**
ret
)
{
RegExp2
*
re
t
;
RegExp2
*
re
gexp
;
HRESULT
hres
;
TRACE
(
"(%p %s %p)
\n
"
,
pUnkOuter
,
debugstr_guid
(
riid
),
ppv
);
hres
=
init_regexp_typeinfo
(
RegExp2_tid
);
if
(
FAILED
(
hres
))
return
hres
;
re
t
=
heap_alloc_zero
(
sizeof
(
*
ret
));
if
(
!
re
t
)
re
gexp
=
heap_alloc_zero
(
sizeof
(
*
regexp
));
if
(
!
re
gexp
)
return
E_OUTOFMEMORY
;
ret
->
IRegExp2_iface
.
lpVtbl
=
&
RegExp2Vtbl
;
ret
->
IRegExp_iface
.
lpVtbl
=
&
RegExpVtbl
;
regexp
->
IRegExp2_iface
.
lpVtbl
=
&
RegExp2Vtbl
;
regexp
->
IRegExp_iface
.
lpVtbl
=
&
RegExpVtbl
;
regexp
->
ref
=
1
;
heap_pool_init
(
&
regexp
->
pool
);
ret
->
ref
=
1
;
heap_pool_init
(
&
ret
->
pool
);
*
ret
=
(
IDispatch
*
)
&
regexp
->
IRegExp2_iface
;
return
S_OK
;
}
HRESULT
WINAPI
VBScriptRegExpFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
)
{
IDispatch
*
regexp
;
HRESULT
hres
;
TRACE
(
"(%p %s %p)
\n
"
,
pUnkOuter
,
debugstr_guid
(
riid
),
ppv
);
hres
=
create_regexp
(
&
regexp
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
I
RegExp2_QueryInterface
(
&
ret
->
IRegExp2_iface
,
riid
,
ppv
);
I
RegExp2_Release
(
&
ret
->
IRegExp2_iface
);
hres
=
I
Dispatch_QueryInterface
(
regexp
,
riid
,
ppv
);
I
Dispatch_Release
(
regexp
);
return
hres
;
}
...
...
dlls/vbscript/vbscript.h
View file @
f123556f
...
...
@@ -382,6 +382,8 @@ static inline BOOL is_int32(double d)
return
INT32_MIN
<=
d
&&
d
<=
INT32_MAX
&&
(
double
)(
int
)
d
==
d
;
}
HRESULT
create_regexp
(
IDispatch
**
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
VBScriptFactory_CreateInstance
(
IClassFactory
*
,
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
VBScriptRegExpFactory_CreateInstance
(
IClassFactory
*
,
IUnknown
*
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
...
...
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