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
9b0ebaeb
Commit
9b0ebaeb
authored
Feb 10, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added InStrRev implementation.
parent
ac3df5e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
3 deletions
+113
-3
global.c
dlls/vbscript/global.c
+55
-3
api.vbs
dlls/vbscript/tests/api.vbs
+58
-0
No files found.
dlls/vbscript/global.c
View file @
9b0ebaeb
...
...
@@ -1777,10 +1777,62 @@ static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt
return
return_bstr
(
res
,
ret
);
}
static
HRESULT
Global_InStrRev
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_InStrRev
(
vbdisp_t
*
This
,
VARIANT
*
arg
s
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
int
start
,
ret
=
0
;
BSTR
str1
,
str2
;
HRESULT
hres
;
TRACE
(
"%s %s arg_cnt=%u
\n
"
,
debugstr_variant
(
args
),
debugstr_variant
(
args
+
1
),
args_cnt
);
if
(
args_cnt
>
3
)
{
FIXME
(
"Unsupported args
\n
"
);
return
E_NOTIMPL
;
}
assert
(
2
<=
args_cnt
&&
args_cnt
<=
4
);
if
(
V_VT
(
args
)
==
VT_NULL
||
V_VT
(
args
+
1
)
==
VT_NULL
||
V_VT
(
args
+
2
)
==
VT_NULL
)
return
MAKE_VBSERROR
(
VBSE_ILLEGAL_NULL_USE
);
hres
=
to_string
(
args
,
&
str1
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
args
+
1
,
&
str2
);
if
(
SUCCEEDED
(
hres
))
{
if
(
args_cnt
>
2
)
{
hres
=
to_int
(
args
+
2
,
&
start
);
if
(
SUCCEEDED
(
hres
)
&&
start
<=
0
)
{
FIXME
(
"Unsupported start %d
\n
"
,
start
);
hres
=
E_NOTIMPL
;
}
}
else
{
start
=
SysStringLen
(
str1
);
}
}
if
(
SUCCEEDED
(
hres
))
{
const
WCHAR
*
ptr
;
size_t
len
;
len
=
SysStringLen
(
str2
);
if
(
start
>=
len
&&
start
<=
SysStringLen
(
str1
))
{
for
(
ptr
=
str1
+
start
-
SysStringLen
(
str2
);
ptr
>=
str1
;
ptr
--
)
{
if
(
!
memcmp
(
ptr
,
str2
,
len
*
sizeof
(
WCHAR
)))
{
ret
=
ptr
-
str1
+
1
;
break
;
}
}
}
}
SysFreeString
(
str1
);
SysFreeString
(
str2
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_int
(
res
,
ret
);
}
static
HRESULT
Global_LoadPicture
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
9b0ebaeb
...
...
@@ -282,6 +282,64 @@ Call ok(x = 2, "InStr returned " & x)
x
=
InStr
(
2.6
,
"abcd"
,
"bc"
)
Call
ok
(
x
=
0
,
"InStr returned "
&
x
)
x
=
InStrRev
(
"bcabcd"
,
"bc"
)
Call
ok
(
x
=
4
,
"InStrRev returned "
&
x
)
Call
ok
(
getVT
(
x
)
=
"VT_I4*"
,
"getVT(InStrRev) returned "
&
getVT
(
x
))
x
=
InStrRev
(
"bcabcd"
,
"bc"
,
6
)
Call
ok
(
x
=
4
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bcx"
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
3
)
Call
ok
(
x
=
2
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
2
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"b"
,
2
)
Call
ok
(
x
=
2
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
5
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
15
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
"abcd"
x
=
InStrRev
(
x
,
"bc"
)
Call
ok
(
x
=
2
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
1.3
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
2.3
)
Call
ok
(
x
=
0
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"abcd"
,
"bc"
,
2.6
)
Call
ok
(
x
=
2
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
"1234"
,
34
)
Call
ok
(
x
=
3
,
"InStrRev returned "
&
x
)
x
=
InStrRev
(
1234
,
34
)
Call
ok
(
x
=
3
,
"InStrRev returned "
&
x
)
Sub
testInStrRevError
(
arg1
,
arg2
,
arg3
,
error_num
)
on
error
resume
next
Dim
x
Call
Err
.
clear
()
x
=
InStrRev
(
arg1
,
arg2
,
arg3
)
Call
ok
(
Err
.
number
=
error_num
,
"Err.number = "
&
Err
.
number
)
End
Sub
call
testInStrRevError
(
"abcd"
,
null
,
2
,
94
)
call
testInStrRevError
(
null
,
"abcd"
,
2
,
94
)
call
testInStrRevError
(
"abcd"
,
"abcd"
,
null
,
94
)
Sub
TestMid
(
str
,
start
,
len
,
ex
)
x
=
Mid
(
str
,
start
,
len
)
Call
ok
(
x
=
ex
,
"Mid("
&
str
&
", "
&
start
&
", "
&
len
&
") = "
&
x
&
" expected "
&
ex
)
...
...
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