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
4b00511c
Commit
4b00511c
authored
Mar 29, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added Mid function implementation.
parent
eccd9770
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
3 deletions
+91
-3
global.c
dlls/vbscript/global.c
+70
-3
api.vbs
dlls/vbscript/tests/api.vbs
+21
-0
No files found.
dlls/vbscript/global.c
View file @
4b00511c
...
...
@@ -105,6 +105,23 @@ static inline HRESULT return_null(VARIANT *res)
return
S_OK
;
}
static
HRESULT
to_int
(
VARIANT
*
v
,
int
*
ret
)
{
switch
(
V_VT
(
v
))
{
case
VT_I2
:
*
ret
=
V_I2
(
v
);
break
;
case
VT_I4
:
*
ret
=
V_I4
(
v
);
break
;
default:
FIXME
(
"not supported %s
\n
"
,
debugstr_variant
(
v
));
return
E_NOTIMPL
;
}
return
S_OK
;
}
static
IUnknown
*
create_object
(
script_ctx_t
*
ctx
,
const
WCHAR
*
progid
)
{
IInternetHostSecurityManager
*
secmgr
=
NULL
;
...
...
@@ -471,10 +488,60 @@ static HRESULT Global_RightB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
return
E_NOTIMPL
;
}
static
HRESULT
Global_Mid
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_Mid
(
vbdisp_t
*
This
,
VARIANT
*
arg
s
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
int
len
=
-
1
,
start
,
str_len
;
BSTR
str
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
switch
(
args_cnt
)
{
case
3
:
hres
=
to_int
(
args
,
&
len
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
len
<
0
)
{
FIXME
(
"len = %d
\n
"
,
len
);
return
E_FAIL
;
}
/* fallthrough */
case
2
:
hres
=
to_int
(
args
+
args_cnt
-
2
,
&
start
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
args
+
args_cnt
-
1
)
!=
VT_BSTR
)
{
FIXME
(
"args[0] = %s
\n
"
,
debugstr_variant
(
args
+
args_cnt
-
1
));
return
E_NOTIMPL
;
}
str
=
V_BSTR
(
args
+
args_cnt
-
1
);
break
;
default:
assert
(
0
);
}
str_len
=
SysStringLen
(
str
);
start
--
;
if
(
start
>
str_len
)
start
=
str_len
;
if
(
len
==
-
1
)
len
=
str_len
-
start
;
else
if
(
len
>
str_len
-
start
)
len
=
str_len
-
start
;
if
(
res
)
{
V_VT
(
res
)
=
VT_BSTR
;
V_BSTR
(
res
)
=
SysAllocStringLen
(
str
+
start
,
len
);
if
(
!
V_BSTR
(
res
))
return
E_OUTOFMEMORY
;
}
return
S_OK
;
}
static
HRESULT
Global_MidB
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
4b00511c
...
...
@@ -124,4 +124,25 @@ Call ok(isNull(x), "InStr returned " & x)
x
=
InStr
(
2
,
null
,
"abcd"
)
Call
ok
(
isNull
(
x
),
"InStr returned "
&
x
)
Sub
TestMid
(
str
,
start
,
len
,
ex
)
x
=
Mid
(
str
,
start
,
len
)
Call
ok
(
x
=
ex
,
"Mid("
&
str
&
", "
&
start
&
", "
&
len
&
") = "
&
x
&
" expected "
&
ex
)
End
Sub
Sub
TestMid2
(
str
,
start
,
ex
)
x
=
Mid
(
str
,
start
)
Call
ok
(
x
=
ex
,
"Mid("
&
str
&
", "
&
start
&
") = "
&
x
&
" expected "
&
ex
)
End
Sub
TestMid
"test"
,
2
,
2
,
"es"
TestMid
"test"
,
2
,
4
,
"est"
TestMid
"test"
,
1
,
2
,
"te"
TestMid
"test"
,
1
,
0
,
""
TestMid
"test"
,
1
,
0
,
""
TestMid
"test"
,
5
,
2
,
""
TestMid2
"test"
,
1
,
"test"
TestMid2
"test"
,
2
,
"est"
TestMid2
"test"
,
4
,
"t"
TestMid2
"test"
,
5
,
""
Call
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